module Bio::BioAlignment::PhylipOutput

Public Class Methods

header(alignment) click to toggle source

Calculate header info from alignment and return as string

# 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) click to toggle source

Output sequence PAML style and return as a multi-line string

# 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