Class: LabwareCreators::PcrCyclesBinnedPlateForTNanoSeq

Inherits:
PcrCyclesBinnedPlateBase show all
Defined in:
app/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq.rb

Overview

This version of the class is specific to the Targeted NanoSeq pipeline.

Constant Summary collapse

CUSTOMER_FILENAME =
'targeted_nano_seq_customer_file.csv'

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from LabwareCreators::Base

Instance Method Details

#after_transfer!Object

rubocop:disable Metrics/AbcSize



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq.rb', line 11

def after_transfer!
  # called as part of the 'super' call in the 'save' method
  # retrieve child plate through v2 api, using uuid got through v1 api
  child_v2_plate = Sequencescape::Api::V2.plate_with_custom_includes(CHILD_PLATE_INCLUDES, uuid: child.uuid)

  # cycle through the child wells and for each get the related request and write some metadata
  # to it based on the details in the customer file
  child_wells_by_location = child_v2_plate.wells.index_by(&:location)

  well_details.each do |parent_location, details|
    child_well_location = transfer_hash[parent_location]['dest_locn']
    child_well = child_wells_by_location[child_well_location]

    # NB. this seems to return an array of requests via the api but a single request in tests
    request = Array(child_well.aliquots.first.request).first

    if request.blank?
      raise StandardError, "Unable to identify request for child plate well at location #{child_well_location}"
    end

    # create hash containing the key value pairs we want to store as metadata on the request
     = {
      'original_plate_barcode' => parent.human_barcode,
      'original_well_id' => parent_location,
      'concentration_nm' => details['concentration'].to_s,
      'input_amount_available' => details['input_amount_available'].to_s,
      'input_amount_desired' => details['input_amount_desired'].to_s,
      'sample_volume' => details['sample_volume'].to_s,
      'diluent_volume' => details['diluent_volume'].to_s,
      'pcr_cycles' => details['pcr_cycles'].to_s,
      'hyb_panel' => details['hyb_panel']
    }
    (request, , child_well_location)
  end
end

#create_or_update_request_metadata(request, request_metadata, child_well_location) ⇒ Object

Cycles through a hash of key value pairs and creates a new metadatum or updates the existing one for each metadata field to be stored against the request object. NB. makes assumption that metadata from previous iterations can be safely overwritten



52
53
54
55
56
57
58
59
60
61
62
# File 'app/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq.rb', line 52

def (request, , child_well_location)
  .each do |, |
     = (, request.id)

    if .present?
      (, , , child_well_location)
    else
      (, , request, child_well_location)
    end
  end
end