Class: Plate::QuadCreator
- Inherits:
-
Object
- Object
- Plate::QuadCreator
- Includes:
- ActiveModel::Model
- Defined in:
- app/models/plate/quad_creator.rb
Overview
The Quad creator takes 4 parent 96 well plates or size 96 tube-racks and transfers them onto a new 384 well plate
Instance Attribute Summary collapse
-
#target_purpose ⇒ Object
Returns the value of attribute target_purpose.
-
#user ⇒ Object
Returns the value of attribute user.
-
#user_barcode ⇒ Object
Returns the value of attribute user_barcode.
Class Method Summary collapse
-
.target_coordinate_for(source_coordinate_name, quadrant_index) ⇒ String
Calculate the target coordinate for a source coordinate and quadrant number.
Instance Method Summary collapse
- #parent_barcodes ⇒ Object
- #parent_barcodes=(quad_barcodes) ⇒ Object
- #save ⇒ Object
- #target_plate ⇒ Object
- #target_purpose_id ⇒ Object
Instance Attribute Details
#target_purpose ⇒ Object
Returns the value of attribute target_purpose.
8 9 10 |
# File 'app/models/plate/quad_creator.rb', line 8 def target_purpose @target_purpose end |
#user ⇒ Object
Returns the value of attribute user.
8 9 10 |
# File 'app/models/plate/quad_creator.rb', line 8 def user @user end |
#user_barcode ⇒ Object
Returns the value of attribute user_barcode.
8 9 10 |
# File 'app/models/plate/quad_creator.rb', line 8 def @user_barcode end |
Class Method Details
.target_coordinate_for(source_coordinate_name, quadrant_index) ⇒ String
Calculate the target coordinate for a source coordinate and quadrant number
113 114 115 116 117 118 119 120 |
# File 'app/models/plate/quad_creator.rb', line 113 def target_coordinate_for(source_coordinate_name, quadrant_index) row_offset = quadrant_index % 2 # q0 -> 0, q1 -> 1, q2 -> 0, q3 -> 1 col_offset = quadrant_index / 2 # q0 -> 0, q1 -> 0, q2 -> 1, q3 -> 1 col, row = locn_coordinate(source_coordinate_name) # A1 -> 0, 0 target_col = (col * 2) + col_offset target_row = (row * 2) + row_offset Map.location_from_row_and_column(target_row, target_col + 1) # this method expects target_col to be 1-indexed end |
Instance Method Details
#parent_barcodes ⇒ Object
31 32 33 |
# File 'app/models/plate/quad_creator.rb', line 31 def @parent_barcodes ||= @parents.transform_values(&:machine_barcode) end |
#parent_barcodes=(quad_barcodes) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'app/models/plate/quad_creator.rb', line 22 def () @parent_barcodes = found_parents = Labware.(.values) @parents = .transform_values do || found_parents.detect { |candidate| candidate.() } || :not_found end end |
#save ⇒ Object
14 15 16 |
# File 'app/models/plate/quad_creator.rb', line 14 def save valid? && creation.save && transfer_request_collection.save && .save end |
#target_plate ⇒ Object
18 19 20 |
# File 'app/models/plate/quad_creator.rb', line 18 def target_plate @creation&.child end |
#target_purpose_id ⇒ Object
35 36 37 |
# File 'app/models/plate/quad_creator.rb', line 35 def target_purpose_id @target_purpose&.id end |