From 2cbaef2fb2bce6ce1cb816f7aa89d62b95a2eb17 Mon Sep 17 00:00:00 2001 From: Ron Levine Date: Sun, 15 Feb 2015 09:04:39 -0500 Subject: [PATCH] Throw exception for -dcov argument given to ActiveRegionWalkers --- .../HaplotypeCallerIntegrationTest.java | 16 +++++++++++++++ .../gatk/engine/CommandLineGATK.java | 5 ++--- .../gatk/engine/GenomeAnalysisEngine.java | 20 +++++++++++++++---- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerIntegrationTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerIntegrationTest.java index f72cf4e6f..899d23736 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerIntegrationTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerIntegrationTest.java @@ -424,4 +424,20 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest { " -o %s", 1, UserException.HardwareFeatureException.class)); } + + @Test + public void testHaplotypeCallerDcovException(){ + executeTest("HaplotypeCallerDcovException", + new WalkerTest.WalkerTestSpec( + " -T HaplotypeCaller" + + " --contamination_fraction_to_filter 0.05 --disableDithering --pcr_indel_model NONE --maxReadsInRegionPerSample 1000 " + + " --minReadsPerAlignmentStart 5 --maxProbPropagationDistance 50 --activeProbabilityThreshold 0.002 " + + " --no_cmdline_in_header -minPruning 3 -pairHMM VECTOR_LOGLESS_CACHING -pairHMMSub " + HMM_SUB_IMPLEMENTATION + + " -dcov 50" + + " -R " + REF + + " -I " + NA12878_BAM + + " -L " + INTERVALS_FILE + + " -o %s", + 1, UserException.CommandLineException.class)); + } } diff --git a/public/gatk-engine/src/main/java/org/broadinstitute/gatk/engine/CommandLineGATK.java b/public/gatk-engine/src/main/java/org/broadinstitute/gatk/engine/CommandLineGATK.java index afecc2e12..05b770005 100644 --- a/public/gatk-engine/src/main/java/org/broadinstitute/gatk/engine/CommandLineGATK.java +++ b/public/gatk-engine/src/main/java/org/broadinstitute/gatk/engine/CommandLineGATK.java @@ -203,9 +203,8 @@ public class CommandLineGATK extends CommandLineExecutable { // If no analysis name is present, fill in extra help on the walkers. WalkerManager walkerManager = engine.getWalkerManager(); - String analysisName = getAnalysisName(); - if(analysisName != null && walkerManager.exists(getAnalysisName())) - additionalHelp = getWalkerHelp(walkerManager.getWalkerClassByName(getAnalysisName())); + if(analysisName != null && walkerManager.exists(analysisName)) + additionalHelp = getWalkerHelp(walkerManager.getWalkerClassByName(analysisName)); else additionalHelp = getAllWalkerHelp(); diff --git a/public/gatk-engine/src/main/java/org/broadinstitute/gatk/engine/GenomeAnalysisEngine.java b/public/gatk-engine/src/main/java/org/broadinstitute/gatk/engine/GenomeAnalysisEngine.java index 447ceeecb..3117d3c57 100644 --- a/public/gatk-engine/src/main/java/org/broadinstitute/gatk/engine/GenomeAnalysisEngine.java +++ b/public/gatk-engine/src/main/java/org/broadinstitute/gatk/engine/GenomeAnalysisEngine.java @@ -259,13 +259,16 @@ public class GenomeAnalysisEngine { // validate our parameters if (args == null) { - throw new ReviewedGATKException("The GATKArgumentCollection passed to GenomeAnalysisEngine can not be null."); + throw new ReviewedGATKException("The GATKArgumentCollection passed to GenomeAnalysisEngine cannot be null."); } // validate our parameters if (this.walker == null) - throw new ReviewedGATKException("The walker passed to GenomeAnalysisEngine can not be null."); + throw new ReviewedGATKException("The walker passed to GenomeAnalysisEngine cannot be null."); + // check that active region walkers do not use the downsampling to coverage argument + checkDownSamplingToCoverage(); + if (args.nonDeterministicRandomSeed) Utils.resetRandomGenerator(System.currentTimeMillis()); @@ -465,8 +468,6 @@ public class GenomeAnalysisEngine { return this.threadAllocation == null ? 1 : threadAllocation.getTotalNumThreads(); } - - /** * Allow subclasses and others within this package direct access to the walker manager. * @return The walker manager used by this package. @@ -556,6 +557,17 @@ public class GenomeAnalysisEngine { checkForDuplicateSamFiles(); } + /** + * Check that active region walkers do not use the downsampling to coverage argument + * + * @throws UserException if an active region walker is using the -dcov or --downsample_to_coverage downsampling arguments + */ + private void checkDownSamplingToCoverage() { + if (argCollection.downsampleCoverage != null && walker instanceof ActiveRegionWalker) { + throw new UserException.CommandLineException("Cannot use -dcov or --downsample_to_coverage for ActiveRegionWalkers, use another downsampling argument"); + } + } + /** * Checks whether there are SAM files that appear multiple times in the fully unpacked list of * SAM files (samReaderIDs). If there are, throws an ArgumentException listing the files in question.