diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/CountVariants.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/CountVariants.java index 8c281b2f8..87b8bac1d 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/CountVariants.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/CountVariants.java @@ -93,28 +93,35 @@ public class CountVariants extends VariantEvaluator implements StandardEval { public String update1(VariantContext vc1, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) { nCalledLoci++; - if (vc1.isVariant()) nVariantLoci++; - switch (vc1.getType()) { - case NO_VARIATION: - nRefLoci++; - break; - case SNP: - nSNPs++; - if (vc1.getAttributeAsBoolean("ISSINGLETON")) nSingletons++; - break; - case MNP: - nMNPs++; - if (vc1.getAttributeAsBoolean("ISSINGLETON")) nSingletons++; - break; - case INDEL: - if (vc1.isInsertion()) nInsertions++; - else nDeletions++; - break; - case MIXED: - nComplex++; - break; - default: - throw new ReviewedStingException("Unexpected VariantContext type " + vc1.getType()); + // Note from Eric: + // This is really not correct. What we really want here is a polymorphic vs. monomorphic count (i.e. on the Genotypes). + // So in order to maintain consistency with the previous implementation (and the intention of the original author), I've + // added in a proxy check for monomorphic status here. + if ( !vc1.isVariant() || (vc1.hasGenotypes() && vc1.getHomRefCount() == vc1.getNSamples()) ) { + nRefLoci++; + } else { + nVariantLoci++; + switch (vc1.getType()) { + case NO_VARIATION: + break; + case SNP: + nSNPs++; + if (vc1.getAttributeAsBoolean("ISSINGLETON")) nSingletons++; + break; + case MNP: + nMNPs++; + if (vc1.getAttributeAsBoolean("ISSINGLETON")) nSingletons++; + break; + case INDEL: + if (vc1.isInsertion()) nInsertions++; + else nDeletions++; + break; + case MIXED: + nComplex++; + break; + default: + throw new ReviewedStingException("Unexpected VariantContext type " + vc1.getType()); + } } String refStr = vc1.getReference().getBaseString().toUpperCase(); diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/util/VariantEvalUtils.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/util/VariantEvalUtils.java index 17bb70c00..33fb008ca 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/util/VariantEvalUtils.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/util/VariantEvalUtils.java @@ -280,7 +280,7 @@ public class VariantEvalUtils { * @return a new VariantContext with just the requested samples */ public VariantContext getSubsetOfVariantContext(VariantContext vc, Collection sampleNames) { - VariantContext vcsub = vc.subContextFromGenotypes(vc.getGenotypes(sampleNames).values()); + VariantContext vcsub = vc.subContextFromGenotypes(vc.getGenotypes(sampleNames).values(), vc.getAlleles()); HashMap newAts = new HashMap(vcsub.getAttributes()); diff --git a/public/java/test/org/broadinstitute/sting/gatk/walkers/varianteval/VariantEvalIntegrationTest.java b/public/java/test/org/broadinstitute/sting/gatk/walkers/varianteval/VariantEvalIntegrationTest.java index 72af7034b..1de9a72d8 100755 --- a/public/java/test/org/broadinstitute/sting/gatk/walkers/varianteval/VariantEvalIntegrationTest.java +++ b/public/java/test/org/broadinstitute/sting/gatk/walkers/varianteval/VariantEvalIntegrationTest.java @@ -236,7 +236,7 @@ public class VariantEvalIntegrationTest extends WalkerTest { " --eval " + validationDataLocation + "yri.trio.gatk_glftrio.intersection.annotated.filtered.chr1.vcf" + " --comp:comp_genotypes,VCF3 " + validationDataLocation + "yri.trio.gatk.ug.head.vcf"; WalkerTestSpec spec = new WalkerTestSpec(withSelect(tests, "DP < 50", "DP50") + " " + extraArgs + " -ST CpG -o %s", - 1, Arrays.asList("14054badcd89b24c2375e1d09918f681")); + 1, Arrays.asList("125fe0a04b5d933cc14016598b2791cd")); executeTestParallel("testSelect1", spec); }