Implementation in VE was confusing 'variant' status vs. 'polymorphic' status. This led to issues because we now match types of eval and comp; specifically, subsetting a VC to a monomorphic sample can't change the 'variant' status of the VC (it's still a variant site or otherwise we'll never match the comps, which breaks GenotypeConcordance). CountVariants really got this wrong. Fixed. VE now passes all integration tests.

This commit is contained in:
Eric Banks 2011-08-12 02:22:44 -04:00
parent 45f973ab1f
commit 41f3da75d7
3 changed files with 31 additions and 24 deletions

View File

@ -93,28 +93,35 @@ public class CountVariants extends VariantEvaluator implements StandardEval {
public String update1(VariantContext vc1, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) { public String update1(VariantContext vc1, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
nCalledLoci++; nCalledLoci++;
if (vc1.isVariant()) nVariantLoci++; // Note from Eric:
switch (vc1.getType()) { // This is really not correct. What we really want here is a polymorphic vs. monomorphic count (i.e. on the Genotypes).
case NO_VARIATION: // So in order to maintain consistency with the previous implementation (and the intention of the original author), I've
nRefLoci++; // added in a proxy check for monomorphic status here.
break; if ( !vc1.isVariant() || (vc1.hasGenotypes() && vc1.getHomRefCount() == vc1.getNSamples()) ) {
case SNP: nRefLoci++;
nSNPs++; } else {
if (vc1.getAttributeAsBoolean("ISSINGLETON")) nSingletons++; nVariantLoci++;
break; switch (vc1.getType()) {
case MNP: case NO_VARIATION:
nMNPs++; break;
if (vc1.getAttributeAsBoolean("ISSINGLETON")) nSingletons++; case SNP:
break; nSNPs++;
case INDEL: if (vc1.getAttributeAsBoolean("ISSINGLETON")) nSingletons++;
if (vc1.isInsertion()) nInsertions++; break;
else nDeletions++; case MNP:
break; nMNPs++;
case MIXED: if (vc1.getAttributeAsBoolean("ISSINGLETON")) nSingletons++;
nComplex++; break;
break; case INDEL:
default: if (vc1.isInsertion()) nInsertions++;
throw new ReviewedStingException("Unexpected VariantContext type " + vc1.getType()); else nDeletions++;
break;
case MIXED:
nComplex++;
break;
default:
throw new ReviewedStingException("Unexpected VariantContext type " + vc1.getType());
}
} }
String refStr = vc1.getReference().getBaseString().toUpperCase(); String refStr = vc1.getReference().getBaseString().toUpperCase();

View File

@ -280,7 +280,7 @@ public class VariantEvalUtils {
* @return a new VariantContext with just the requested samples * @return a new VariantContext with just the requested samples
*/ */
public VariantContext getSubsetOfVariantContext(VariantContext vc, Collection<String> sampleNames) { public VariantContext getSubsetOfVariantContext(VariantContext vc, Collection<String> sampleNames) {
VariantContext vcsub = vc.subContextFromGenotypes(vc.getGenotypes(sampleNames).values()); VariantContext vcsub = vc.subContextFromGenotypes(vc.getGenotypes(sampleNames).values(), vc.getAlleles());
HashMap<String, Object> newAts = new HashMap<String, Object>(vcsub.getAttributes()); HashMap<String, Object> newAts = new HashMap<String, Object>(vcsub.getAttributes());

View File

@ -236,7 +236,7 @@ public class VariantEvalIntegrationTest extends WalkerTest {
" --eval " + validationDataLocation + "yri.trio.gatk_glftrio.intersection.annotated.filtered.chr1.vcf" + " --eval " + validationDataLocation + "yri.trio.gatk_glftrio.intersection.annotated.filtered.chr1.vcf" +
" --comp:comp_genotypes,VCF3 " + validationDataLocation + "yri.trio.gatk.ug.head.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", 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); executeTestParallel("testSelect1", spec);
} }