Throw exception for -dcov argument given to ActiveRegionWalkers

This commit is contained in:
Ron Levine 2015-02-15 09:04:39 -05:00
parent b5f20bbb00
commit 2cbaef2fb2
3 changed files with 34 additions and 7 deletions

View File

@ -424,4 +424,20 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
" -o %s", " -o %s",
1, UserException.HardwareFeatureException.class)); 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));
}
} }

View File

@ -203,9 +203,8 @@ public class CommandLineGATK extends CommandLineExecutable {
// If no analysis name is present, fill in extra help on the walkers. // If no analysis name is present, fill in extra help on the walkers.
WalkerManager walkerManager = engine.getWalkerManager(); WalkerManager walkerManager = engine.getWalkerManager();
String analysisName = getAnalysisName(); if(analysisName != null && walkerManager.exists(analysisName))
if(analysisName != null && walkerManager.exists(getAnalysisName())) additionalHelp = getWalkerHelp(walkerManager.getWalkerClassByName(analysisName));
additionalHelp = getWalkerHelp(walkerManager.getWalkerClassByName(getAnalysisName()));
else else
additionalHelp = getAllWalkerHelp(); additionalHelp = getAllWalkerHelp();

View File

@ -259,12 +259,15 @@ public class GenomeAnalysisEngine {
// validate our parameters // validate our parameters
if (args == null) { 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 // validate our parameters
if (this.walker == null) 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) if (args.nonDeterministicRandomSeed)
Utils.resetRandomGenerator(System.currentTimeMillis()); Utils.resetRandomGenerator(System.currentTimeMillis());
@ -465,8 +468,6 @@ public class GenomeAnalysisEngine {
return this.threadAllocation == null ? 1 : threadAllocation.getTotalNumThreads(); return this.threadAllocation == null ? 1 : threadAllocation.getTotalNumThreads();
} }
/** /**
* Allow subclasses and others within this package direct access to the walker manager. * Allow subclasses and others within this package direct access to the walker manager.
* @return The walker manager used by this package. * @return The walker manager used by this package.
@ -556,6 +557,17 @@ public class GenomeAnalysisEngine {
checkForDuplicateSamFiles(); 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 * 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. * SAM files (samReaderIDs). If there are, throws an ArgumentException listing the files in question.