Class: Utility::DilutionsConfig

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#configObject (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_templateObject

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_factorObject

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_volumeObject

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_typeObject

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_volumeObject

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_placesObject

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_binsObject

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_factorObject

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_volumeObject

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_amountObject

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_volumeObject

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