Class: PacBioSamplePrepPipeline

Inherits:
Pipeline show all
Includes:
Pipeline::GroupByParent
Defined in:
app/models/pac_bio_sample_prep_pipeline.rb

Overview

rubocop:todo Style/Documentation

Instance Method Summary collapse

Methods included from Pipeline::GroupByParent

#extract_requests_from_input_params, #input_labware, #output_labware, #requests_in_inbox

Methods inherited from Pipeline

#all_requests_from_submissions_selected?, #completed_request_as_part_of_release_batch, #detach_request_from_batch, #extract_requests_from_input_params, #has_controls?, #input_labware, #is_read_length_consistent_for_batch?, #on_start_batch, #output_labware, #pick_information?, #post_finish_batch, #request_actions, #request_count_in_inbox, #request_types_including_controls, #requests_in_inbox, #robot_verified!, #update_detached_request

Methods included from SharedBehaviour::Named

included

Methods included from Pipeline::BatchValidation

#validation_of_batch

Methods included from Uuid::Uuidable

included, #unsaved_uuid!, #uuid

Methods inherited from ApplicationRecord

convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Squishify

extended

Instance Method Details

#allow_tag_collision_on_tagging_task?Boolean

Returns:

  • (Boolean)

15
16
17
# File 'app/models/pac_bio_sample_prep_pipeline.rb', line 15

def allow_tag_collision_on_tagging_task?
  false
end

#cancel_downstream_requests(request) ⇒ Object


24
25
26
# File 'app/models/pac_bio_sample_prep_pipeline.rb', line 24

def cancel_downstream_requests(request)
  request.next_requests.select(&:pending?).each(&:cancel_from_upstream!)
end

#cancel_excess_downstream_requests(request, number_to_cancel) ⇒ Object


44
45
46
47
48
49
50
51
# File 'app/models/pac_bio_sample_prep_pipeline.rb', line 44

def cancel_excess_downstream_requests(request, number_to_cancel)
  request
    .next_requests
    .select(&:pending?)
    .each_with_index do |sequencing_request, index|
      sequencing_request.cancel_from_upstream! if index < number_to_cancel
    end
end

#cancel_excess_sequencing_requests(batch) ⇒ Object


32
33
34
35
36
37
38
39
40
41
42
# File 'app/models/pac_bio_sample_prep_pipeline.rb', line 32

def cancel_excess_sequencing_requests(batch)
  batch.requests.each do |request|
    smrt_cells_available = request.target_asset.labware..smrt_cells_available
    smrt_cells_requested = number_of_smrt_cells_requested(request)
    next if smrt_cells_available.nil? || smrt_cells_requested.nil?

    if smrt_cells_available < smrt_cells_requested
      cancel_excess_downstream_requests(request, (smrt_cells_requested - smrt_cells_available))
    end
  end
end

#cancel_sequencing_requests_on_library_failure(batch) ⇒ Object


28
29
30
# File 'app/models/pac_bio_sample_prep_pipeline.rb', line 28

def cancel_sequencing_requests_on_library_failure(batch)
  batch.requests.each { |request| cancel_downstream_requests(request) if request.failed? }
end

#custom_messageObject


11
12
13
# File 'app/models/pac_bio_sample_prep_pipeline.rb', line 11

def custom_message
  I18n.t('pipelines.show_page_custom_message.pacbio_sample_prep')
end

#number_of_smrt_cells_requested(request) ⇒ Object


53
54
55
# File 'app/models/pac_bio_sample_prep_pipeline.rb', line 53

def number_of_smrt_cells_requested(request)
  request.next_requests.count(&:pending?)
end

#post_release_batch(batch, _user) ⇒ Object


19
20
21
22
# File 'app/models/pac_bio_sample_prep_pipeline.rb', line 19

def post_release_batch(batch, _user)
  cancel_sequencing_requests_on_library_failure(batch)
  cancel_excess_sequencing_requests(batch)
end