Don't compute QD if there is no QUAL; added integration test for this

This commit is contained in:
Eric Banks 2012-05-03 11:02:37 -04:00
parent 567d01cee8
commit 557da77a1a
2 changed files with 10 additions and 2 deletions

View File

@ -29,7 +29,7 @@ import java.util.Map;
public class QualByDepth extends InfoFieldAnnotation implements StandardAnnotation, ActiveRegionBasedAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, AnnotatorCompatibleWalker walker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 )
if ( !vc.hasLog10PError() || stratifiedContexts.size() == 0 )
return null;
final GenotypesContext genotypes = vc.getGenotypes();

View File

@ -54,7 +54,7 @@ public class VariantAnnotatorIntegrationTest extends WalkerTest {
@Test
public void testNoAnnotsNotAsking2() {
// this genotype annotations in this file are actually out of order. If you don't parse the genotypes
// the genotype annotations in this file are actually out of order. If you don't parse the genotypes
// they don't get reordered. It's a good test of the genotype ordering system.
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString() + " --variant:VCF3 " + validationDataLocation + "vcfexample3empty.vcf -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -L 1:10,000,000-10,050,000", 1,
@ -126,6 +126,14 @@ public class VariantAnnotatorIntegrationTest extends WalkerTest {
executeTest("getting DB tag with HM3", spec);
}
@Test
public void testNoQuals() {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString() + " --variant " + validationDataLocation + "noQual.vcf -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -L " + validationDataLocation + "noQual.vcf -A QualByDepth", 1,
Arrays.asList("e531c9f90c17f0f859cd1ac851a8edd8"));
executeTest("test file doesn't have QUALs", spec);
}
@Test
public void testUsingExpression() {
WalkerTestSpec spec = new WalkerTestSpec(