Bio::Sequence::QualityScore::Phred is a module having quality calculation methods for the PHRED quality score.
BioRuby internal use only (mainly from Bio::Fastq).
Probability to PHRED score conversion.
The values may be truncated or incorrect if overflows/underflows occurred during the calculation.
(required) probabilities: (Array containing Float) probabilities
(Array containing Float) scores
# File lib/bio/sequence/quality_score.rb, line 121 def phred_p2q(probabilities) probabilities.collect do |p| p = Float::MIN if p < Float::MIN q = -10 * Math.log10(p) q.finite? ? q.round : q end end
PHRED score to probability conversion.
(required) scores: (Array containing Integer) scores
(Array containing Float) probabilities (0<=p<=1)
# File lib/bio/sequence/quality_score.rb, line 98 def phred_q2p(scores) scores.collect do |q| r = 10 ** (- q / 10.0) if r > 1.0 then r = 1.0 #elsif r < 0.0 then # r = 0.0 end r end end
Type of quality scores.
(Symbol) the type of quality score.
# File lib/bio/sequence/quality_score.rb, line 89 def quality_score_type :phred end