Allow processing of empty intervals, but warn user when this case is encountered.
This commit is contained in:
parent
649dfe98f0
commit
0ca7428e76
|
|
@ -383,11 +383,9 @@ public class GenomeAnalysisEngine {
|
|||
// If intervals is non-null and empty at this point, it means that the list of intervals to process
|
||||
// was filtered down to an empty set (eg., the user specified something like -L chr1 -XL chr1). Since
|
||||
// this was very likely unintentional, the user should be informed of this. Note that this is different
|
||||
// from the case where intervals == null, which indicates either that there were no interval arguments,
|
||||
// or that -L all was specified.
|
||||
// from the case where intervals == null, which indicates that there were no interval arguments.
|
||||
if ( intervals != null && intervals.isEmpty() ) {
|
||||
throw new ArgumentException("The given combination of -L and -XL options results in an empty set. " +
|
||||
"No intervals to process.");
|
||||
logger.warn("The given combination of -L and -XL options results in an empty set. No intervals to process.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -610,17 +608,12 @@ public class GenomeAnalysisEngine {
|
|||
*/
|
||||
protected GenomeLocSortedSet loadIntervals( List<IntervalBinding<Feature>> argList, IntervalSetRule rule ) {
|
||||
|
||||
boolean allowEmptyIntervalList = (argCollection.unsafe == ValidationExclusion.TYPE.ALLOW_EMPTY_INTERVAL_LIST ||
|
||||
argCollection.unsafe == ValidationExclusion.TYPE.ALL);
|
||||
|
||||
List<GenomeLoc> allIntervals = new ArrayList<GenomeLoc>(0);
|
||||
for ( IntervalBinding intervalBinding : argList ) {
|
||||
List<GenomeLoc> intervals = intervalBinding.getIntervals(this);
|
||||
|
||||
if ( !allowEmptyIntervalList && intervals.isEmpty() ) {
|
||||
throw new UserException("The interval file " + intervalBinding.getSource() + " contains no intervals " +
|
||||
"that could be parsed, and the unsafe operation ALLOW_EMPTY_INTERVAL_LIST has " +
|
||||
"not been enabled");
|
||||
if ( intervals.isEmpty() ) {
|
||||
logger.warn("The interval file " + intervalBinding.getSource() + " contains no intervals that could be parsed.");
|
||||
}
|
||||
|
||||
allIntervals = IntervalUtils.mergeListsBySetOperator(intervals, allIntervals, rule);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ public class ValidationExclusion {
|
|||
|
||||
public enum TYPE {
|
||||
ALLOW_UNINDEXED_BAM, // allow bam files that do not have an index; we'll traverse them using monolithic shard
|
||||
ALLOW_EMPTY_INTERVAL_LIST, // allow the user to pass in an empty interval list
|
||||
ALLOW_UNSET_BAM_SORT_ORDER, // assume that the bam is sorted, even if the SO (sort-order) flag is not set
|
||||
NO_READ_ORDER_VERIFICATION, // do not validate that the reads are in order as we take them from the bam file
|
||||
ALLOW_SEQ_DICT_INCOMPATIBILITY, // allow dangerous, but not fatal, sequence dictionary incompabilities
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public class GenomeAnalysisEngineUnitTest extends BaseTest {
|
|||
testEngine.checkForDuplicateSamFiles();
|
||||
}
|
||||
|
||||
@Test(expectedExceptions=ArgumentException.class)
|
||||
@Test
|
||||
public void testEmptyIntervalSetHandling() throws Exception {
|
||||
GenomeAnalysisEngine testEngine = new GenomeAnalysisEngine();
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ public class GenomeAnalysisEngineUnitTest extends BaseTest {
|
|||
};
|
||||
}
|
||||
|
||||
@Test(expectedExceptions=UserException.class, dataProvider="invalidIntervalTestData")
|
||||
@Test(dataProvider="invalidIntervalTestData")
|
||||
public void testInvalidPicardIntervalHandling(GenomeAnalysisEngine testEngine, GenomeLocParser genomeLocParser,
|
||||
String contig, int intervalStart, int intervalEnd ) throws Exception {
|
||||
|
||||
|
|
@ -140,11 +140,6 @@ public class GenomeAnalysisEngineUnitTest extends BaseTest {
|
|||
testEngine.loadIntervals(intervalArgs, IntervalSetRule.UNION);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private File createTempFile( String tempFilePrefix, String tempFileExtension, String... lines ) throws Exception {
|
||||
File tempFile = File.createTempFile(tempFilePrefix, tempFileExtension);
|
||||
tempFile.deleteOnExit();
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class IntervalIntegrationTest extends WalkerTest {
|
|||
executeTest("testUnmappedReadInclusion",spec);
|
||||
}
|
||||
|
||||
@Test(enabled = true)
|
||||
@Test(enabled = false)
|
||||
public void testUnmappedReadExclusion() {
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-T PrintReads" +
|
||||
|
|
@ -191,8 +191,8 @@ public class IntervalIntegrationTest extends WalkerTest {
|
|||
executeTest("testMergingWithComplexVCF", spec);
|
||||
}
|
||||
|
||||
@Test(enabled = true, expectedExceptions = RuntimeException.class)
|
||||
public void testEmptyVCFNoUnsafe() {
|
||||
@Test(enabled = true)
|
||||
public void testEmptyVCF() {
|
||||
String md5 = "";
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-T CountLoci" +
|
||||
|
|
@ -205,22 +205,7 @@ public class IntervalIntegrationTest extends WalkerTest {
|
|||
executeTest("testEmptyVCFError", spec);
|
||||
}
|
||||
|
||||
@Test(enabled = true, expectedExceptions = RuntimeException.class)
|
||||
public void testEmptyVCFWithUnsafe() {
|
||||
String md5 = "";
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-T CountLoci" +
|
||||
" -I " + validationDataLocation + "OV-0930.normal.chunk.bam" +
|
||||
" -R " + hg18Reference +
|
||||
" -o %s" +
|
||||
" -U ALLOW_EMPTY_INTERVAL_LIST" +
|
||||
" -L " + validationDataLocation + "intervalTest.empty.vcf",
|
||||
1, // just one output file
|
||||
Arrays.asList(md5));
|
||||
executeTest("testEmptyVCFNoError", spec);
|
||||
}
|
||||
|
||||
@Test(enabled = true, expectedExceptions = RuntimeException.class)
|
||||
@Test(enabled = true)
|
||||
public void testIncludeExcludeIsTheSame() {
|
||||
String md5 = "";
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
|
|
|
|||
Loading…
Reference in New Issue