Class: IlluminaHtp::MxTubePurpose

Inherits:
Tube::Purpose
  • Object
show all
Defined in:
app/models/illumina_htp/mx_tube_purpose.rb

Overview

Purposes of this class represent multiplexed library tubes in the high-throughput pipeline. These tubes represent the cleaned-up normalized libraries at the end of the process that can pass directly into a SequencingPipeline. State changes on these tubes will automatically update the requests into the tubes

Instance Method Summary collapse

Instance Method Details

#library_source_plates(tube) ⇒ Object


41
42
43
# File 'app/models/illumina_htp/mx_tube_purpose.rb', line 41

def library_source_plates(tube)
  source_plate_scope(tube).map(&:source_plate)
end

#source_plate(tube) ⇒ Object


33
34
35
# File 'app/models/illumina_htp/mx_tube_purpose.rb', line 33

def source_plate(tube)
  super || source_plate_scope(tube).first
end

#source_plate_scope(tube) ⇒ Object


45
46
47
48
49
50
51
52
53
# File 'app/models/illumina_htp/mx_tube_purpose.rb', line 45

def source_plate_scope(tube)
  Plate
    .joins(wells: :requests)
    .where(requests: {
             target_asset_id: tube.id,
             sti_type: [Request::Multiplexing, Request::AutoMultiplexing, Request::LibraryCreation,
                        *Request::LibraryCreation.descendants].map(&:name)
           }).distinct
end

#source_plates(tube) ⇒ Object


37
38
39
# File 'app/models/illumina_htp/mx_tube_purpose.rb', line 37

def source_plates(tube)
  super.presence || source_plate_scope(tube)
end

#stock_plate(tube) ⇒ Plate?

Attempts to find the 'stock_plate' for a given tube. However this is a fairly nebulous concept. Often it means the plate that first entered a pipeline, but in other cases it can be the XP plate part way through the process. Further complication comes from tubes which pool across multiple plates, where identifying a single stock plate is meaningless. In other scenarios, you split plates out again and the asset link graph is insufficient.

JG: 2021-02-11: In this case we attempt to jump back through the requests. In most limber pipelines this will actually return the plate on which you charge and pass. See github.com/sanger/sequencescape/issues/3040 for more information

Parameters:

  • tube (Tube)

    The tube for which to find the stock_plate

Returns:

  • (Plate, nil)

    The stock plate if found


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

def stock_plate(tube)
  tube.requests_as_target.where.not(requests: { asset_id: nil }).first&.asset&.plate
end