From f8b1dbe3b3f25d658c302bf3d15046b10a427554 Mon Sep 17 00:00:00 2001 From: ebanks Date: Thu, 23 Jul 2009 01:58:47 +0000 Subject: [PATCH] getBestGenotype() does not necessarily return hets in alphabetical order; the string (unfortunately) needs to be sorted for lookup in the table (otherwise we throw a NullPointerException) TO DO: have the table be smarter instead of sorting each genotype string git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1298 348d0f76-0448-11de-a6fe-93d51630548a --- .../playground/gatk/walkers/variants/RatioFilter.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/variants/RatioFilter.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/variants/RatioFilter.java index 36ea0ae07..2130b623f 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/variants/RatioFilter.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/variants/RatioFilter.java @@ -267,7 +267,7 @@ public abstract class RatioFilter implements VariantExclusionCriterion { ReadBackedPileup pileup = new ReadBackedPileup(ref, context); if ( applyToVariant(variant) ) { Pair counts = scoreVariant(ref, pileup, variant); - GenotypeFeatureData gfd = dataTable.get(variant.getBestGenotype()); + GenotypeFeatureData gfd = dataTable.get(orderedBases(variant.getBestGenotype())); if (integrateOverSamplingProbabilities) exclude = integralExclude(gfd, counts); @@ -314,4 +314,10 @@ public abstract class RatioFilter implements VariantExclusionCriterion { //double value = counts.first / (1.0 * Math.max(counts.second, 1.0)); return ! gfd.passesThreshold(value); } + + private String orderedBases(String s) { + char[] charArray = s.toCharArray(); + java.util.Arrays.sort(charArray); + return new String(charArray); + } } \ No newline at end of file