Class: SequencingPipeline

Inherits:
Pipeline show all
Defined in:
app/models/sequencing_pipeline.rb

Overview

rubocop:todo Style/Documentation

Instance Method Summary collapse

Methods inherited from Pipeline

#all_requests_from_submissions_selected?, #allow_tag_collision_on_tagging_task?, #completed_request_as_part_of_release_batch, #custom_message, #extract_requests_from_input_params, #has_controls?, #input_labware, #output_labware, #pick_information?, #post_finish_batch, #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

#detach_request_from_batch(batch, request) ⇒ Object

The guys in sequencing want to be able to re-run a request in another batch. What we've agreed is that the request will be failed and then an identical request will be resubmitted to their inbox. The “failed” request should not be charged for.


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/models/sequencing_pipeline.rb', line 34

def detach_request_from_batch(batch, request)
  request.fail!

  # Note that the request metadata also needs to be cloned for this to work.
  ActiveRecord::Base.transaction do
    request.dup.tap do |request_clone|
      rma = request..attributes.merge(request: request_clone)
      request_clone.update!(state: 'pending', target_asset_id: nil, request_metadata_attributes: rma)
      request_clone.comments.create!(
        description:
          # rubocop:todo Layout/LineLength
          "Automatically created clone of request #{request.id} which was removed from Batch #{batch.id} at #{DateTime.now}"
        # rubocop:enable Layout/LineLength
      )
      request.comments.create!(
        description: "The request #{request_clone.id} is an automatically created clone of this one"
      )
    end
  end
end

#is_read_length_consistent_for_batch?(batch) ⇒ Boolean

rubocop:todo Metrics/AbcSize

Returns:

  • (Boolean)

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/models/sequencing_pipeline.rb', line 14

def is_read_length_consistent_for_batch?(batch) # rubocop:todo Metrics/AbcSize
  if (batch.requests.size == 0) || (batch.requests.first..nil?)
    # No requests selected or the pipeline doesn't contain metadata to check
    return true
  end

  read_length_list = batch.requests.filter_map { |request| request..read_length }

  # The pipeline doen't contain the read_length attribute
  return true if read_length_list.size == 0

  # There are some requests that don't have the read_length_attribute
  return false if read_length_list.size != batch.requests.size

  (read_length_list.uniq.size == 1)
end

#on_start_batch(batch, user) ⇒ Object


55
56
57
# File 'app/models/sequencing_pipeline.rb', line 55

def on_start_batch(batch, user)
  BroadcastEvent::SequencingStart.create!(seed: batch, user: user, properties: {}, created_at: DateTime.now)
end

#post_release_batch(batch, _user) ⇒ Object


59
60
61
62
63
64
65
66
# File 'app/models/sequencing_pipeline.rb', line 59

def post_release_batch(batch, _user)
  # We call compact to handle ControlRequests which may have no target asset.
  # In practice this isn't required, as we don't use control lanes any more.
  # However some old feature tests still use them, and until this behaviour is completely
  # deprecated we should leave it here.
  batch.assets.compact.uniq.each(&:index_aliquots)
  Messenger.create!(target: batch, template: 'FlowcellIO', root: 'flowcell')
end

#request_actionsObject


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

def request_actions
  [:remove]
end