From 557da77a1acea5556e0a865081d972d0cd6452c8 Mon Sep 17 00:00:00 2001 From: Eric Banks Date: Thu, 3 May 2012 11:02:37 -0400 Subject: [PATCH] Don't compute QD if there is no QUAL; added integration test for this --- .../sting/gatk/walkers/annotator/QualByDepth.java | 2 +- .../annotator/VariantAnnotatorIntegrationTest.java | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java index 24a107235..51b834bd2 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java @@ -29,7 +29,7 @@ import java.util.Map; public class QualByDepth extends InfoFieldAnnotation implements StandardAnnotation, ActiveRegionBasedAnnotation { public Map annotate(RefMetaDataTracker tracker, AnnotatorCompatibleWalker walker, ReferenceContext ref, Map stratifiedContexts, VariantContext vc) { - if ( stratifiedContexts.size() == 0 ) + if ( !vc.hasLog10PError() || stratifiedContexts.size() == 0 ) return null; final GenotypesContext genotypes = vc.getGenotypes(); diff --git a/public/java/test/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorIntegrationTest.java b/public/java/test/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorIntegrationTest.java index 80c50fd5f..2f0ef1a0e 100755 --- a/public/java/test/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorIntegrationTest.java +++ b/public/java/test/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorIntegrationTest.java @@ -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(