use of org.testng.annotations.DataProvider in project gatk by broadinstitute.
the class SampleCollectionUnitTest method testSampleIndexByReadWithReadGroupWithoutSample.
@Test(dataProvider = "samFileHeaderData", dependsOnMethods = "testCreation")
public void testSampleIndexByReadWithReadGroupWithoutSample(final SAMFileHeader header) {
final String readGroup = header.getReadGroups().stream().filter(rg -> rg.getSample() == null).map(SAMReadGroupRecord::getId).findFirst().orElse(null);
if (readGroup == null)
return;
final SampleCollection sampleCollection = new SampleCollection(header);
final GATKRead read = ArtificialReadUtils.createRandomRead(header, 100);
if (sampleCollection.sampleCount() > 0) {
read.setReadGroup(readGroup);
Assert.assertEquals(sampleCollection.sampleIndexByRead(read), -1);
}
}
use of org.testng.annotations.DataProvider in project gatk by broadinstitute.
the class SampleCollectionUnitTest method testReadGroupIndexByReadWithReadGroupWithoutSample.
@Test(dataProvider = "samFileHeaderData", dependsOnMethods = "testCreation")
public void testReadGroupIndexByReadWithReadGroupWithoutSample(final SAMFileHeader header) {
final String readGroup = header.getReadGroups().stream().filter(rg -> rg.getSample() == null).map(SAMReadGroupRecord::getId).findFirst().orElse(null);
if (readGroup == null)
return;
final SampleCollection sampleCollection = new SampleCollection(header);
final GATKRead read = ArtificialReadUtils.createRandomRead(header, 100);
read.setReadGroup(readGroup);
Assert.assertEquals(sampleCollection.readGroupIndexByRead(read), sampleCollection.readGroupIndexById(readGroup));
}
use of org.testng.annotations.DataProvider in project gatk by broadinstitute.
the class GatherBamFilesIntegrationTest method gatherBAMTestData.
@DataProvider(name = "bamgathering")
public Object[][] gatherBAMTestData() {
final File origBam = new File(TEST_DATA_DIR, "orig.bam");
final List<File> splitBamsUnmappedLast = Arrays.asList(new File(TEST_DATA_DIR, "indchr1.bam"), new File(TEST_DATA_DIR, "indchr2.bam"), new File(TEST_DATA_DIR, "indchr3.bam"), new File(TEST_DATA_DIR, "indchr4.bam"), new File(TEST_DATA_DIR, "indchr5.bam"), new File(TEST_DATA_DIR, "indchr6.bam"), new File(TEST_DATA_DIR, "indchr7.bam"), new File(TEST_DATA_DIR, "indchr8.bam"), new File(TEST_DATA_DIR, "indUnknownChrom.bam"));
final List<File> splitBamsUnmappedFirst = Arrays.asList(new File(TEST_DATA_DIR, "indUnknownChrom.bam"), new File(TEST_DATA_DIR, "indchr1.bam"), new File(TEST_DATA_DIR, "indchr2.bam"), new File(TEST_DATA_DIR, "indchr3.bam"), new File(TEST_DATA_DIR, "indchr4.bam"), new File(TEST_DATA_DIR, "indchr5.bam"), new File(TEST_DATA_DIR, "indchr6.bam"), new File(TEST_DATA_DIR, "indchr7.bam"), new File(TEST_DATA_DIR, "indchr8.bam"));
final List<File> splitBamsUnmappedMissing = Arrays.asList(new File(TEST_DATA_DIR, "indchr1.bam"), new File(TEST_DATA_DIR, "indchr2.bam"), new File(TEST_DATA_DIR, "indchr3.bam"), new File(TEST_DATA_DIR, "indchr4.bam"), new File(TEST_DATA_DIR, "indchr5.bam"), new File(TEST_DATA_DIR, "indchr6.bam"), new File(TEST_DATA_DIR, "indchr7.bam"), new File(TEST_DATA_DIR, "indchr8.bam"));
return new Object[][] { { splitBamsUnmappedLast, origBam, true, true }, { splitBamsUnmappedFirst, origBam, false, true }, { splitBamsUnmappedMissing, origBam, false, false } };
}
use of org.testng.annotations.DataProvider in project gatk by broadinstitute.
the class IntervalsSkipListOneContigUnitTest method intervals.
@DataProvider(name = "intervals")
public Object[][] intervals() {
ArrayList<Locatable> input = Lists.newArrayList(new SimpleInterval("1", 10, 100));
ArrayList<Locatable> empty = new ArrayList<>();
ArrayList<Locatable> manyOverlapping = Lists.newArrayList(new SimpleInterval("1", 10, 100), // special case: multiple intervals starting at the same place
new SimpleInterval("1", 20, 50), new SimpleInterval("1", 20, 50), new SimpleInterval("1", 20, 50));
ArrayList<Locatable> mixInput = Lists.newArrayList(// ends before query interval
new SimpleInterval("1", 10, 20), // ends in query interval
new SimpleInterval("1", 10, 60), // equal to query interval
new SimpleInterval("1", 30, 50), // covered by query interval
new SimpleInterval("1", 40, 42), // ends after query interval
new SimpleInterval("1", 45, 60), // starts after query interval
new SimpleInterval("1", 60, 100));
ArrayList<Locatable> mixExpected = Lists.newArrayList(// ends in query interval
new SimpleInterval("1", 10, 60), // equal to query interval
new SimpleInterval("1", 30, 50), // covered by query interval
new SimpleInterval("1", 40, 42), // ends after query interval
new SimpleInterval("1", 45, 60));
// returns input single SimpleInterval, query range, expected SimpleInterval
return new Object[][] { // single-point boundary cases
new Object[] { input, new SimpleInterval("1", 10, 10), input }, new Object[] { input, new SimpleInterval("1", 100, 100), input }, new Object[] { input, new SimpleInterval("1", 9, 9), empty }, new Object[] { input, new SimpleInterval("1", 11, 11), input }, new Object[] { input, new SimpleInterval("1", 99, 99), input }, new Object[] { input, new SimpleInterval("1", 101, 101), empty }, // empty list boundary case
new Object[] { empty, new SimpleInterval("1", 101, 101), empty }, // different contig
new Object[] { empty, new SimpleInterval("2", 101, 101), empty }, // input exactly matches the query interval
new Object[] { input, new SimpleInterval("1", 10, 100), input }, // multiple intervals in the same place (potential edge case for indexing)
new Object[] { manyOverlapping, new SimpleInterval("1", 20, 20), manyOverlapping }, // input with multiple intervals
new Object[] { mixInput, new SimpleInterval("1", 30, 50), mixExpected } };
}
use of org.testng.annotations.DataProvider in project gatk by broadinstitute.
the class HomRefBlockUnitTest method makeContiguousData.
@DataProvider(name = "ContiguousData")
public Object[][] makeContiguousData() {
final List<Object[]> tests = new ArrayList<>();
final VariantContext vc = getVariantContext();
for (final String chrMod : Arrays.asList("", ".mismatch")) {
for (final int offset : Arrays.asList(-10, -1, 0, 1, 10)) {
final boolean equals = chrMod.isEmpty() && offset == 0;
tests.add(new Object[] { vc.getContig() + chrMod, vc.getStart() + offset, equals });
}
}
return tests.toArray(new Object[][] {});
}
Aggregations