GQ calculation corrected for most likely genotype

This commit is contained in:
Laurent Francioli 2011-10-26 14:40:04 +02:00
parent 62477a0810
commit 62cff266d4
1 changed files with 8 additions and 3 deletions

View File

@ -124,10 +124,15 @@ public class GenotypeLikelihoods {
}
double[] normalized = MathUtils.normalizeFromLog10(getAsVector());
double chosenGenotype = normalized[genotype.ordinal()-1];
qual = -1.0 * Math.log10(1.0 - chosenGenotype);
//Quality of the most likely genotype = likelihood(most likely) - likelihood (2nd best)
qual = likelihoods.get(genotype) - qual;
//Quality of other genotypes 1-P(G)
if (qual < 0) {
double[] normalized = MathUtils.normalizeFromLog10(getAsVector());
double chosenGenotype = normalized[genotype.ordinal()-1];
qual = -1.0 * Math.log10(1.0 - chosenGenotype);
}
return qual;
}