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:
parent
45f973ab1f
commit
41f3da75d7
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ public class VariantEvalUtils {
|
|||
* @return a new VariantContext with just the requested samples
|
||||
*/
|
||||
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());
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue