Class | Bio::Sequence::Format::Formatter::Fasta_ncbi |
In: |
lib/bio/db/fasta/format_fasta.rb
|
Parent: | Bio::Sequence::Format::FormatterBase |
INTERNAL USE ONLY, YOU SHOULD NOT USE THIS CLASS. NCBI-Style Fasta format output class for Bio::Sequence. (like "ncbi" format in EMBOSS)
Note that this class is under construction.
INTERNAL USE ONLY, YOU SHOULD NOT CALL THIS METHOD.
Output the FASTA format string of the sequence.
Currently, this method is used in Bio::Sequence#output like so,
s = Bio::Sequence.new('atgc') puts s.output(:ncbi) #=> "> \natgc\n"
Returns: | String object |
# File lib/bio/db/fasta/format_fasta.rb, line 77 77: def output 78: width = 70 79: seq = @sequence.seq 80: #gi = @sequence.gi_number 81: dbname = 'lcl' 82: if @sequence.primary_accession.to_s.empty? then 83: idstr = @sequence.entry_id 84: else 85: idstr = "#{@sequence.primary_accession}.#{@sequence.sequence_version}" 86: end 87: 88: definition = @sequence.definition 89: header = "#{dbname}|#{idstr} #{definition}" 90: 91: ">#{header}\n" + seq.to_s.gsub(Regexp.new(".{1,#{width}}"), "\\0\n") 92: end