Added integration tests for Tribble-based intervals and fixed up some of the other tests based on some method changes.

This commit is contained in:
Eric Banks 2011-10-26 15:29:18 -04:00
parent 9424e8b2ca
commit 3273c20c98
6 changed files with 129 additions and 80 deletions

View File

@ -28,24 +28,25 @@ import net.sf.picard.reference.IndexedFastaSequenceFile;
import net.sf.picard.util.Interval; import net.sf.picard.util.Interval;
import net.sf.picard.util.IntervalList; import net.sf.picard.util.IntervalList;
import net.sf.samtools.SAMFileHeader; import net.sf.samtools.SAMFileHeader;
import org.broad.tribble.Feature;
import org.broadinstitute.sting.BaseTest; import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.commandline.ArgumentException; import org.broadinstitute.sting.commandline.ArgumentException;
import org.broadinstitute.sting.commandline.IntervalBinding;
import org.broadinstitute.sting.gatk.arguments.GATKArgumentCollection; import org.broadinstitute.sting.gatk.arguments.GATKArgumentCollection;
import org.broadinstitute.sting.gatk.datasources.reads.SAMReaderID; import org.broadinstitute.sting.gatk.datasources.reads.SAMReaderID;
import org.broadinstitute.sting.commandline.Tags; import org.broadinstitute.sting.commandline.Tags;
import org.broadinstitute.sting.gatk.walkers.PrintReadsWalker; import org.broadinstitute.sting.gatk.walkers.PrintReadsWalker;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser; import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.GenomeLocSortedSet; import org.broadinstitute.sting.utils.GenomeLocSortedSet;
import org.broadinstitute.sting.utils.exceptions.UserException; import org.broadinstitute.sting.utils.exceptions.UserException;
import org.broadinstitute.sting.utils.interval.IntervalSetRule;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.io.File; import java.io.File;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -108,16 +109,6 @@ public class GenomeAnalysisEngineUnitTest extends BaseTest {
}; };
} }
@Test(expectedExceptions=UserException.class, dataProvider="invalidIntervalTestData")
public void testInvalidRODIntervalHandling(GenomeAnalysisEngine testEngine, GenomeLocParser genomeLocParser,
String contig, int intervalStart, int intervalEnd ) throws Exception {
List<String> intervalArgs = new ArrayList<String>();
List<GenomeLoc> rodIntervals = Arrays.asList(genomeLocParser.createGenomeLoc(contig, intervalStart, intervalEnd, true));
testEngine.loadIntervals(intervalArgs, rodIntervals);
}
@Test(expectedExceptions=UserException.class, dataProvider="invalidIntervalTestData") @Test(expectedExceptions=UserException.class, dataProvider="invalidIntervalTestData")
public void testInvalidBedIntervalHandling(GenomeAnalysisEngine testEngine, GenomeLocParser genomeLocParser, public void testInvalidBedIntervalHandling(GenomeAnalysisEngine testEngine, GenomeLocParser genomeLocParser,
String contig, int intervalStart, int intervalEnd ) throws Exception { String contig, int intervalStart, int intervalEnd ) throws Exception {
@ -126,10 +117,10 @@ public class GenomeAnalysisEngineUnitTest extends BaseTest {
File bedFile = createTempFile("testInvalidBedIntervalHandling", ".bed", File bedFile = createTempFile("testInvalidBedIntervalHandling", ".bed",
String.format("%s %d %d", contig, intervalStart -1, intervalEnd)); String.format("%s %d %d", contig, intervalStart -1, intervalEnd));
List<String> intervalArgs = Arrays.asList(bedFile.getAbsolutePath()); List<IntervalBinding<Feature>> intervalArgs = new ArrayList<IntervalBinding<Feature>>(1);
List<GenomeLoc> rodIntervals = new ArrayList<GenomeLoc>(); intervalArgs.add(new IntervalBinding<Feature>(bedFile.getAbsolutePath()));
testEngine.loadIntervals(intervalArgs, rodIntervals); testEngine.loadIntervals(intervalArgs, IntervalSetRule.UNION);
} }
@Test(expectedExceptions=UserException.class, dataProvider="invalidIntervalTestData") @Test(expectedExceptions=UserException.class, dataProvider="invalidIntervalTestData")
@ -144,10 +135,10 @@ public class GenomeAnalysisEngineUnitTest extends BaseTest {
File picardIntervalFile = createTempFile("testInvalidPicardIntervalHandling", ".intervals"); File picardIntervalFile = createTempFile("testInvalidPicardIntervalHandling", ".intervals");
picardIntervals.write(picardIntervalFile); picardIntervals.write(picardIntervalFile);
List<String> intervalArgs = Arrays.asList(picardIntervalFile.getAbsolutePath()); List<IntervalBinding<Feature>> intervalArgs = new ArrayList<IntervalBinding<Feature>>(1);
List<GenomeLoc> rodIntervals = new ArrayList<GenomeLoc>(); intervalArgs.add(new IntervalBinding<Feature>(picardIntervalFile.getAbsolutePath()));
testEngine.loadIntervals(intervalArgs, rodIntervals); testEngine.loadIntervals(intervalArgs, IntervalSetRule.UNION);
} }
@Test(expectedExceptions=UserException.class, dataProvider="invalidIntervalTestData") @Test(expectedExceptions=UserException.class, dataProvider="invalidIntervalTestData")
@ -157,10 +148,10 @@ public class GenomeAnalysisEngineUnitTest extends BaseTest {
File gatkIntervalFile = createTempFile("testInvalidGATKFileIntervalHandling", ".intervals", File gatkIntervalFile = createTempFile("testInvalidGATKFileIntervalHandling", ".intervals",
String.format("%s:%d-%d", contig, intervalStart, intervalEnd)); String.format("%s:%d-%d", contig, intervalStart, intervalEnd));
List<String> intervalArgs = Arrays.asList(gatkIntervalFile.getAbsolutePath()); List<IntervalBinding<Feature>> intervalArgs = new ArrayList<IntervalBinding<Feature>>(1);
List<GenomeLoc> rodIntervals = new ArrayList<GenomeLoc>(); intervalArgs.add(new IntervalBinding<Feature>(gatkIntervalFile.getAbsolutePath()));
testEngine.loadIntervals(intervalArgs, rodIntervals); testEngine.loadIntervals(intervalArgs, IntervalSetRule.UNION);
} }
private File createTempFile( String tempFilePrefix, String tempFileExtension, String... lines ) throws Exception { private File createTempFile( String tempFilePrefix, String tempFileExtension, String... lines ) throws Exception {

View File

@ -1,6 +1,8 @@
package org.broadinstitute.sting.gatk.arguments; package org.broadinstitute.sting.gatk.arguments;
import org.broad.tribble.Feature;
import org.broadinstitute.sting.BaseTest; import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.commandline.IntervalBinding;
import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -84,9 +86,9 @@ public class GATKArgumentCollectionUnitTest extends BaseTest {
collect.unsafe = ValidationExclusion.TYPE.ALL; collect.unsafe = ValidationExclusion.TYPE.ALL;
collect.downsampleFraction = null; collect.downsampleFraction = null;
collect.downsampleCoverage = null; collect.downsampleCoverage = null;
collect.intervals = new ArrayList<String>(); collect.intervals = new ArrayList<IntervalBinding<Feature>>();
collect.intervals.add("intervals".toLowerCase()); collect.intervals.add(new IntervalBinding<Feature>("intervals".toLowerCase()));
collect.excludeIntervals = new ArrayList<String>(); collect.excludeIntervals = new ArrayList<IntervalBinding<Feature>>();
collect.numberOfThreads = 1; collect.numberOfThreads = 1;
} }

View File

@ -48,19 +48,20 @@ public class IntervalIntegrationTest extends WalkerTest {
executeTest("testAllIntervalsImplicit",spec); executeTest("testAllIntervalsImplicit",spec);
} }
@Test(enabled = true) // '-L all' is no longer supported
public void testAllExplicitIntervalParsing() { // @Test(enabled = true)
String md5 = "7821db9e14d4f8e07029ff1959cd5a99"; // public void testAllExplicitIntervalParsing() {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( // String md5 = "7821db9e14d4f8e07029ff1959cd5a99";
"-T CountLoci" + // WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
" -I " + validationDataLocation + "OV-0930.normal.chunk.bam" + // "-T CountLoci" +
" -R " + hg18Reference + // " -I " + validationDataLocation + "OV-0930.normal.chunk.bam" +
" -L all" + // " -R " + hg18Reference +
" -o %s", // " -L all" +
1, // just one output file // " -o %s",
Arrays.asList(md5)); // 1, // just one output file
executeTest("testAllIntervalsExplicit",spec); // Arrays.asList(md5));
} // executeTest("testAllIntervalsExplicit",spec);
// }
@Test @Test
public void testUnmappedReadInclusion() { public void testUnmappedReadInclusion() {
@ -102,5 +103,62 @@ public class IntervalIntegrationTest extends WalkerTest {
executeTest("testUnmappedReadExclusion",spec); executeTest("testUnmappedReadExclusion",spec);
} }
@Test(enabled = true)
public void testIntervalParsingFromFile() {
String md5 = "48a24b70a0b376535542b996af517398";
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
"-T CountLoci" +
" -I " + validationDataLocation + "OV-0930.normal.chunk.bam" +
" -R " + hg18Reference +
" -o %s" +
" -L " + validationDataLocation + "intervalTest.1.vcf",
1, // just one output file
Arrays.asList(md5));
executeTest("testIntervalParsingFromFile", spec);
}
@Test(enabled = true)
public void testIntervalMergingFromFiles() {
String md5 = "9ae0ea9e3c9c6e1b9b6252c8395efdc1";
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
"-T CountLoci" +
" -I " + validationDataLocation + "OV-0930.normal.chunk.bam" +
" -R " + hg18Reference +
" -o %s" +
" -L " + validationDataLocation + "intervalTest.1.vcf" +
" -L " + validationDataLocation + "intervalTest.2.vcf",
1, // just one output file
Arrays.asList(md5));
executeTest("testIntervalMergingFromFiles", spec);
}
@Test(enabled = true)
public void testIntervalExclusionsFromFiles() {
String md5 = "26ab0db90d72e28ad0ba1e22ee510510";
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.2.vcf",
1, // just one output file
Arrays.asList(md5));
executeTest("testIntervalExclusionsFromFiles", spec);
}
@Test(enabled = true)
public void testMixedIntervalMerging() {
String md5 = "7c5aba41f53293b712fd86d08ed5b36e";
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
"-T CountLoci" +
" -I " + validationDataLocation + "OV-0930.normal.chunk.bam" +
" -R " + hg18Reference +
" -o %s" +
" -L " + validationDataLocation + "intervalTest.1.vcf" +
" -L chr1:1677524-1677528",
1, // just one output file
Arrays.asList(md5));
executeTest("testMixedIntervalMerging", spec);
}
} }

