Class: Utility::PcrCyclesBinningCalculator
- Inherits:
-
Object
- Object
- Utility::PcrCyclesBinningCalculator
- Includes:
- ActiveModel::Model, CommonDilutionCalculations
- Defined in:
- app/models/utility/pcr_cycles_binning_calculator.rb
Overview
Handles the Computations for PCR Cycles binning. Used by the PCR Cycles Binned Plate class to handle the binning processing.
Instance Attribute Summary collapse
-
#config ⇒ Object
included
from CommonDilutionCalculations
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #compute_presenter_bin_details ⇒ Object
-
#compute_vol_source_reqd(sample_conc) ⇒ float
included
from CommonDilutionCalculations
Computes the volume of source material required for normalisation based on the sample concentration and attributes from the purpose configuration (target amount and volume, minimum source volume).
- #compute_well_transfers(parent_plate) ⇒ Object
-
#construct_dest_qc_assay_attributes(child_uuid, transfer_hash) ⇒ array
included
from CommonDilutionCalculations
Constructs the qc_assays collection details for use when writing calculated concentrations for the newly created child plate.
-
#extract_destination_concentrations(transfer_hash) ⇒ hash
included
from CommonDilutionCalculations
Refactor the transfers hash to give destination concentrations.
-
#initialize(well_details) ⇒ PcrCyclesBinningCalculator
constructor
A new instance of PcrCyclesBinningCalculator.
-
#normalisation_details(wells) ⇒ hash
included
from CommonDilutionCalculations
Creates a hash of well normalisation details for a plate used when generating the well transfers and qc assays.
- #presenter_bins_key ⇒ Object
Constructor Details
#initialize(well_details) ⇒ PcrCyclesBinningCalculator
Returns a new instance of PcrCyclesBinningCalculator.
10 11 12 |
# File 'app/models/utility/pcr_cycles_binning_calculator.rb', line 10 def initialize(well_details) @well_details = well_details end |
Instance Attribute Details
#config ⇒ Object (readonly) Originally defined in module CommonDilutionCalculations
Returns the value of attribute config.
Instance Method Details
#compute_presenter_bin_details ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'app/models/utility/pcr_cycles_binning_calculator.rb', line 32 def compute_presenter_bin_details @well_details.each_with_object({}) do |(well_locn, well_detail), bin_dets| presenter_bins_key.each do |bin| next unless well_detail['pcr_cycles'] == bin['pcr_cycles'] bin_dets[well_locn] = { 'colour' => bin['colour'], 'pcr_cycles' => bin['pcr_cycles'] } end end end |
#compute_vol_source_reqd(sample_conc) ⇒ float Originally defined in module CommonDilutionCalculations
Computes the volume of source material required for normalisation based on the sample concentration and attributes from the purpose configuration (target amount and volume, minimum source volume). Includes checks for minimum source volume and rounding for low diluent volumes due to liquid handler robot restrictions.
#compute_well_transfers(parent_plate) ⇒ Object
14 15 16 17 18 |
# File 'app/models/utility/pcr_cycles_binning_calculator.rb', line 14 def compute_well_transfers(parent_plate) bins_hash = pcr_cycle_bins compression_reqd = compression_required?(bins_hash, parent_plate.number_of_rows, parent_plate.number_of_columns) build_transfers_hash(bins_hash, parent_plate.number_of_rows, compression_reqd) end |
#construct_dest_qc_assay_attributes(child_uuid, transfer_hash) ⇒ array Originally defined in module CommonDilutionCalculations
Constructs the qc_assays collection details for use when writing calculated concentrations for the newly created child plate.
#extract_destination_concentrations(transfer_hash) ⇒ hash Originally defined in module CommonDilutionCalculations
Refactor the transfers hash to give destination concentrations
#normalisation_details(wells) ⇒ hash Originally defined in module CommonDilutionCalculations
Creates a hash of well normalisation details for a plate used when generating the well transfers and qc assays.
#presenter_bins_key ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/models/utility/pcr_cycles_binning_calculator.rb', line 20 def presenter_bins_key # fetch the array of bins as pcr cycles e.g. [16,14,12] bins = calculate_bins # dynamic number of bins so count the colours up from 1 colour_index = 1 bins.each_with_object([]) do |bin, templates| templates << { 'colour' => colour_index, 'pcr_cycles' => bin } colour_index += 1 end end |