Class: LabwareCreators::PooledTubesFromWholePlates
- Includes:
- CustomPage, SupportParent::TaggedPlateOnly
- Defined in:
- app/models/labware_creators/pooled_tubes_from_whole_plates.rb
Overview
Pools one or more plates into a single tube. Useful for MiSeqQC
Instance Attribute Summary collapse
-
#barcodes ⇒ Object
Returns the value of attribute barcodes.
-
#child ⇒ Object
readonly
Returns the value of attribute child.
-
#tube_transfer ⇒ Object
readonly
Returns the value of attribute tube_transfer.
Instance Method Summary collapse
-
#available_plates ⇒ Object
TODO: This should probably be asynchronous.
-
#create_labware! ⇒ Object
rubocop:todo Metrics/AbcSize.
- #number_of_parent_labwares ⇒ Object
- #parent ⇒ Object included from SupportParent::TaggedPlateOnly
- #parents ⇒ Object
- #parents_suitable ⇒ Object
- #plate_search ⇒ Object
- #stock_plate_barcode ⇒ Object
Constructor Details
This class inherits a constructor from LabwareCreators::Base
Instance Attribute Details
#barcodes ⇒ Object
Returns the value of attribute barcodes.
8 9 10 |
# File 'app/models/labware_creators/pooled_tubes_from_whole_plates.rb', line 8 def @barcodes end |
#child ⇒ Object (readonly)
Returns the value of attribute child.
8 9 10 |
# File 'app/models/labware_creators/pooled_tubes_from_whole_plates.rb', line 8 def child @child end |
#tube_transfer ⇒ Object (readonly)
Returns the value of attribute tube_transfer.
8 9 10 |
# File 'app/models/labware_creators/pooled_tubes_from_whole_plates.rb', line 8 def tube_transfer @tube_transfer end |
Instance Method Details
#available_plates ⇒ Object
TODO: This should probably be asynchronous
46 47 48 49 |
# File 'app/models/labware_creators/pooled_tubes_from_whole_plates.rb', line 46 def available_plates @search_options = OngoingPlate.new(purposes: [parent.plate_purpose.uuid], include_used: false, states: ['passed']) @search_results = plate_search.all(Limber::Plate, @search_options.search_parameters) end |
#create_labware! ⇒ Object
rubocop:todo Metrics/AbcSize
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/models/labware_creators/pooled_tubes_from_whole_plates.rb', line 16 def create_labware! # rubocop:todo Metrics/AbcSize # Create a single tube # TODO: This should link to multiple parents in production @child = api .specific_tube_creation .create!( user: user_uuid, parent: parents.first.uuid, child_purposes: [purpose_uuid], tube_attributes: [{ name: "#{}+" }] ) .children .first # Transfer EVERYTHING into it parents.each do |parent_plate| transfer_template.create!(user: user_uuid, source: parent_plate.uuid, destination: @child.uuid) end end |
#number_of_parent_labwares ⇒ Object
67 68 69 70 |
# File 'app/models/labware_creators/pooled_tubes_from_whole_plates.rb', line 67 def number_of_parent_labwares # default to 4 if value not found in config purpose_config.fetch(:number_of_parent_labwares, 4) end |
#parent ⇒ Object Originally defined in module SupportParent::TaggedPlateOnly
#parents ⇒ Object
51 52 53 54 |
# File 'app/models/labware_creators/pooled_tubes_from_whole_plates.rb', line 51 def parents @parents ||= api.search.find(Settings.searches['Find assets by barcode']).all(Limber::BarcodedAsset, barcode: ) end |
#parents_suitable ⇒ Object
56 57 58 59 60 61 |
# File 'app/models/labware_creators/pooled_tubes_from_whole_plates.rb', line 56 def parents_suitable = - parents.map { |p| p..machine } return if .empty? errors.add(:barcodes, "could not be found: #{}") end |
#plate_search ⇒ Object
63 64 65 |
# File 'app/models/labware_creators/pooled_tubes_from_whole_plates.rb', line 63 def plate_search api.search.find(Settings.searches['Find plates']) end |
#stock_plate_barcode ⇒ Object
41 42 43 |
# File 'app/models/labware_creators/pooled_tubes_from_whole_plates.rb', line 41 def "#{parents.first.stock_plate..prefix}#{parents.first.stock_plate..number}" end |