View File

@ -69,7 +69,7 @@ public class IntervalUtilsUnitTest extends BaseTest {
hg19GenomeLocParser = new GenomeLocParser(seq); hg19GenomeLocParser = new GenomeLocParser(seq);
hg19ReferenceLocs = Collections.unmodifiableList(GenomeLocSortedSet.createSetFromSequenceDictionary(referenceDataSource.getReference().getSequenceDictionary()).toList()) ; hg19ReferenceLocs = Collections.unmodifiableList(GenomeLocSortedSet.createSetFromSequenceDictionary(referenceDataSource.getReference().getSequenceDictionary()).toList()) ;
hg19exomeIntervals = Collections.unmodifiableList(IntervalUtils.parseIntervalArguments(hg19GenomeLocParser, Arrays.asList(hg19Intervals), false)); hg19exomeIntervals = Collections.unmodifiableList(IntervalUtils.parseIntervalArguments(hg19GenomeLocParser, Arrays.asList(hg19Intervals)));
} }
catch(FileNotFoundException ex) { catch(FileNotFoundException ex) {
throw new UserException.CouldNotReadInputFile(hg19Ref,ex); throw new UserException.CouldNotReadInputFile(hg19Ref,ex);
@ -235,9 +235,9 @@ public class IntervalUtilsUnitTest extends BaseTest {
List<List<GenomeLoc>> splits = IntervalUtils.splitFixedIntervals(locs, files.size()); List<List<GenomeLoc>> splits = IntervalUtils.splitFixedIntervals(locs, files.size());
IntervalUtils.scatterFixedIntervals(hg18Header, splits, files); IntervalUtils.scatterFixedIntervals(hg18Header, splits, files);
List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()), false); List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()));
List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()), false); List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()));
List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()), false); List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()));
Assert.assertEquals(locs1.size(), 1); Assert.assertEquals(locs1.size(), 1);
Assert.assertEquals(locs2.size(), 1); Assert.assertEquals(locs2.size(), 1);
@ -261,9 +261,9 @@ public class IntervalUtilsUnitTest extends BaseTest {
List<List<GenomeLoc>> splits = IntervalUtils.splitFixedIntervals(locs, files.size()); List<List<GenomeLoc>> splits = IntervalUtils.splitFixedIntervals(locs, files.size());
IntervalUtils.scatterFixedIntervals(hg18Header, splits, files); IntervalUtils.scatterFixedIntervals(hg18Header, splits, files);
List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()), false); List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()));
List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()), false); List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()));
List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()), false); List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()));
Assert.assertEquals(locs1.size(), 1); Assert.assertEquals(locs1.size(), 1);
Assert.assertEquals(locs2.size(), 1); Assert.assertEquals(locs2.size(), 1);
@ -303,9 +303,9 @@ public class IntervalUtilsUnitTest extends BaseTest {
List<List<GenomeLoc>> splits = IntervalUtils.splitFixedIntervals(locs, files.size()); List<List<GenomeLoc>> splits = IntervalUtils.splitFixedIntervals(locs, files.size());
IntervalUtils.scatterFixedIntervals(hg18Header, splits, files); IntervalUtils.scatterFixedIntervals(hg18Header, splits, files);
List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()), false); List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()));
List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()), false); List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()));
List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()), false); List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()));
Assert.assertEquals(locs1.size(), 1); Assert.assertEquals(locs1.size(), 1);
Assert.assertEquals(locs2.size(), 1); Assert.assertEquals(locs2.size(), 1);
@ -331,9 +331,9 @@ public class IntervalUtilsUnitTest extends BaseTest {
List<List<GenomeLoc>> splits = IntervalUtils.splitFixedIntervals(locs, files.size()); List<List<GenomeLoc>> splits = IntervalUtils.splitFixedIntervals(locs, files.size());
IntervalUtils.scatterFixedIntervals(hg18Header, splits, files); IntervalUtils.scatterFixedIntervals(hg18Header, splits, files);
List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()), false); List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()));
List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()), false); List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()));
List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()), false); List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()));
Assert.assertEquals(locs1.size(), 1); Assert.assertEquals(locs1.size(), 1);
Assert.assertEquals(locs2.size(), 1); Assert.assertEquals(locs2.size(), 1);
@ -359,9 +359,9 @@ public class IntervalUtilsUnitTest extends BaseTest {
List<List<GenomeLoc>> splits = IntervalUtils.splitFixedIntervals(locs, files.size()); List<List<GenomeLoc>> splits = IntervalUtils.splitFixedIntervals(locs, files.size());
IntervalUtils.scatterFixedIntervals(hg18Header, splits, files); IntervalUtils.scatterFixedIntervals(hg18Header, splits, files);
List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()), false); List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()));
List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()), false); List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()));
List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()), false); List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()));
Assert.assertEquals(locs1.size(), 2); Assert.assertEquals(locs1.size(), 2);
Assert.assertEquals(locs2.size(), 1); Assert.assertEquals(locs2.size(), 1);
@ -376,7 +376,7 @@ public class IntervalUtilsUnitTest extends BaseTest {
@Test @Test
public void testScatterFixedIntervalsFile() { public void testScatterFixedIntervalsFile() {
List<File> files = testFiles("sg.", 20, ".intervals"); List<File> files = testFiles("sg.", 20, ".intervals");
List<GenomeLoc> locs = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(BaseTest.GATKDataLocation + "whole_exome_agilent_designed_120.targets.hg18.chr20.interval_list"), false); List<GenomeLoc> locs = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(BaseTest.GATKDataLocation + "whole_exome_agilent_designed_120.targets.hg18.chr20.interval_list"));
List<List<GenomeLoc>> splits = IntervalUtils.splitFixedIntervals(locs, files.size()); List<List<GenomeLoc>> splits = IntervalUtils.splitFixedIntervals(locs, files.size());
int[] counts = { int[] counts = {
@ -401,7 +401,7 @@ public class IntervalUtilsUnitTest extends BaseTest {
int locIndex = 0; int locIndex = 0;
for (int i = 0; i < files.size(); i++) { for (int i = 0; i < files.size(); i++) {
String file = files.get(i).toString(); String file = files.get(i).toString();
List<GenomeLoc> parsedLocs = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(file), false); List<GenomeLoc> parsedLocs = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(file));
Assert.assertEquals(parsedLocs.size(), counts[i], "Intervals in " + file); Assert.assertEquals(parsedLocs.size(), counts[i], "Intervals in " + file);
for (GenomeLoc parsedLoc: parsedLocs) for (GenomeLoc parsedLoc: parsedLocs)
Assert.assertEquals(parsedLoc, locs.get(locIndex), String.format("Genome loc %d from file %d", locIndex++, i)); Assert.assertEquals(parsedLoc, locs.get(locIndex), String.format("Genome loc %d from file %d", locIndex++, i));
@ -417,7 +417,7 @@ public class IntervalUtilsUnitTest extends BaseTest {
for (int i = 0; i < files.size(); i++) { for (int i = 0; i < files.size(); i++) {
String file = files.get(i).toString(); String file = files.get(i).toString();
List<GenomeLoc> parsedLocs = IntervalUtils.parseIntervalArguments(hg19GenomeLocParser, Arrays.asList(file), false); List<GenomeLoc> parsedLocs = IntervalUtils.parseIntervalArguments(hg19GenomeLocParser, Arrays.asList(file));
Assert.assertEquals(parsedLocs.size(), 1, "parsedLocs[" + i + "].size()"); Assert.assertEquals(parsedLocs.size(), 1, "parsedLocs[" + i + "].size()");
Assert.assertEquals(parsedLocs.get(0), hg19ReferenceLocs.get(i), "parsedLocs[" + i + "].get()"); Assert.assertEquals(parsedLocs.get(0), hg19ReferenceLocs.get(i), "parsedLocs[" + i + "].get()");
} }
@ -434,9 +434,9 @@ public class IntervalUtilsUnitTest extends BaseTest {
IntervalUtils.scatterContigIntervals(hg18Header, getLocs(intervals), files); IntervalUtils.scatterContigIntervals(hg18Header, getLocs(intervals), files);
List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()), false); List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()));
List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()), false); List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()));
List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()), false); List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()));
Assert.assertEquals(locs1.size(), 1); Assert.assertEquals(locs1.size(), 1);
Assert.assertEquals(locs2.size(), 1); Assert.assertEquals(locs2.size(), 1);
@ -457,9 +457,9 @@ public class IntervalUtilsUnitTest extends BaseTest {
IntervalUtils.scatterContigIntervals(hg18Header, getLocs("chr1", "chr2", "chr3"), files); IntervalUtils.scatterContigIntervals(hg18Header, getLocs("chr1", "chr2", "chr3"), files);
List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()), false); List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()));
List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()), false); List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()));
List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()), false); List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()));
Assert.assertEquals(locs1.size(), 1); Assert.assertEquals(locs1.size(), 1);
Assert.assertEquals(locs2.size(), 1); Assert.assertEquals(locs2.size(), 1);
@ -481,9 +481,9 @@ public class IntervalUtilsUnitTest extends BaseTest {
IntervalUtils.scatterContigIntervals(hg18Header, getLocs("chr1", "chr2", "chr3", "chr4"), files); IntervalUtils.scatterContigIntervals(hg18Header, getLocs("chr1", "chr2", "chr3", "chr4"), files);
List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()), false); List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()));
List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()), false); List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()));
List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()), false); List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()));
Assert.assertEquals(locs1.size(), 1); Assert.assertEquals(locs1.size(), 1);
Assert.assertEquals(locs2.size(), 1); Assert.assertEquals(locs2.size(), 1);
@ -513,9 +513,9 @@ public class IntervalUtilsUnitTest extends BaseTest {
IntervalUtils.scatterContigIntervals(hg18Header, getLocs(intervals), files); IntervalUtils.scatterContigIntervals(hg18Header, getLocs(intervals), files);
List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()), false); List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()));
List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()), false); List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()));
List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()), false); List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()));
Assert.assertEquals(locs1.size(), 2); Assert.assertEquals(locs1.size(), 2);
Assert.assertEquals(locs2.size(), 1); Assert.assertEquals(locs2.size(), 1);
@ -539,9 +539,9 @@ public class IntervalUtilsUnitTest extends BaseTest {
IntervalUtils.scatterContigIntervals(hg18Header, getLocs(intervals), files); IntervalUtils.scatterContigIntervals(hg18Header, getLocs(intervals), files);
List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()), false); List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()));
List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()), false); List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()));
List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()), false); List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()));
Assert.assertEquals(locs1.size(), 1); Assert.assertEquals(locs1.size(), 1);
Assert.assertEquals(locs2.size(), 2); Assert.assertEquals(locs2.size(), 2);
@ -565,9 +565,9 @@ public class IntervalUtilsUnitTest extends BaseTest {
IntervalUtils.scatterContigIntervals(hg18Header, getLocs(intervals), files); IntervalUtils.scatterContigIntervals(hg18Header, getLocs(intervals), files);
List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()), false); List<GenomeLoc> locs1 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(0).toString()));
List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()), false); List<GenomeLoc> locs2 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(1).toString()));
List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()), false); List<GenomeLoc> locs3 = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Arrays.asList(files.get(2).toString()));
Assert.assertEquals(locs1.size(), 1); Assert.assertEquals(locs1.size(), 1);
Assert.assertEquals(locs2.size(), 1); Assert.assertEquals(locs2.size(), 1);
@ -586,7 +586,7 @@ public class IntervalUtilsUnitTest extends BaseTest {
for (int i = 0; i < files.size(); i++) { for (int i = 0; i < files.size(); i++) {
String file = files.get(i).toString(); String file = files.get(i).toString();
List<GenomeLoc> parsedLocs = IntervalUtils.parseIntervalArguments(hg19GenomeLocParser, Arrays.asList(file), false); List<GenomeLoc> parsedLocs = IntervalUtils.parseIntervalArguments(hg19GenomeLocParser, Arrays.asList(file));
Assert.assertEquals(parsedLocs.size(), 1, "parsedLocs[" + i + "].size()"); Assert.assertEquals(parsedLocs.size(), 1, "parsedLocs[" + i + "].size()");
Assert.assertEquals(parsedLocs.get(0), hg19ReferenceLocs.get(i), "parsedLocs[" + i + "].get()"); Assert.assertEquals(parsedLocs.get(0), hg19ReferenceLocs.get(i), "parsedLocs[" + i + "].get()");
} }
@ -610,7 +610,7 @@ public class IntervalUtilsUnitTest extends BaseTest {
@Test(dataProvider="unmergedIntervals") @Test(dataProvider="unmergedIntervals")
public void testUnmergedIntervals(String unmergedIntervals) { public void testUnmergedIntervals(String unmergedIntervals) {
List<GenomeLoc> locs = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Collections.singletonList(validationDataLocation + unmergedIntervals), false); List<GenomeLoc> locs = IntervalUtils.parseIntervalArguments(hg18GenomeLocParser, Collections.singletonList(validationDataLocation + unmergedIntervals));
Assert.assertEquals(locs.size(), 2); Assert.assertEquals(locs.size(), 2);
List<GenomeLoc> merged = IntervalUtils.mergeIntervalLocations(locs, IntervalMergingRule.ALL); List<GenomeLoc> merged = IntervalUtils.mergeIntervalLocations(locs, IntervalMergingRule.ALL);

View File

@ -48,7 +48,7 @@ case class GATKIntervals(reference: File, intervals: List[String]) {
if (intervals.isEmpty) if (intervals.isEmpty)
GenomeLocSortedSet.createSetFromSequenceDictionary(samFileHeader.getSequenceDictionary).toList GenomeLocSortedSet.createSetFromSequenceDictionary(samFileHeader.getSequenceDictionary).toList
else else
IntervalUtils.parseIntervalArguments(parser, intervals, false) IntervalUtils.parseIntervalArguments(parser, intervals)
Collections.sort(parsedLocs) Collections.sort(parsedLocs)
Collections.unmodifiableList(parsedLocs) Collections.unmodifiableList(parsedLocs)
} }

View File

@ -69,8 +69,6 @@ trait GATKScatterFunction extends ScatterFunction {
} }
override def isScatterGatherable = { override def isScatterGatherable = {
if (this.originalGATK.BTI != null && this.originalGATK.BTIMR == null)
throw new IllegalArgumentException("BTI requires BTIMR for use with scatter-gather (recommended: INTERSECTION)")
this.originalGATK.reference_sequence != null this.originalGATK.reference_sequence != null
} }