Class: Status
- Inherits:
-
Object
- Object
- Status
- Defined in:
- lib/status.rb
Overview
Class containing methods to records demultiplexing status.
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#index1_bad_mean ⇒ Object
Returns the value of attribute index1_bad_mean.
-
#index1_bad_min ⇒ Object
Returns the value of attribute index1_bad_min.
-
#index2_bad_mean ⇒ Object
Returns the value of attribute index2_bad_mean.
-
#index2_bad_min ⇒ Object
Returns the value of attribute index2_bad_min.
-
#match ⇒ Object
Returns the value of attribute match.
-
#undetermined ⇒ Object
Returns the value of attribute undetermined.
Instance Method Summary collapse
-
#initialize(samples) ⇒ Status
constructor
Internal: Constructor method to initialize a Status object, which contains the following instance variables initialized to 0:.
-
#save(file) ⇒ Object
Internal: Method to save stats to the log file ‘Demultiplex.log’ in the output directory.
-
#to_s ⇒ Object
Internal: Method to format a String from a Status object.
Constructor Details
#initialize(samples) ⇒ Status
Internal: Constructor method to initialize a Status object, which contains the following instance variables initialized to 0:
@count - Number or reads.
@match - Number of reads found in index.
@undetermined - Number of reads not found in index.
@index1_bad_mean - Number of reads dropped due to bad mean in index1.
@index2_bad_mean - Number of reads dropped due to bad mean in index2.
@index1_bad_min - Number of reads dropped due to bad min in index1.
@index2_bad_min - Number of reads dropped due to bad min in index2.
samples - Array of Sample objects.
Examples
Status.new(samples)
# => <Status>
Returns a Status object.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/status.rb', line 47 def initialize(samples) @samples = samples @count = 0 @match = 0 @undetermined = 0 @index1_bad_mean = 0 @index2_bad_mean = 0 @index1_bad_min = 0 @index2_bad_min = 0 @time_start = Time.now end |
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count.
26 27 28 |
# File 'lib/status.rb', line 26 def count @count end |
#index1_bad_mean ⇒ Object
Returns the value of attribute index1_bad_mean.
26 27 28 |
# File 'lib/status.rb', line 26 def index1_bad_mean @index1_bad_mean end |
#index1_bad_min ⇒ Object
Returns the value of attribute index1_bad_min.
26 27 28 |
# File 'lib/status.rb', line 26 def index1_bad_min @index1_bad_min end |
#index2_bad_mean ⇒ Object
Returns the value of attribute index2_bad_mean.
26 27 28 |
# File 'lib/status.rb', line 26 def index2_bad_mean @index2_bad_mean end |
#index2_bad_min ⇒ Object
Returns the value of attribute index2_bad_min.
26 27 28 |
# File 'lib/status.rb', line 26 def index2_bad_min @index2_bad_min end |
#match ⇒ Object
Returns the value of attribute match.
26 27 28 |
# File 'lib/status.rb', line 26 def match @match end |
#undetermined ⇒ Object
Returns the value of attribute undetermined.
26 27 28 |
# File 'lib/status.rb', line 26 def undetermined @undetermined end |
Instance Method Details
#save(file) ⇒ Object
Internal: Method to save stats to the log file ‘Demultiplex.log’ in the output directory.
Returns nothing.
83 84 85 86 87 |
# File 'lib/status.rb', line 83 def save(file) File.open(file, 'w') do |ios| ios.puts self end end |
#to_s ⇒ Object
Internal: Method to format a String from a Status object. This is done by adding the relevant instance variables to a Hash and return this as an YAML String.
Returns a YAML String.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/status.rb', line 64 def to_s { count: @count, match: @match, undetermined: @undetermined, undetermined_percent: undetermined_percent, index1_bad_mean: @index1_bad_mean, index2_bad_mean: @index2_bad_mean, index1_bad_min: @index1_bad_min, index2_bad_min: @index2_bad_min, sample_ids: @samples.map(&:id), index1: uniq_index1, index2: uniq_index2, time_elapsed: time_elapsed }.to_yaml end |