class Bio::Sequence::Format::Formatter::Fasta_numeric
INTERNAL USE ONLY, YOU SHOULD NOT USE THIS CLASS. Simple FastaNumeric format output class for Bio::Sequence
.
Public Class Methods
new()
click to toggle source
INTERNAL USE ONLY, YOU SHOULD NOT CALL THIS METHOD.
Creates a new FastaNumericFormat
generater object from the sequence.
It does not care whether the content of the quality score is consistent with the sequence or not, e.g. it does not check length of the quality score.
Arguments:
-
sequence:
Bio::Sequence
object -
(optional) :header => header: (String) (default nil)
-
(optional) :width => width: (Fixnum) (default 70)
# File lib/bio/db/fasta/format_qual.rb 28 def initialize; end
Public Instance Methods
output()
click to toggle source
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') s.quality_scores = [ 70, 80, 90, 100 ] puts s.output(:fasta_numeric)
- Returns
-
String object
# File lib/bio/db/fasta/format_qual.rb 41 def output 42 header = @options[:header] 43 width = @options.has_key?(:width) ? @options[:width] : 70 44 seq = @sequence.seq.to_s 45 entry_id = @sequence.entry_id || 46 "#{@sequence.primary_accession}.#{@sequence.sequence_version}" 47 definition = @sequence.definition 48 header ||= "#{entry_id} #{definition}" 49 50 sc = fastanumeric_quality_scores(seq) 51 if width then 52 if width <= 0 then 53 main = sc.join("\n") 54 else 55 len = 0 56 main = sc.collect do |x| 57 str = (len == 0) ? "#{x}" : " #{x}" 58 len += str.size 59 if len > width then 60 len = "#{x}".size 61 str = "\n#{x}" 62 end 63 str 64 end.join('') 65 end 66 else 67 main = sc.join(' ') 68 end 69 70 ">#{header}\n#{main}\n" 71 end