Now requires a minimum genotype LOD before applying tests

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1471 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2009-08-28 00:19:23 +00:00
parent 37a9b84276
commit dc9d40eb9a
2 changed files with 20 additions and 24 deletions

View File

@ -8,9 +8,11 @@ import org.broadinstitute.sting.utils.Pair;
import org.broadinstitute.sting.utils.GenotypeUtils;
public class VECAlleleBalance implements VariantExclusionCriterion { //extends RatioFilter {
//final private static GenotypeFeatureData.Tail tail = GenotypeFeatureData.Tail.TwoTailed;
private static final double defaultMinGenotypeConfidenceToTest = 5.0; // TODO -- must be replaced with true confidence scoore, right now assumes LOD
private boolean exclude;
private double lowThreshold = 0.1, highThreshold = 0.85;
private double minGenotypeConfidenceToTest = defaultMinGenotypeConfidenceToTest;
private double ratio;
public void initialize(String arguments) {
@ -18,20 +20,11 @@ public class VECAlleleBalance implements VariantExclusionCriterion { //extends
String[] argPieces = arguments.split(",");
lowThreshold = Double.valueOf(argPieces[0]);
highThreshold = Double.valueOf(argPieces[1]);
if ( argPieces.length > 2 )
minGenotypeConfidenceToTest = Double.valueOf(argPieces[2]);
}
}
/**
* We can only filter out het calls with the AlleleBalance filter
*
* @param variant
* @return
*/
protected boolean applyToVariant(rodVariants variant) {
String genotype = variant.getBestGenotype();
return genotype.charAt(0) != genotype.charAt(1);
}
/**
* Return the count of bases matching the major (first) and minor (second) alleles as a pair.
*
@ -64,7 +57,17 @@ public class VECAlleleBalance implements VariantExclusionCriterion { //extends
Pair<Integer, Integer> counts = scoreVariant(ref, pileup, variant);
int n = counts.first + counts.second;
ratio = counts.first.doubleValue() / (double)n;
exclude = GenotypeUtils.isHet(variant) && (ratio < lowThreshold || ratio > highThreshold);
boolean highGenotypeConfidence = variant.getConsensusConfidence() > minGenotypeConfidenceToTest;
boolean failsHetExpectation = GenotypeUtils.isHet(variant) && (ratio < lowThreshold || ratio > highThreshold);
exclude = failsHetExpectation && highGenotypeConfidence;
// if ( failsHetExpectation ) {
// String header = highGenotypeConfidence ? "FILTER-HIGH-CONFIDENCE" : "PASS-LOW-CONFIDENCE";
// System.out.printf("[%s] %s getConsensusConfidence() = %f > minGenotypeConfidenceToTest = %f exclude=%b %s%n",
// header, variant.getBestGenotype(), variant.getConsensusConfidence(), minGenotypeConfidenceToTest, exclude,
// ! highGenotypeConfidence ? variant : "" );
// }
}
public boolean useZeroQualityReads() { return false; }

View File

@ -5,6 +5,8 @@ import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.utils.*;
public class VECOnOffGenotypeRatio implements VariantExclusionCriterion { // extends RatioFilter {
private static final double minGenotypeConfidenceToTest = 5.0; // TODO -- must be replaced with true confidence scoore, right now assumes LOD
//final private static GenotypeFeatureData.Tail tail = GenotypeFeatureData.Tail.LeftTailed;
private boolean exclude;
private double threshold = 0.0;
@ -16,16 +18,6 @@ public class VECOnOffGenotypeRatio implements VariantExclusionCriterion { // ext
}
}
/**
* On/off genotype filters can be applied to any genotype
*
* @param variant
* @return
*/
protected boolean applyToVariant(rodVariants variant) {
return true;
}
/**
* Return the counts of bases that are on (matching the bestGenotype) and off (not matching the
* best genotype). On are in the first field, off in the second.
@ -61,7 +53,8 @@ public class VECOnOffGenotypeRatio implements VariantExclusionCriterion { // ext
Pair<Integer, Integer> counts = scoreVariant(ref, pileup, variant);
int n = counts.first + counts.second;
ratio = counts.first.doubleValue() / (double)n;
exclude = ratio < threshold;
boolean highGenotypeConfidence = variant.getConsensusConfidence() > minGenotypeConfidenceToTest;
exclude = ratio < threshold && highGenotypeConfidence;
}
public double inclusionProbability() {