From dc9d40eb9adace272b395df462882968f9c356b7 Mon Sep 17 00:00:00 2001 From: depristo Date: Fri, 28 Aug 2009 00:19:23 +0000 Subject: [PATCH] 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 --- .../walkers/variants/VECAlleleBalance.java | 29 ++++++++++--------- .../variants/VECOnOffGenotypeRatio.java | 15 +++------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/variants/VECAlleleBalance.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/variants/VECAlleleBalance.java index 09b251fbc..b00c75f45 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/variants/VECAlleleBalance.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/variants/VECAlleleBalance.java @@ -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 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; } diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/variants/VECOnOffGenotypeRatio.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/variants/VECOnOffGenotypeRatio.java index 153e7dc3b..25056e944 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/variants/VECOnOffGenotypeRatio.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/variants/VECOnOffGenotypeRatio.java @@ -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 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() {