Class: Match::Otu::MergeResults
- Inherits:
-
Object
- Object
- Match::Otu::MergeResults
- Defined in:
- lib/match/otu/merge_results.rb
Instance Attribute Summary collapse
-
#otu_results ⇒ Object
readonly
Returns the value of attribute otu_results.
-
#tn_results ⇒ Object
readonly
Returns the value of attribute tn_results.
Instance Method Summary collapse
- #call ⇒ Array<Hash>
-
#initialize(tn_results:, otu_results:) ⇒ MergeResults
constructor
A new instance of MergeResults.
Constructor Details
#initialize(tn_results:, otu_results:) ⇒ MergeResults
Returns a new instance of MergeResults.
19 20 21 22 |
# File 'lib/match/otu/merge_results.rb', line 19 def initialize(tn_results:, otu_results:) @tn_results = tn_results @otu_results = otu_results end |
Instance Attribute Details
#otu_results ⇒ Object (readonly)
Returns the value of attribute otu_results.
14 15 16 |
# File 'lib/match/otu/merge_results.rb', line 14 def otu_results @otu_results end |
#tn_results ⇒ Object (readonly)
Returns the value of attribute tn_results.
14 15 16 |
# File 'lib/match/otu/merge_results.rb', line 14 def tn_results @tn_results end |
Instance Method Details
#call ⇒ Array<Hash>
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/match/otu/merge_results.rb', line 25 def call tn_results.zip(otu_results).map do |tn, otu| if tn[:matched] if otu[:matched] tn.merge(match_source: 'both', ambiguous: true) else tn.merge(match_source: 'taxon_name') end elsif otu[:matched] otu.merge(scientific_name: tn[:scientific_name], match_source: 'otu') else tn.merge(match_source: nil) end end end |