Class: Bioinform::ConsensusFormatter
- Inherits:
-
Object
- Object
- Bioinform::ConsensusFormatter
- Defined in:
- lib/bioinform/formatters/consensus_formatter.rb
Class Method Summary collapse
-
.by_maximal_elements ⇒ Object
Simplest consensus formatter which takes into account only maximal elements.
Instance Method Summary collapse
- #format_string(pm) ⇒ Object
-
#initialize(&block) ⇒ ConsensusFormatter
constructor
ConsensusFormatter.new{|pos, el, nucleotide_index| el == pos.max }.
Constructor Details
#initialize(&block) ⇒ ConsensusFormatter
ConsensusFormatter.new{|pos, el, nucleotide_index| el == pos.max }
7 8 9 10 |
# File 'lib/bioinform/formatters/consensus_formatter.rb', line 7 def initialize(&block) raise Error, 'block is necessary to create an instance of ConsensusFormatter' unless block_given? @block = block end |
Class Method Details
.by_maximal_elements ⇒ Object
Simplest consensus formatter which takes into account only maximal elements
13 14 15 |
# File 'lib/bioinform/formatters/consensus_formatter.rb', line 13 def self.by_maximal_elements self.new{|pos, el, nucleotide_index| el == pos.max } end |
Instance Method Details
#format_string(pm) ⇒ Object
18 19 20 |
# File 'lib/bioinform/formatters/consensus_formatter.rb', line 18 def format_string(pm) pm.each_position.map{|pos| iupac_letter_by_position(pos) }.join end |