Class: Bio::Alignment::MultiFastaFormat
- Defined in:
- lib/bio/appl/mafft/report.rb
Overview
Data class for fasta-formatted multiple sequence alignment data, which is simply multiple entiries of fasta formatted sequences.
Direct Known Subclasses
Constant Summary collapse
- DELIMITER =
delimiter for flatfile
RS = nil
Instance Method Summary collapse
-
#alignment(method = nil) ⇒ Object
Gets an multiple alignment.
-
#entries ⇒ Object
Gets an array of the fasta formatted sequence objects.
-
#initialize(str) ⇒ MultiFastaFormat
constructor
Creates a new data object.
Constructor Details
#initialize(str) ⇒ MultiFastaFormat
Creates a new data object. str
should be a (multi-)fasta formatted string.
46 47 48 49 50 51 |
# File 'lib/bio/appl/mafft/report.rb', line 46 def initialize(str) ff = Bio::FlatFile.new(Bio::FastaFormat, StringIO.new(str)) @data = ff.to_a @alignment = nil @seq_method = nil end |
Instance Method Details
#alignment(method = nil) ⇒ Object
Gets an multiple alignment. Returns a Bio::Alignment object. method
should be one of :naseq, :aaseq, :seq, or nil (default). nil means to automatically determine nucleotide or amino acid.
This method returns previously parsed object if the same method is given (or guessed method is the same).
60 61 62 63 64 65 66 67 |
# File 'lib/bio/appl/mafft/report.rb', line 60 def alignment(method = nil) m = determine_seq_method(@data, method) if !@alignment or m != @seq_method then @seq_method = m @alignment = do_parse(@data, @seq_method) end @alignment end |
#entries ⇒ Object
Gets an array of the fasta formatted sequence objects. Returns an array of Bio::FastaFormat objects.
71 72 73 |
# File 'lib/bio/appl/mafft/report.rb', line 71 def entries @data end |