diff --git a/public/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java b/public/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java index b9d1a55c7..0e97f30bc 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java +++ b/public/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java @@ -385,7 +385,7 @@ public class GenomeAnalysisEngine { // 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. - if ( intervals != null && intervals.isEmpty() ) { + if ( intervals != null && intervals.isEmpty() && argCollection.excludeIntervals != null ) { throw new ArgumentException("The given combination of -L and -XL options results in an empty set. " + "No intervals to process."); } diff --git a/public/java/test/org/broadinstitute/sting/gatk/GenomeAnalysisEngineUnitTest.java b/public/java/test/org/broadinstitute/sting/gatk/GenomeAnalysisEngineUnitTest.java index 3a6d88264..383535b3a 100644 --- a/public/java/test/org/broadinstitute/sting/gatk/GenomeAnalysisEngineUnitTest.java +++ b/public/java/test/org/broadinstitute/sting/gatk/GenomeAnalysisEngineUnitTest.java @@ -109,20 +109,6 @@ public class GenomeAnalysisEngineUnitTest extends BaseTest { }; } - @Test(expectedExceptions=UserException.class, dataProvider="invalidIntervalTestData") - public void testInvalidBedIntervalHandling(GenomeAnalysisEngine testEngine, GenomeLocParser genomeLocParser, - String contig, int intervalStart, int intervalEnd ) throws Exception { - // We need to adjust intervalStart, since BED intervals are 0-based. We don't need to adjust intervalEnd, - // since the ending point is an open interval. - File bedFile = createTempFile("testInvalidBedIntervalHandling", ".bed", - String.format("%s %d %d", contig, intervalStart -1, intervalEnd)); - - List> intervalArgs = new ArrayList>(1); - intervalArgs.add(new IntervalBinding(bedFile.getAbsolutePath())); - - testEngine.loadIntervals(intervalArgs, IntervalSetRule.UNION); - } - @Test(expectedExceptions=UserException.class, dataProvider="invalidIntervalTestData") public void testInvalidPicardIntervalHandling(GenomeAnalysisEngine testEngine, GenomeLocParser genomeLocParser, String contig, int intervalStart, int intervalEnd ) throws Exception { @@ -154,6 +140,11 @@ 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(); diff --git a/public/java/test/org/broadinstitute/sting/utils/interval/IntervalIntegrationTest.java b/public/java/test/org/broadinstitute/sting/utils/interval/IntervalIntegrationTest.java index 1431a80f3..729b6fa37 100644 --- a/public/java/test/org/broadinstitute/sting/utils/interval/IntervalIntegrationTest.java +++ b/public/java/test/org/broadinstitute/sting/utils/interval/IntervalIntegrationTest.java @@ -25,6 +25,8 @@ package org.broadinstitute.sting.utils.interval; import org.broadinstitute.sting.WalkerTest; +import org.broadinstitute.sting.commandline.ArgumentException; +import org.broadinstitute.sting.utils.exceptions.UserException; import org.testng.annotations.Test; import java.io.File; @@ -161,4 +163,79 @@ public class IntervalIntegrationTest extends WalkerTest { Arrays.asList(md5)); executeTest("testMixedIntervalMerging", spec); } + + @Test(enabled = true) + public void testComplexVCF() { + String md5 = "166d77ac1b46a1ec38aa35ab7e628ab5"; + WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( + "-T CountLoci" + + " -I " + validationDataLocation + "OV-0930.normal.chunk.bam" + + " -R " + hg18Reference + + " -o %s" + + " -L " + validationDataLocation + "intervalTest.3.vcf", + 1, // just one output file + Arrays.asList(md5)); + executeTest("testComplexVCF", spec); + } + + @Test(enabled = true) + public void testMergingWithComplexVCF() { + String md5 = "6d7fce9fee471194aa8b5b6e47267f03"; + WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( + "-T CountLoci" + + " -I " + validationDataLocation + "OV-0930.normal.chunk.bam" + + " -R " + hg18Reference + + " -o %s" + + " -L " + validationDataLocation + "intervalTest.1.vcf" + + " -XL " + validationDataLocation + "intervalTest.3.vcf", + 1, // just one output file + Arrays.asList(md5)); + executeTest("testMergingWithComplexVCF", spec); + } + + @Test(enabled = true, expectedExceptions = RuntimeException.class) + public void testEmptyVCFError() { + String md5 = ""; + WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( + "-T CountLoci" + + " -I " + validationDataLocation + "OV-0930.normal.chunk.bam" + + " -R " + hg18Reference + + " -o %s" + + " -L " + validationDataLocation + "intervalTest.empty.vcf", + 1, // just one output file + Arrays.asList(md5)); + executeTest("testEmptyVCFError", spec); + } + + @Test(enabled = true) + public void testEmptyVCFNoError() { + 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) + public void testIncludeExcludeIsTheSame() { + String md5 = ""; + WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( + "-T CountLoci" + + " -I " + validationDataLocation + "OV-0930.normal.chunk.bam" + + " -R " + hg18Reference + + " -o %s" + + " -L " + validationDataLocation + "intervalTest.1.vcf" + + " -XL " + validationDataLocation + "intervalTest.1.vcf", + 1, // just one output file + Arrays.asList(md5)); + executeTest("testIncludeExcludeIsTheSame", spec); + } + + }