Class: SequencingPipeline

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

Overview

rubocop:todo Style/Documentation

Constant Summary

Constants inherited from Pipeline

Pipeline::ALWAYS_SHOW_RELEASE_ACTIONS

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, #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 Squishify

extended

Methods included from Warren::BroadcastMessages

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

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.


35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'app/models/sequencing_pipeline.rb', line 35

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: "Automatically created clone of request #{request.id} which was removed from Batch #{batch.id} at #{DateTime.now}")
      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

Returns:

  • (Boolean)

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

def is_read_length_consistent_for_batch?(batch)
  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.map do |request|
    request..read_length
  end.compact

  # 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


49
50
51
# File 'app/models/sequencing_pipeline.rb', line 49

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


53
54
55
56
57
58
59
60
# File 'app/models/sequencing_pipeline.rb', line 53

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


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

def request_actions
  [:remove]
end