Class: LabwareCreators::PooledTubesBySubmissionWithPhiX
- Inherits:
-
PooledTubesBySubmission
- Object
- Base
- PooledTubesBase
- PooledTubesBySubmission
- LabwareCreators::PooledTubesBySubmissionWithPhiX
- Includes:
- CustomPage
- Defined in:
- app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb
Overview
Includes the addition of PhiX, a specific type of control sample. User scans SpikedBuffer tube containing PhiX into an interstitial page, on tube creation. SpikedBuffer tube is recorded as a parent of the newly created tube(s).
Instance Attribute Summary collapse
-
#spikedbuffer_tube_barcode ⇒ Object
Returns the value of attribute spikedbuffer_tube_barcode.
Instance Method Summary collapse
- #create_child_stock_tubes ⇒ Object
- #parents ⇒ Object
-
#scanned_tube ⇒ Object
Only call this method if the spikedbuffer_tube_barcode is present.
-
#tube_must_be_spiked_buffer ⇒ Object
It is valid to not provide a spikedbuffer_tube_barcode, but if provided out it must make sense.
Constructor Details
This class inherits a constructor from LabwareCreators::Base
Instance Attribute Details
#spikedbuffer_tube_barcode ⇒ Object
Returns the value of attribute spikedbuffer_tube_barcode.
15 16 17 |
# File 'app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb', line 15 def @spikedbuffer_tube_barcode end |
Instance Method Details
#create_child_stock_tubes ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb', line 17 def create_child_stock_tubes api .specific_tube_creation .create!( user: user_uuid, parents: parents, child_purposes: [purpose_uuid] * pool_uuids.length, tube_attributes: tube_attributes ) .children .index_by(&:name) end |
#parents ⇒ Object
30 31 32 33 34 |
# File 'app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb', line 30 def parents parents = [parent_uuid] parents << scanned_tube.uuid if .present? parents end |
#scanned_tube ⇒ Object
Only call this method if the spikedbuffer_tube_barcode is present
45 46 47 48 |
# File 'app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb', line 45 def scanned_tube search_params = { barcode: } @scanned_tube ||= Sequencescape::Api::V2::Tube.find_by(search_params) end |
#tube_must_be_spiked_buffer ⇒ Object
It is valid to not provide a spikedbuffer_tube_barcode, but if provided out it must make sense
37 38 39 40 41 42 |
# File 'app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb', line 37 def tube_must_be_spiked_buffer return if .blank? errors.add(:base, "A tube with that barcode couldn't be found.") if scanned_tube.blank? # TODO: add validation to check tube is SpikedBuffer (requires change to SS V2 API) end |