Module | Bio::Sequence::QualityScore::Phred
In: | lib/bio/sequence/quality_score.rb

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

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

### Methods

p2q phred_p2q phred_q2p q2p quality_score_type

### Included Modules

Converter

### External Aliases

convert_nothing | -> | convert_scores_from_phred
convert_nothing | -> | convert_scores_to_phred
convert_scores_from_solexa_to_phred | -> | convert_scores_from_solexa
convert_scores_from_phred_to_solexa | -> | convert_scores_to_solexa

### Public Instance methods

p2q(probabilities)

Alias for phred_p2q

phred_p2q(probabilities)

Probability to PHRED score conversion.

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

Arguments:

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

Returns: | (Array containing Float) scores

[Source]

         # File lib/bio/sequence/quality_score.rb, line 119
    119:       def phred_p2q(probabilities)
    120:         probabilities.collect do |p|
    121:           p = Float::MIN if p < Float::MIN
    122:           q = -10 * Math.log10(p)
    123:           q.finite? ? q.round : q
    124:         end
    125:       end

phred_q2p(scores)

PHRED score to probability conversion.

Arguments:

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

Returns: | (Array containing Float) probabilities (0<=p<=1)

[Source]

         # File lib/bio/sequence/quality_score.rb, line 96
     96:       def phred_q2p(scores)
     97:         scores.collect do |q|
     98:           r = 10 ** (- q / 10.0)
     99:           if r > 1.0 then
    100:             r = 1.0
    101:           #elsif r < 0.0 then
    102:           #  r = 0.0
    103:           end
    104:           r
    105:         end
    106:       end

q2p(scores)

Alias for phred_q2p

quality_score_type()

Type of quality scores.

Returns: | (Symbol) the type of quality score.

[Source]

        # File lib/bio/sequence/quality_score.rb, line 87
    87:       def quality_score_type
    88:         :phred
    89:       end

[Validate]