module Bio::Sequence::QualityScore::Converter

Converter methods between PHRED and Solexa quality scores.

Public Instance Methods

convert_nothing(scores) click to toggle source

Does nothing and simply returns the given argument.


Arguments:

  • (required) scores: (Array containing Integer) quality scores

Returns

(Array containing Integer) quality scores

# File lib/bio/sequence/quality_score.rb, line 72
def convert_nothing(scores)
  scores
end
convert_scores_from_phred_to_solexa(scores) click to toggle source

Converts PHRED scores to Solexa scores.

The values may be truncated or incorrect if overflows/underflows occurred during the calculation.


Arguments:

  • (required) scores: (Array containing Integer) quality scores

Returns

(Array containing Integer) quality scores

# File lib/bio/sequence/quality_score.rb, line 40
def convert_scores_from_phred_to_solexa(scores)
  sc = scores.collect do |q|
    t = 10 ** (q / 10.0) - 1
    t = Float::MIN if t < Float::MIN
    r = 10 * Math.log10(t)
    r.finite? ? r.round : r
  end
  sc
end
convert_scores_from_solexa_to_phred(scores) click to toggle source

Converts Solexa scores to PHRED scores.

The values may be truncated if overflows/underflows occurred during the calculation.


Arguments:

  • (required) scores: (Array containing Integer) quality scores

Returns

(Array containing Integer) quality scores

# File lib/bio/sequence/quality_score.rb, line 58
def convert_scores_from_solexa_to_phred(scores)
  sc = scores.collect do |q|
    r = 10 * Math.log10(10 ** (q / 10.0) + 1)
    r.finite? ? r.round : r
  end
  sc
end