public final class QualityUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static double |
LOG_PROB_TO_PHRED_MULTIPLIER |
static int |
MAPPING_QUALITY_UNAVAILABLE |
static int |
MAX_QUAL
Maximum sense quality value.
|
static byte |
MAX_REASONABLE_Q_SCORE
bams containing quals above this value are extremely suspicious and we should warn the user
|
static byte |
MAX_SAM_QUAL_SCORE
Maximum quality score that can be encoded in a SAM/BAM file
|
protected static double |
MIN_PHRED_SCALED_QUAL |
static byte |
MIN_USABLE_Q_SCORE
The lowest quality score for a base that is considered reasonable for statistical analysis.
|
static double |
PHRED_TO_LOG_PROB_MULTIPLIER
conversion factor from phred scaled quality to log error probability and vice versa
|
Modifier and Type | Method and Description |
---|---|
static byte |
boundQual(int qual)
Return a quality score that bounds qual by MAX_SAM_QUAL_SCORE and 1
|
static byte |
boundQual(int qual,
byte maxQual)
Return a quality score that bounds qual by maxQual and 1
WARNING -- because this function takes a byte for maxQual, you must be careful in converting
integers to byte.
|
static byte |
errorProbToQual(double errorRate)
Convert a probability of being wrong to a phred-scaled quality score (0.01 => 20).
|
static byte |
errorProbToQual(double errorRate,
byte maxQual)
Convert a probability of being wrong to a phred-scaled quality score (0.01 => 20).
|
static byte |
errorProbToQual(double prob,
int maxQual) |
static double |
logProbToPhred(double prob)
Convert a log-probability to a phred-scaled value ( log(0.001) => 30 )
|
static double |
phredScaleCorrectRate(double trueRate)
Convert a probability of being right to a phred-scaled quality score of being wrong as a double
This is a very generic method, that simply computes a phred-scaled double quality
score given an error rate.
|
static double |
phredScaleErrorRate(double errorRate)
Convert a probability of being wrong to a phred-scaled quality score as a double
This is a very generic method, that simply computes a phred-scaled double quality
score given an error rate.
|
static double |
phredScaleLog10CorrectRate(double trueRateLog10)
Convert a log10 probability of being right to a phred-scaled quality score of being wrong as a double
This is a very generic method, that simply computes a phred-scaled double quality
score given an error rate.
|
static double |
phredScaleLog10ErrorRate(double errorRateLog10)
Convert a log10 probability of being wrong to a phred-scaled quality score as a double
This is a very generic method, that simply computes a phred-scaled double quality
score given an error rate.
|
static double |
phredSum(double[] phreds)
Calculate the sum of phred scores.
|
static double |
phredSum(double a,
double b)
Calculate the sum of two phred scores.
|
static double |
phredSum(double a,
double b,
double c)
Calculate the sum of three phred scores.
|
static double |
qualToErrorProb(byte qual)
v
Convert a phred-scaled quality score to its probability of being wrong (Q30 => 0.001)
This is the Phred-style conversion, *not* the Illumina-style conversion.
|
static double |
qualToErrorProb(double qual)
Convert a phred-scaled quality score to its probability of being wrong (Q30 => 0.001)
This is the Phred-style conversion, *not* the Illumina-style conversion.
|
static double |
qualToErrorProbLog10(byte qual)
Convert a phred-scaled quality score to its log10 probability of being wrong (Q30 => log10(0.001))
This is the Phred-style conversion, *not* the Illumina-style conversion.
|
static double |
qualToErrorProbLog10(double qual)
Convert a phred-scaled quality score to its log10 probability of being wrong (Q30 => log10(0.001))
This is the Phred-style conversion, *not* the Illumina-style conversion.
|
static double |
qualToProb(byte qual)
Convert a phred-scaled quality score to its probability of being true (Q30 => 0.999)
This is the Phred-style conversion, *not* the Illumina-style conversion.
|
static double |
qualToProb(double qual)
Convert a phred-scaled quality score to its probability of being true (Q30 => 0.999)
This is the Phred-style conversion, *not* the Illumina-style conversion.
|
static double |
qualToProbLog10(byte qual)
Convert a phred-scaled quality score to its log10 probability of being true (Q30 => log10(0.999))
This is the Phred-style conversion, *not* the Illumina-style conversion.
|
static byte |
trueProbToQual(double prob)
Convert a probability of being right to a phred-scaled quality score (0.99 => 20).
|
static byte |
trueProbToQual(double trueProb,
byte maxQual)
Convert a probability of being right to a phred-scaled quality score (0.99 => 20).
|
static byte |
trueProbToQual(double prob,
int maxQual) |
public static final byte MAX_SAM_QUAL_SCORE
public static final double PHRED_TO_LOG_PROB_MULTIPLIER
public static final double LOG_PROB_TO_PHRED_MULTIPLIER
protected static final double MIN_PHRED_SCALED_QUAL
public static final byte MAX_REASONABLE_Q_SCORE
public static final byte MIN_USABLE_Q_SCORE
public static final int MAPPING_QUALITY_UNAVAILABLE
public static final int MAX_QUAL
public static double qualToProb(byte qual)
qual
- a quality score (0-255)public static double qualToProb(double qual)
qual
- a phred-scaled quality score encoded as a double. Can be non-integer values (30.5)public static double qualToProbLog10(byte qual)
qual
- a phred-scaled quality score encoded as a double. Can be non-integer values (30.5)public static double logProbToPhred(double prob)
prob
- a log-probabilityMAX_QUAL
public static double qualToErrorProb(double qual)
qual
- a phred-scaled quality score encoded as a double. Can be non-integer values (30.5)public static double qualToErrorProb(byte qual)
qual
- a phred-scaled quality score encoded as a bytepublic static double qualToErrorProbLog10(byte qual)
qual
- a phred-scaled quality score encoded as a bytepublic static double qualToErrorProbLog10(double qual)
qual
- a phred-scaled quality score encoded as a doublepublic static byte errorProbToQual(double errorRate)
errorRate
- a probability (0.0-1.0) of being wrong (i.e., 0.01 is 1% change of being wrong)public static byte errorProbToQual(double errorRate, byte maxQual)
errorRate
- a probability (0.0-1.0) of being wrong (i.e., 0.01 is 1% change of being wrong)public static byte errorProbToQual(double prob, int maxQual)
public static byte trueProbToQual(double prob)
prob
- a probability (0.0-1.0) of being rightpublic static byte trueProbToQual(double trueProb, byte maxQual)
trueProb
- a probability (0.0-1.0) of being rightmaxQual
- the maximum quality score we are allowed to emit here, regardless of the error ratepublic static byte trueProbToQual(double prob, int maxQual)
public static double phredScaleCorrectRate(double trueRate)
trueRate
- the probability of being right (0.0-1.0)public static double phredScaleErrorRate(double errorRate)
errorRate
- the probability of being wrong (0.0-1.0)public static double phredScaleLog10ErrorRate(double errorRateLog10)
errorRateLog10
- the log10 probability of being wrong (0.0-1.0). Can be -Infinity, in which case
the result is MIN_PHRED_SCALED_QUALpublic static double phredScaleLog10CorrectRate(double trueRateLog10)
trueRateLog10
- the log10 probability of being right (0.0-1.0). Can be -Infinity to indicate
that the result is impossible in which MIN_PHRED_SCALED_QUAL is returnedpublic static byte boundQual(int qual)
qual
- the uncapped quality score as an integerpublic static byte boundQual(int qual, byte maxQual)
qual
- the uncapped quality score as an integer. Can be < 0 (which may indicate an error in the
client code), which will be brought back to 1, but this isn't an error, as some
routines may use this functionality (BaseRecalibrator, for example)maxQual
- the maximum quality score, must be less < 255public static double phredSum(double[] phreds)
phreds
- the phred score values.public static double phredSum(double a, double b)
As any sum, this operation is commutative.
a
- first phred score value.b
- second phred score value.public static double phredSum(double a, double b, double c)
As any sum, this operation is commutative.
a
- first phred score value.b
- second phred score value.c
- thrid phred score value.