Bio::Fastq::FormatData is a data class to store Fastq format parameters and quality calculation methods. Bio::Fastq internal use only.
Format name. Should be redefined in subclass.
Offset. Should be redefined in subclass.
Range of score. Should be redefined in subclass. The range must not exclude end value, i.e. it must be X..Y, and must not be X…Y.
Converts scores to a string. Overflow/underflow checks will be performed. If a block is given, when overflow/underflow detected, the score value is passed to the block, and uses returned value as the score. If no blocks, silently truncated.
Arguments:
(required) a: (Array containing Integer) score values
Returns |
(String) quality string |
# File lib/bio/db/fastq.rb, line 98 def scores2str(a) if block_given? then tmp = a.collect do |i| i = yield(i) unless @score_range.include?(i) i + @offset end else min = @score_range.begin max = @score_range.end tmp = a.collect do |i| if i < min then i = min elsif i > max then i = max end i + @offset end end tmp.pack('C*') end
Converts quality string to scores. No overflow/underflow checks will be performed.
Arguments:
(required) c: (String) quality string
Returns |
(Array containing Integer) score values |
# File lib/bio/db/fastq.rb, line 82 def str2scores(str) a = str.unpack('C*') a.collect! { |i| i - @offset } a end
Generated with the Darkfish Rdoc Generator 2.