Class: Utility::DilutionsConfig
- Inherits:
-
Object
- Object
- Utility::DilutionsConfig
- Includes:
- ActiveModel::Model
- Defined in:
- app/models/utility/dilutions_config.rb
Overview
Handles the extraction of dilution configuration functions. Used by various dilution plate creators and their dilution calculators.
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#bin_max(bin_template) ⇒ Object
Returns the bin maximum amount (ng) for a specific bin.
-
#bin_min(bin_template) ⇒ Object
Returns the bin minimum amount (ng) for a specific bin.
-
#bins_template ⇒ Object
Returns the bins from the config yml.
-
#dest_multiplication_factor ⇒ Object
Returns the multiplication factor for the destination (child) plate.
-
#diluent_volume ⇒ Object
Returns diluent volume from the config yml.
-
#initialize(config) ⇒ DilutionsConfig
constructor
A new instance of DilutionsConfig.
-
#library_type ⇒ Object
Returns library type from the config yml.
-
#minimum_source_volume ⇒ Object
Returns minimum source volume from the config yml.
-
#number_decimal_places ⇒ Object
This precision number could be extracted from config yml in future if needed.
-
#number_of_bins ⇒ Object
Returns number of distinct bins in the config yml.
-
#source_multiplication_factor ⇒ Object
Returns the multiplication factor for the source (parent) plate.
-
#source_volume ⇒ Object
Returns source volume from the config yml.
-
#target_amount ⇒ Object
Returns target amount in ng from the config yml.
-
#target_volume ⇒ Object
Returns target volume from the config yml.
Constructor Details
#initialize(config) ⇒ DilutionsConfig
Returns a new instance of DilutionsConfig.
11 12 13 |
# File 'app/models/utility/dilutions_config.rb', line 11 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
9 10 11 |
# File 'app/models/utility/dilutions_config.rb', line 9 def config @config end |
Instance Method Details
#bin_max(bin_template) ⇒ Object
Returns the bin maximum amount (ng) for a specific bin
76 77 78 |
# File 'app/models/utility/dilutions_config.rb', line 76 def bin_max(bin_template) (bin_template['max'] || Float::INFINITY).to_f end |
#bin_min(bin_template) ⇒ Object
Returns the bin minimum amount (ng) for a specific bin
71 72 73 |
# File 'app/models/utility/dilutions_config.rb', line 71 def bin_min(bin_template) (bin_template['min'] || 0.0).to_f end |
#bins_template ⇒ Object
Returns the bins from the config yml
66 67 68 |
# File 'app/models/utility/dilutions_config.rb', line 66 def bins_template @bins_template ||= configure_bins_template end |
#dest_multiplication_factor ⇒ Object
Returns the multiplication factor for the destination (child) plate
56 57 58 |
# File 'app/models/utility/dilutions_config.rb', line 56 def dest_multiplication_factor source_volume + diluent_volume end |
#diluent_volume ⇒ Object
Returns diluent volume from the config yml
31 32 33 |
# File 'app/models/utility/dilutions_config.rb', line 31 def diluent_volume @config['diluent_volume'].to_f end |
#library_type ⇒ Object
Returns library type from the config yml
21 22 23 |
# File 'app/models/utility/dilutions_config.rb', line 21 def library_type @config['library_type'] end |
#minimum_source_volume ⇒ Object
Returns minimum source volume from the config yml
46 47 48 |
# File 'app/models/utility/dilutions_config.rb', line 46 def minimum_source_volume @config['minimum_source_volume'].to_f end |
#number_decimal_places ⇒ Object
This precision number could be extracted from config yml in future if needed.
16 17 18 |
# File 'app/models/utility/dilutions_config.rb', line 16 def number_decimal_places 3 end |
#number_of_bins ⇒ Object
Returns number of distinct bins in the config yml
61 62 63 |
# File 'app/models/utility/dilutions_config.rb', line 61 def number_of_bins @config['bins'].size end |
#source_multiplication_factor ⇒ Object
Returns the multiplication factor for the source (parent) plate
51 52 53 |
# File 'app/models/utility/dilutions_config.rb', line 51 def source_multiplication_factor source_volume end |
#source_volume ⇒ Object
Returns source volume from the config yml
26 27 28 |
# File 'app/models/utility/dilutions_config.rb', line 26 def source_volume @config['source_volume'].to_f end |
#target_amount ⇒ Object
Returns target amount in ng from the config yml
36 37 38 |
# File 'app/models/utility/dilutions_config.rb', line 36 def target_amount @config['target_amount_ng'].to_f end |
#target_volume ⇒ Object
Returns target volume from the config yml
41 42 43 |
# File 'app/models/utility/dilutions_config.rb', line 41 def target_volume @config['target_volume'].to_f end |