module Bio::Sequence::QualityScore::Solexa

Bio::Sequence::QualityScore::Solexa is a module having quality calculation methods for the Solexa quality score.

BioRuby internal use only (mainly from Bio::Fastq).

Public Class Methods

p2q(probabilities)
Alias for: solexa_p2q
q2p(scores)
Alias for: solexa_q2p

Public Instance Methods

p2q(probabilities)
Alias for: solexa_p2q
q2p(scores)
Alias for: solexa_q2p
quality_score_type() click to toggle source

Type of quality scores.


Returns

(Symbol) the type of quality score.

# File lib/bio/sequence/quality_score.rb, line 152
def quality_score_type
  :solexa
end
solexa_p2q(probabilities) click to toggle source

Probability to Solexa score conversion.


Arguments:

  • (required) probabilities: (Array containing Float) probabilities

Returns

(Array containing Float) scores

# File lib/bio/sequence/quality_score.rb, line 182
def solexa_p2q(probabilities)
  probabilities.collect do |p|
    t = p / (1.0 - p)
    t = Float::MIN if t < Float::MIN
    q = -10 * Math.log10(t)
    q.finite? ? q.round : q
  end
end
Also aliased as: p2q
solexa_q2p(scores) click to toggle source

Solexa score to probability conversion.


Arguments:

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

Returns

(Array containing Float) probabilities

# File lib/bio/sequence/quality_score.rb, line 161
def solexa_q2p(scores)
  scores.collect do |q|
    t = 10 ** (- q / 10.0)
    t /= (1.0 + t)
    if t > 1.0 then
      t = 1.0
    #elsif t < 0.0 then
    #  t = 0.0
    end
    t
  end
end
Also aliased as: q2p