Module: Tasks::AssignTubesToWellsHandler
- Included in:
- WorkflowsController
- Defined in:
- app/models/tasks/assign_tubes_to_wells_handler.rb
Overview
Handles the behaviour of AssignTubesToMultiplexedWellsTask and included in WorkflowsController A Task used in PacBioSequencingPipeline Assigns tagged tube into multiplexed wells on the target plate for pooling.
Instance Method Summary collapse
- #do_assign_pick_volume_task(_task, params) ⇒ Object
-
#do_assign_requests_to_multiplexed_wells_task(task, params, plate = nil) ⇒ Object
Plate is an option parameter for a target plate.
- #find_or_create_plate(purpose) ⇒ Object
Instance Method Details
#do_assign_pick_volume_task(_task, params) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'app/models/tasks/assign_tubes_to_wells_handler.rb', line 34 def do_assign_pick_volume_task(_task, params) @batch.requests.each do |r| next if r.target_asset.nil? r.target_asset.set_picked_volume(params[:micro_litre_volume_required].to_i) end true end |
#do_assign_requests_to_multiplexed_wells_task(task, params, plate = nil) ⇒ Object
Plate is an option parameter for a target plate. Used in multiplexed cherrypicking. In its absence a plate is created
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/models/tasks/assign_tubes_to_wells_handler.rb', line 7 def do_assign_requests_to_multiplexed_wells_task(task, params, plate = nil) plate ||= find_or_create_plate(task.purpose) well_hash = plate.wells.located_at(params[:request_locations].values.uniq).index_by(&:map_description) problem_wells = wells_with_duplicates(params) if problem_wells.present? flash[:error] = "Duplicate tags in #{problem_wells.join(',')}" return false end incompatible_wells = find_incompatible_wells(params) if incompatible_wells.present? flash[:error] = "Incompatible requests in #{incompatible_wells.join(',')}" return false end @batch.requests.each do |request| target_well = params[:request_locations][request.id.to_s] request.target_asset = well_hash[target_well] request.save! end true end |
#find_or_create_plate(purpose) ⇒ Object
75 76 77 78 |
# File 'app/models/tasks/assign_tubes_to_wells_handler.rb', line 75 def find_or_create_plate(purpose) first_request = @batch.requests.first first_request.target_asset.try(:plate) || purpose.create! end |