This is phylip multiple alignment format parser. The two formats, interleaved and non-interleaved, are automatically determined.
create a new object from a string
# File lib/bio/appl/phylip/alignment.rb, line 26 def initialize(str) @data = str.strip.split(/(?:\r\n|\r|\n)/) @first_line = @data.shift @number_of_sequences, @alignment_length = @first_line.to_s.strip.split(/\s+/).collect { |x| x.to_i } end
Gets the alignment. Returns a Bio::Alignment object.
# File lib/bio/appl/phylip/alignment.rb, line 54 def alignment unless defined? @alignment then do_parse a = Bio::Alignment.new (0...@number_of_sequences).each do |i| a.add_seq(@sequences[i], @sequence_names[i]) end @alignment = a end @alignment end
If the alignment format is "interleaved", returns true. If not, returns false. It would mistake to determine if the alignment is very short.
# File lib/bio/appl/phylip/alignment.rb, line 42 def interleaved? unless defined? @interleaved_flag then if /\A +/ =~ @data[1].to_s then @interleaved_flag = false else @interleaved_flag = true end end @interleaved_flag end
Generated with the Darkfish Rdoc Generator 2.