Class: Robots::Bed::PlateToTubeRacksBed
- Defined in:
- app/models/robots/bed/plate_to_tube_racks_bed.rb
Overview
This bed hosts the parent plate or a tube-rack. It uses the robot to find its labware and child labware. When it is used as a source bed, it should host the Plate. When it is used as a destination bed, it should host a tube-rack wrapper.
Instance Method Summary collapse
-
#change_tube_state(tube) ⇒ Object
Changes the state of one tube to the target state.
-
#child_labware ⇒ Array<TubeRackWrapper>
Returns an array of labware from the robot’s labware store for barcodes.
-
#labware_created_with_robot(robot_barcode) ⇒ void
Updates the metadata of the labware with the robot barcode.
-
#load(barcodes) ⇒ void
Loads labware into this bed from the robot’s labware store.
-
#transition ⇒ void
Changes the state of the labware to the target state.
Instance Method Details
#change_tube_state(tube) ⇒ Object
Changes the state of one tube to the target state. This method is called by the transition method.
61 62 63 64 |
# File 'app/models/robots/bed/plate_to_tube_racks_bed.rb', line 61 def change_tube_state(tube) state_changer = StateChangers.lookup_for(tube.purpose.uuid) state_changer.new(api, tube.uuid, user_uuid).move_to!(target_state, "Robot #{robot.name} started") end |
#child_labware ⇒ Array<TubeRackWrapper>
Returns an array of labware from the robot’s labware store for barcodes.
30 31 32 33 34 |
# File 'app/models/robots/bed/plate_to_tube_racks_bed.rb', line 30 def child_labware return [] if labware.blank? @child_labware ||= robot.child_labware(labware) end |
#labware_created_with_robot(robot_barcode) ⇒ void
This method returns an undefined value.
Updates the metadata of the labware with the robot barcode. This method is called inside the robot controller’s start action for tube-rack wrappers and it sets the created_with_robot metadata field.
17 18 19 20 21 22 23 24 |
# File 'app/models/robots/bed/plate_to_tube_racks_bed.rb', line 17 def labware_created_with_robot() # RobotController uses machine barcode for initialising LabwareMetadata labware.tubes.each do |tube| LabwareMetadata .new(api: api, user: user_uuid, barcode: tube..machine) .update!(created_with_robot: ) end end |
#load(barcodes) ⇒ void
This method returns an undefined value.
Loads labware into this bed from the robot’s labware store.
41 42 43 44 |
# File 'app/models/robots/bed/plate_to_tube_racks_bed.rb', line 41 def load() @barcodes = Array().filter_map(&:strip).uniq @labware = @barcodes.present? ? robot.find_bed_labware(@barcodes) : [] end |
#transition ⇒ void
This method returns an undefined value.
Changes the state of the labware to the target state. It will change the state of all tubes of the tube-rack on this bed.
51 52 53 54 55 |
# File 'app/models/robots/bed/plate_to_tube_racks_bed.rb', line 51 def transition return if target_state.nil? || labware.nil? # We have nothing to do labware.tubes.each { |tube| change_tube_state(tube) } end |