Clean up the code to have a unified approach to calculating p(true) for both with and without ti/tv models

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3289 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
rpoplin 2010-05-03 13:30:20 +00:00
parent f497213933
commit 97fdd92e7b
2 changed files with 9 additions and 13 deletions

View File

@ -161,14 +161,8 @@ public class ApplyVariantClustersWalker extends RodWalker<ExpandingArrayList<Var
variantDatum.isKnown = !vc.getAttribute("ID").equals(".");
final double pTrue = theModel.evaluateVariant( vc.getAttributes(), vc.getPhredScaledQual() );
double recalQual = QualityUtils.phredScaleErrorRate( Math.max(1.0 - pTrue, 0.000000001) );
if( !theModel.isUsingTiTvModel ) {
recalQual *= 30.0;
} else {
recalQual *= 3.0;
}
// BUGBUG: decide how to scale the quality score
double recalQual = 400.0 * QualityUtils.phredScaleErrorRate( Math.max(1.0 - pTrue, 0.000000001) );
if( variantDatum.isKnown && KNOWN_VAR_QUAL_PRIOR > 0.1 ) { // only use the known prior if the value is specified (meaning not equal to zero)
variantDatum.qual = 0.5 * recalQual + 0.5 * KNOWN_VAR_QUAL_PRIOR;
} else {

View File

@ -721,6 +721,7 @@ public final class VariantGaussianMixtureModel extends VariantOptimizationModel
final double denom = Math.pow(2.0 * 3.14159, ((double)numAnnotations) / 2.0) * Math.pow(determinant[kkk], 0.5);
pVarInCluster[kkk] = (1.0 / ((double) numGaussians)) * (Math.exp( -0.5 * sum )) / denom;
/*
if( isUsingTiTvModel ) {
//pVarInCluster[kkk] = Math.exp( -0.5 * sum );
if( pVarInCluster[kkk] < MIN_PROB) { // Very small numbers are a very big problem
@ -733,13 +734,14 @@ public final class VariantGaussianMixtureModel extends VariantOptimizationModel
//pVarInCluster[kkk] = Math.exp( -0.5 * sum );
// BUGBUG: should pCluster be the distribution from the GMM or a uniform distribution here?
}
*/
}
if( isUsingTiTvModel ) {
for( int kkk = 0; kkk < numGaussians; kkk++ ) {
pVarInCluster[kkk] /= sumProb;
}
}
//if( isUsingTiTvModel ) {
// for( int kkk = 0; kkk < numGaussians; kkk++ ) {
// pVarInCluster[kkk] /= sumProb;
// }
//}
}