Added further integration tests for rod-based intervals that deal with more complex cases. Good call by Mark to test the empty VCF example because we were failing on it; fixed.
This commit is contained in:
parent
c2f343773e
commit
ccfd853b34
|
|
@ -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.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<IntervalBinding<Feature>> intervalArgs = new ArrayList<IntervalBinding<Feature>>(1);
|
||||
intervalArgs.add(new IntervalBinding<Feature>(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();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue