Class PhredTools


  • public final class PhredTools
    extends Object

    PhredTools contains static methods for working with phred quality data.

    Copyright (c) 2001

    Company: AgResearch

    Since:
    1.1 Note that Phred is a copyright of CodonCode Corporation.
    Author:
    Mark Schreiber, Matthew Pocock
    • Method Detail

      • getPhredAlphabet

        public static final FiniteAlphabet getPhredAlphabet()
        Retrieves the PHRED alphabet from the AlphabetManager. The Phred alphabet is a cross product of a subset of the IntegerAlphabet from 0...99 and the DNA alphabet. The Phred alphabet is finite. The Phred Alphabet contains 400 BasisSymbols named, for example, (guanine 47). The BasisSymbols can be fragmented into their component AtomicSymbols using the getSymbols() method of BasisSymbol.
      • getPhredSymbol

        public static final Symbol getPhredSymbol​(Symbol dna,
                                                  Symbol integer)
                                           throws IllegalSymbolException
        Creates a symbol from the PHRED alphabet by combining a Symbol from the DNA alphabet and a Symbol from the IntegerAlphabet (or one of its subsets).
        Throws:
        IllegalSymbolException - if there is no Symbol in the PHRED alphabet that represents the two arguments.
      • readPhredQuality

        public static StreamReader readPhredQuality​(BufferedReader br)
        Constructs a StreamReader to read in Phred quality data in FASTA format. The data is converted into sequences consisting of Symbols from the IntegerAlphabet.
      • qualityFromP

        public static double qualityFromP​(double probOfError)
        The quality value is related to the base call error probability by the formula QV = - 10 * log_10( P_e ) where P_e is the probability that the base call is an error.
        Returns:
        a double value, note that for most Phred scores this will be rounded to the nearest int
      • pFromQuality

        public static double pFromQuality​(double quality)
        Calculates the probability of an error from the quality score via the formula P_e = 10**(QV/-10)
      • pFromQuality

        public static double pFromQuality​(int quality)
        Calculates the probability of an error from the quality score via the formula P_e = 10**(QV/-10)
      • phredToDistArray

        public static Distribution[] phredToDistArray​(PhredSequence s)
        Converts a Phred sequence to an array of distributions. Essentially a fuzzy sequence Assumes that all of the non called bases are equiprobable
      • phredAlignmentToDistArray

        public static Distribution[] phredAlignmentToDistArray​(Alignment a)
        converts an Alignment of PhredSequences to a Distribution[] where each position is the average distribution of the underlying column of the alignment.
        Throws:
        ClassCastException - if the sequences in the alignment are not instances of PhredSequence