Class: PacBioSamplePrepPipeline

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

Constant Summary collapse

ALWAYS_SHOW_RELEASE_ACTIONS =
true

Instance Method Summary collapse

Methods included from Pipeline::GroupByParent

#input_labware, #output_labware

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, #post_finish_batch, #request_actions, #request_types_including_controls, #robot_verified!, #update_detached_request

Methods included from SharedBehaviour::Named

included

Methods included from Pipeline::BatchValidation

#validation_of_batch, #validation_of_batch_for_completion

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 Warren::BroadcastMessages

#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren

Instance Method Details

#allow_tag_collision_on_tagging_task?Boolean

Returns:

  • (Boolean)

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

def allow_tag_collision_on_tagging_task?
  false
end

#cancel_downstream_requests(request) ⇒ Object


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

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

#cancel_excess_downstream_requests(request, number_to_cancel) ⇒ Object


41
42
43
44
45
# File 'app/models/pac_bio_sample_prep_pipeline.rb', line 41

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


29
30
31
32
33
34
35
36
37
38
39
# File 'app/models/pac_bio_sample_prep_pipeline.rb', line 29

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


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

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

#number_of_smrt_cells_requested(request) ⇒ Object


47
48
49
# File 'app/models/pac_bio_sample_prep_pipeline.rb', line 47

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

#post_release_batch(batch, _user) ⇒ Object


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

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