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
152 def quality_score_type
153   :solexa
154 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
182 def solexa_p2q(probabilities)
183   probabilities.collect do |p|
184     t = p / (1.0 - p)
185     t = Float::MIN if t < Float::MIN
186     q = -10 * Math.log10(t)
187     q.finite? ? q.round : q
188   end
189 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
161 def solexa_q2p(scores)
162   scores.collect do |q|
163     t = 10 ** (- q / 10.0)
164     t /= (1.0 + t)
165     if t > 1.0 then
166       t = 1.0
167     #elsif t < 0.0 then
168     #  t = 0.0
169     end
170     t
171   end
172 end
Also aliased as: q2p