public final class PhredTools extends Object
PhredTools contains static methods for working with phred quality data.
Copyright (c) 2001
Company: AgResearch
Constructor and Description |
---|
PhredTools() |
Modifier and Type | Method and Description |
---|---|
static SymbolList |
createPhred(SymbolList dna,
SymbolList quality)
Merges a Symbol List from the DNA alphabet with a SymbolList from the
[0..99] subset of the IntegerAlphabet into a SymbolList from
the PHRED alphabet.
|
static Symbol |
dnaSymbolFromPhred(Symbol phredSym)
Retrives the DNA symbol component of the Phred BasisSymbol from the
PHRED alphabet.
|
static FiniteAlphabet |
getPhredAlphabet()
Retrieves the PHRED alphabet from the AlphabetManager.
|
static Symbol |
getPhredSymbol(Symbol dna,
Symbol integer)
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).
|
static IntegerAlphabet.IntegerSymbol |
integerSymbolFromPhred(Symbol phredSym)
Retrives the IntegerSymbol component of the Phred BasisSymbol from the
PHRED alphabet.
|
static double |
pFromQuality(double quality)
Calculates the probability of an error from the quality score via the formula
P_e = 10**(QV/-10)
|
static double |
pFromQuality(int quality)
Calculates the probability of an error from the quality score via the formula
P_e = 10**(QV/-10)
|
static double |
pFromQuality(IntegerAlphabet.IntegerSymbol quality)
Calculates the probability of an error from the quality score via the formula
P_e = 10**(QV/-10)
|
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.
|
static Distribution[] |
phredToDistArray(PhredSequence s)
Converts a Phred sequence to an array of distributions.
|
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.
|
static StreamReader |
readPhredQuality(BufferedReader br)
Constructs a StreamReader to read in Phred quality data in FASTA format.
|
static StreamReader |
readPhredSequence(BufferedReader br)
Calls SeqIOTools.readFastaDNA(br), added here for convinience.
|
static void |
writePhredQuality(OutputStream qual,
OutputStream seq,
SequenceDB db)
Writes Phred quality data in a Fasta type format.
|
public PhredTools()
public static final FiniteAlphabet getPhredAlphabet()
getSymbols()
method of BasisSymbol.public static final Symbol dnaSymbolFromPhred(Symbol phredSym) throws IllegalSymbolException
IllegalSymbolException
- if the provided symbol is not from the
PHRED alphabet.public static final IntegerAlphabet.IntegerSymbol integerSymbolFromPhred(Symbol phredSym) throws IllegalSymbolException
IllegalSymbolException
- if the provided symbol is not from the
PHRED alphabet.public static SymbolList createPhred(SymbolList dna, SymbolList quality) throws IllegalArgumentException, IllegalAlphabetException, IllegalSymbolException
IllegalAlphabetException
- if the alphabets are not of the required alphabetsIllegalArgumentException
- if the two SymbolLists are not of equal length.IllegalSymbolException
- if a combination of Symbols cannot be represented by
the PHRED alphabet.public static final Symbol getPhredSymbol(Symbol dna, Symbol integer) throws IllegalSymbolException
IllegalSymbolException
- if there is no Symbol in the PHRED alphabet
that represents the two arguments.public static void writePhredQuality(OutputStream qual, OutputStream seq, SequenceDB db) throws IOException, BioException
db
- a bunch of PhredSequence objectsqual
- the OutputStream to write the quality data to.seq
- the OutputStream to write the sequence data to.IOException
BioException
public static StreamReader readPhredQuality(BufferedReader br)
public static StreamReader readPhredSequence(BufferedReader br)
public static double qualityFromP(double probOfError)
double
value, note that for most Phred scores this will be rounded
to the nearest int
public static double pFromQuality(double quality)
public static double pFromQuality(int quality)
public static double pFromQuality(IntegerAlphabet.IntegerSymbol quality)
public static Distribution[] phredToDistArray(PhredSequence s)
public static Distribution[] phredAlignmentToDistArray(Alignment a)
ClassCastException
- if the sequences in the alignment are not instances of PhredSequenceCopyright © 2014 BioJava. All rights reserved.