From 8316fa92f3e1e552e7a30865e8f8c8a82ae47496 Mon Sep 17 00:00:00 2001 From: Ron Levine Date: Thu, 26 Jan 2017 08:42:25 -0500 Subject: [PATCH] Set AD and DP to zero if no read coverage --- .../walkers/annotator/DepthPerAlleleBySample.java | 7 +++++-- .../gatk/tools/walkers/annotator/DepthPerSampleHC.java | 4 ++-- .../gatk/tools/walkers/annotator/QualByDepth.java | 10 ++++++---- ...iedGenotyperGeneralPloidySuite1IntegrationTest.java | 6 +++--- .../genotyper/UnifiedGenotyperIntegrationTest.java | 4 ++-- ...allerComplexAndSymbolicVariantsIntegrationTest.java | 2 +- 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/DepthPerAlleleBySample.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/DepthPerAlleleBySample.java index eac2c05dc..dd5c2b8d7 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/DepthPerAlleleBySample.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/DepthPerAlleleBySample.java @@ -108,10 +108,13 @@ public class DepthPerAlleleBySample extends GenotypeAnnotation implements Standa if ( g == null || !g.isCalled() || ( stratifiedContext == null && alleleLikelihoodMap == null) ) return; - if (alleleLikelihoodMap != null && !alleleLikelihoodMap.isEmpty()) + if (alleleLikelihoodMap != null && !alleleLikelihoodMap.isEmpty()) { annotateWithLikelihoods(alleleLikelihoodMap, vc, gb); - else if ( stratifiedContext != null && (vc.isSNP())) + } else if ( stratifiedContext != null && (vc.isSNP())) { annotateWithPileup(stratifiedContext, vc, gb); + } else { + gb.AD(new int[vc.getNAlleles()]); + } } private void annotateWithPileup(final AlignmentContext stratifiedContext, final VariantContext vc, final GenotypeBuilder gb) { diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/DepthPerSampleHC.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/DepthPerSampleHC.java index 3b0fb7338..25b9ba1e3 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/DepthPerSampleHC.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/DepthPerSampleHC.java @@ -137,9 +137,9 @@ public class DepthPerSampleHC extends GenotypeAnnotation implements StandardHCAn dp++; } } - - gb.DP(dp); } + + gb.DP(dp); } @Override diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/QualByDepth.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/QualByDepth.java index 032067352..3ad46c8d2 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/QualByDepth.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/QualByDepth.java @@ -146,10 +146,12 @@ public class QualByDepth extends InfoFieldAnnotation implements StandardAnnotati if ( genotype.hasAD() ) { final int[] AD = genotype.getAD(); final int totalADdepth = (int)MathUtils.sum(AD); - if ( totalADdepth - AD[0] > 1 ) - ADrestrictedDepth += totalADdepth; - standardDepth += totalADdepth; - continue; + if ( totalADdepth != 0 ) { + if (totalADdepth - AD[0] > 1) + ADrestrictedDepth += totalADdepth; + standardDepth += totalADdepth; + continue; + } } if (stratifiedContexts!= null && !stratifiedContexts.isEmpty()) { diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/genotyper/UnifiedGenotyperGeneralPloidySuite1IntegrationTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/genotyper/UnifiedGenotyperGeneralPloidySuite1IntegrationTest.java index 9382cbe2a..5fa61312d 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/genotyper/UnifiedGenotyperGeneralPloidySuite1IntegrationTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/genotyper/UnifiedGenotyperGeneralPloidySuite1IntegrationTest.java @@ -69,17 +69,17 @@ public class UnifiedGenotyperGeneralPloidySuite1IntegrationTest extends WalkerTe @Test(enabled = true) public void testSNP_ACS_Pools() { - executor.PC_LSV_Test_short("-A AlleleCountBySample -maxAltAlleles 1 -ploidy 6 -out_mode EMIT_ALL_CONFIDENT_SITES", "LSV_SNP_ACS", "SNP", "90ed6f1c268b9c57ecb52b35a88b9368"); + executor.PC_LSV_Test_short("-A AlleleCountBySample -maxAltAlleles 1 -ploidy 6 -out_mode EMIT_ALL_CONFIDENT_SITES", "LSV_SNP_ACS", "SNP", "963e128314aceaab06c240850b836b10"); } @Test(enabled = true) public void testBOTH_GGA_Pools() { - executor.PC_LSV_Test(String.format("-A AlleleCountBySample -maxAltAlleles 2 -ploidy 24 -gt_mode GENOTYPE_GIVEN_ALLELES -out_mode EMIT_ALL_SITES -alleles %s", LSV_ALLELES), "LSV_BOTH_GGA", "BOTH", "5ad4dd6b0c3c170ba44fdad6d4fa58cf"); + executor.PC_LSV_Test(String.format("-A AlleleCountBySample -maxAltAlleles 2 -ploidy 24 -gt_mode GENOTYPE_GIVEN_ALLELES -out_mode EMIT_ALL_SITES -alleles %s", LSV_ALLELES), "LSV_BOTH_GGA", "BOTH", "f3bf8b59a04db9fb52dcdea76664606d"); } @Test(enabled = true) public void testINDEL_GGA_Pools() { - executor.PC_LSV_Test(String.format("-A AlleleCountBySample -maxAltAlleles 1 -ploidy 24 -gt_mode GENOTYPE_GIVEN_ALLELES -out_mode EMIT_ALL_SITES -alleles %s", LSV_ALLELES), "LSV_INDEL_GGA", "INDEL", "d26b0ba07e056b73fe4cfe873636d0d6"); + executor.PC_LSV_Test(String.format("-A AlleleCountBySample -maxAltAlleles 1 -ploidy 24 -gt_mode GENOTYPE_GIVEN_ALLELES -out_mode EMIT_ALL_SITES -alleles %s", LSV_ALLELES), "LSV_INDEL_GGA", "INDEL", "f8bae1491695d02ccb929205b4458759"); } @Test(enabled = true) diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/genotyper/UnifiedGenotyperIntegrationTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/genotyper/UnifiedGenotyperIntegrationTest.java index d76a83128..1ff30ee47 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/genotyper/UnifiedGenotyperIntegrationTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/genotyper/UnifiedGenotyperIntegrationTest.java @@ -129,12 +129,12 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest { @Test public void testOutputParameterAllConfident() { - testOutputParameters("--output_mode EMIT_ALL_CONFIDENT_SITES", "182af9490667cb6ce1415305de4f3fdd"); + testOutputParameters("--output_mode EMIT_ALL_CONFIDENT_SITES", "96567418000ec94abee98d70199a700a"); } @Test public void testOutputParameterAllSites() { - testOutputParameters("--output_mode EMIT_ALL_SITES", "524e85c225ce330fd094de93f078fa56"); + testOutputParameters("--output_mode EMIT_ALL_SITES", "5ccff12b34ace5e882e465047a286c5a"); } private void testOutputParameters(final String args, final String md5) { diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerComplexAndSymbolicVariantsIntegrationTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerComplexAndSymbolicVariantsIntegrationTest.java index 755e4af49..e7c2c4030 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerComplexAndSymbolicVariantsIntegrationTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerComplexAndSymbolicVariantsIntegrationTest.java @@ -72,7 +72,7 @@ public class HaplotypeCallerComplexAndSymbolicVariantsIntegrationTest extends Wa @Test public void testHaplotypeCallerMultiSampleComplex1() { - HCTestComplexVariants(privateTestDir + "AFR.complex.variants.bam", "", "4f30d9c9f1eb4529071b7060e497235d"); + HCTestComplexVariants(privateTestDir + "AFR.complex.variants.bam", "", "590428bdfe466159cb8e1637aaa4f47c"); } private void HCTestSymbolicVariants(String bam, String args, String md5) {