use of org.broadinstitute.hellbender.utils.read.GATKRead in project gatk by broadinstitute.
the class ReadFilterLibraryUnitTest method testNotSupplementaryAlignmentReadFilter.
@Test
public void testNotSupplementaryAlignmentReadFilter() {
final SAMFileHeader header = createHeaderWithReadGroups();
final GATKRead read = simpleGoodRead(header);
read.setIsSupplementaryAlignment(false);
Assert.assertTrue(NOT_SUPPLEMENTARY_ALIGNMENT.test(read), "NOT_SUPPLEMENTARY_ALIGNMENT " + read.toString());
read.setIsSupplementaryAlignment(true);
Assert.assertFalse(NOT_SUPPLEMENTARY_ALIGNMENT.test(read), "NOT_SUPPLEMENTARY_ALIGNMENT " + read.toString());
}
use of org.broadinstitute.hellbender.utils.read.GATKRead in project gatk by broadinstitute.
the class ReadFilterLibraryUnitTest method mateOnSameContigOrNoMappedMateTestData.
@DataProvider(name = "MateOnSameContigOrNoMappedMateTestData")
public Object[][] mateOnSameContigOrNoMappedMateTestData() {
final SAMFileHeader header = createHeaderWithReadGroups();
final GATKRead unpairedRead = simpleGoodRead(header);
unpairedRead.setIsPaired(false);
final GATKRead pairedReadWithUnmappedMate = simpleGoodRead(header);
pairedReadWithUnmappedMate.setIsPaired(true);
pairedReadWithUnmappedMate.setMateIsUnmapped();
final GATKRead pairedReadWithMappedMateDifferentContig = simpleGoodRead(header);
pairedReadWithMappedMateDifferentContig.setIsPaired(true);
pairedReadWithMappedMateDifferentContig.setMatePosition("2", 1);
pairedReadWithMappedMateDifferentContig.setPosition("1", 1);
final GATKRead pairedReadWithMappedMateSameContig = simpleGoodRead(header);
pairedReadWithMappedMateSameContig.setIsPaired(true);
pairedReadWithMappedMateSameContig.setMatePosition("1", 100);
pairedReadWithMappedMateSameContig.setPosition("1", 1);
final GATKRead unmappedReadWithMappedMate = simpleGoodRead(header);
unmappedReadWithMappedMate.setIsUnmapped();
unmappedReadWithMappedMate.setIsPaired(true);
unmappedReadWithMappedMate.setMatePosition("1", 100);
final GATKRead unmappedReadWithUnmappedMate = simpleGoodRead(header);
unmappedReadWithUnmappedMate.setIsUnmapped();
unmappedReadWithUnmappedMate.setIsPaired(true);
unmappedReadWithUnmappedMate.setMateIsUnmapped();
final GATKRead unmappedUnpairedRead = simpleGoodRead(header);
unmappedUnpairedRead.setIsUnmapped();
unmappedUnpairedRead.setIsPaired(false);
return new Object[][] { { unpairedRead, true }, { pairedReadWithUnmappedMate, true }, { pairedReadWithMappedMateDifferentContig, false }, { pairedReadWithMappedMateSameContig, true }, { unmappedReadWithMappedMate, false }, { unmappedReadWithUnmappedMate, true }, { unmappedUnpairedRead, true } };
}
use of org.broadinstitute.hellbender.utils.read.GATKRead in project gatk by broadinstitute.
the class ReadFilterLibraryUnitTest method failsSEQ_IS_STORED.
@Test
public void failsSEQ_IS_STORED() {
final SAMFileHeader header = createHeaderWithReadGroups();
final GATKRead read = simpleGoodRead(header);
read.setBases(new byte[0]);
Assert.assertFalse(SEQ_IS_STORED.test(read), read.toString());
}
use of org.broadinstitute.hellbender.utils.read.GATKRead 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.broadinstitute.hellbender.utils.read.GATKRead in project gatk by broadinstitute.
the class SampleCollectionUnitTest method testSampleIndexByReadWithNonExistentReadGroup.
@Test(dataProvider = "samFileHeaderData", dependsOnMethods = "testCreation", expectedExceptions = IllegalArgumentException.class)
public void testSampleIndexByReadWithNonExistentReadGroup(final SAMFileHeader header) {
final SampleCollection sampleCollection = new SampleCollection(header);
final GATKRead read = ArtificialReadUtils.createRandomRead(header, 100);
read.setReadGroup("NON_EXISTENT");
Assert.assertEquals(sampleCollection.sampleIndexByRead(read), -1);
}
Aggregations