Module | Bio::Sequence::Format |
In: |
lib/bio/sequence/format.rb
|
Returns a list of available output formats for the sequence
Arguments:
Returns: | Array of Symbols |
# File lib/bio/sequence/format.rb, line 173 173: def list_output_formats 174: a = get_formatter_repositories.collect { |mod| mod.constants } 175: a.flatten! 176: a.collect! { |x| x.to_s.downcase.intern } 177: a 178: end
Using Bio::Sequence::Format, return a String with the Bio::Sequence object formatted in the given style.
Formats currently implemented are: ‘fasta’, ‘genbank’, and ‘embl‘
s = Bio::Sequence.new('atgc') puts s.output(:fasta) #=> "> \natgc\n"
The style argument is given as a Ruby Symbol(www.ruby-doc.org/core/classes/Symbol.html)
Arguments:
Returns: | String object |
# File lib/bio/sequence/format.rb, line 151 151: def output(format = :fasta, options = {}) 152: formatter_const = format.to_s.capitalize.intern 153: 154: formatter_class = nil 155: get_formatter_repositories.each do |mod| 156: begin 157: formatter_class = mod.const_get(formatter_const) 158: rescue NameError 159: end 160: break if formatter_class 161: end 162: unless formatter_class then 163: raise "unknown format name #{format.inspect}" 164: end 165: 166: formatter_class.output(self, options) 167: end
The same as output(:fasta, :header=>definition, :width=>width) This method is intended to replace Bio::Sequence#to_fasta.
s = Bio::Sequence.new('atgc') puts s.output_fasta #=> "> \natgc\n"
Arguments:
Returns: | String object |
# File lib/bio/sequence/format.rb, line 190 190: def output_fasta(definition = nil, width = 70) 191: output(:fasta, :header=> definition, :width => width) 192: end