Module: Bio::BioAlignment::PhylipOutput
- Defined in:
- lib/bio-alignment/format/phylip.rb
Class Method Summary collapse
-
.header(alignment) ⇒ Object
Calculate header info from alignment and return as string.
-
.to_paml(seq, size = 60) ⇒ Object
Output sequence PAML style and return as a multi-line string.
Class Method Details
.header(alignment) ⇒ Object
Calculate header info from alignment and return as string
5 6 7 |
# File 'lib/bio-alignment/format/phylip.rb', line 5 def PhylipOutput::header alignment "#{alignment.size} #{alignment[0].length}\n" end |
.to_paml(seq, size = 60) ⇒ Object
Output sequence PAML style and return as a multi-line string
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/bio-alignment/format/phylip.rb', line 10 def PhylipOutput::to_paml seq, size=60 buf = seq.id+"\n" coding = if seq.kind_of?(CodonSequence) seq.to_nt else seq.to_s end coding.scan(/.{1,#{size}}/).each do | section | buf += section + "\n" end buf end |