From 40bc7d6a9ce85b40918187b3642d279a55a4cccb Mon Sep 17 00:00:00 2001 From: Mark DePristo Date: Tue, 6 Aug 2013 15:51:57 -0400 Subject: [PATCH] Bugfix for ReferenceConfidenceModel -- In the case where there's some variation to assembly and evaluate but the resulting haplotypes don't result in any called variants, the reference model would exception out with "java.lang.IllegalArgumentException: calledHaplotypes must contain the refHaplotype". Now we detect this case and emit the standard no variation output. -- [delivers #54625060] --- .../gatk/walkers/haplotypecaller/HaplotypeCaller.java | 10 +++++++--- .../HaplotypeCallerGVCFIntegrationTest.java | 9 +++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCaller.java b/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCaller.java index 24bb41a94..3d7ea438e 100644 --- a/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCaller.java +++ b/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCaller.java @@ -791,9 +791,13 @@ public class HaplotypeCaller extends ActiveRegionWalker, In if( DEBUG ) { logger.info("----------------------------------------------------------------------------------"); } if ( emitReferenceConfidence() ) { - return referenceConfidenceModel.calculateRefConfidence(assemblyResult.getRefHaplotype(), - calledHaplotypes.getCalledHaplotypes(), assemblyResult.paddedReferenceLoc, assemblyResult.regionForGenotyping, - stratifiedReadMap, calledHaplotypes.getCalls()); + if ( calledHaplotypes.getCalls().isEmpty() ) { + // no called all of the potential haplotypes + return referenceModelForNoVariation(originalActiveRegion, false); + } else + return referenceConfidenceModel.calculateRefConfidence(assemblyResult.getRefHaplotype(), + calledHaplotypes.getCalledHaplotypes(), assemblyResult.paddedReferenceLoc, assemblyResult.regionForGenotyping, + stratifiedReadMap, calledHaplotypes.getCalls()); } else { return calledHaplotypes.getCalls(); } diff --git a/protected/java/test/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCallerGVCFIntegrationTest.java b/protected/java/test/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCallerGVCFIntegrationTest.java index fca8de330..4ef32fef1 100644 --- a/protected/java/test/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCallerGVCFIntegrationTest.java +++ b/protected/java/test/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCallerGVCFIntegrationTest.java @@ -85,4 +85,13 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest { final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList(md5)); executeTest(name, spec); } + + @Test + public void testERCRegionWithNoCalledHaplotypes() { + final String commandLine = String.format("-T HaplotypeCaller -R %s -I %s -L %s -ERC GVCF", + b37KGReference, privateTestDir + "noCallRefModel.bam", "20:17000001-18000001"); + final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList("")); + spec.disableShadowBCF(); + executeTest("testERCRegionWithNoCalledHaplotypes", spec); + } }