use of htsjdk.samtools.SAMFileHeader in project gatk by broadinstitute.
the class BaseQualitySumPerAlleleBySampleUnitTest method testUsableRead.
@Test
public void testUsableRead() {
final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader(5, 1, 10000);
final GATKRead read = ArtificialReadUtils.createArtificialRead(header, "myRead", 0, 1, 76);
read.setMappingQuality(60);
Assert.assertTrue(BaseQualitySumPerAlleleBySample.isUsableRead(read));
read.setMappingQuality(0);
Assert.assertFalse(BaseQualitySumPerAlleleBySample.isUsableRead(read));
read.setMappingQuality(QualityUtils.MAPPING_QUALITY_UNAVAILABLE);
Assert.assertFalse(BaseQualitySumPerAlleleBySample.isUsableRead(read));
}
use of htsjdk.samtools.SAMFileHeader in project gatk by broadinstitute.
the class ReadUtilsUnitTest method readsWithReadGroupData.
@DataProvider(name = "ReadsWithReadGroupData")
public Object[][] readsWithReadGroupData() {
final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader(2, 1, 1000000);
final SAMReadGroupRecord readGroup = new SAMReadGroupRecord("FOO");
readGroup.setPlatform("FOOPLATFORM");
readGroup.setPlatformUnit("FOOPLATFORMUNIT");
readGroup.setLibrary("FOOLIBRARY");
readGroup.setSample("FOOSAMPLE");
header.addReadGroup(readGroup);
final GATKRead googleBackedRead = new GoogleGenomicsReadToGATKReadAdapter(ArtificialReadUtils.createArtificialGoogleGenomicsRead("google", "1", 5, new byte[] { 'A', 'C', 'G', 'T' }, new byte[] { 1, 2, 3, 4 }, "4M"));
googleBackedRead.setReadGroup("FOO");
final GATKRead samBackedRead = new SAMRecordToGATKReadAdapter(ArtificialReadUtils.createArtificialSAMRecord(header, "sam", header.getSequenceIndex("1"), 5, new byte[] { 'A', 'C', 'G', 'T' }, new byte[] { 1, 2, 3, 4 }, "4M"));
samBackedRead.setReadGroup("FOO");
return new Object[][] { { googleBackedRead, header, "FOO" }, { samBackedRead, header, "FOO" } };
}
use of htsjdk.samtools.SAMFileHeader in project gatk by broadinstitute.
the class ReadUtilsUnitTest method testReadWithNsRefIndexInDeletion.
@Test
public void testReadWithNsRefIndexInDeletion() throws FileNotFoundException {
final IndexedFastaSequenceFile seq = new CachingIndexedFastaSequenceFile(new File(exampleReference));
final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader(seq.getSequenceDictionary());
final int readLength = 76;
final GATKRead read = ArtificialReadUtils.createArtificialRead(header, "myRead", 0, 8975, readLength);
read.setBases(Utils.dupBytes((byte) 'A', readLength));
read.setBaseQualities(Utils.dupBytes((byte) 30, readLength));
read.setCigar("3M414N1D73M");
final int result = ReadUtils.getReadCoordinateForReferenceCoordinateUpToEndOfRead(read, 9392, ReadUtils.ClippingTail.LEFT_TAIL);
Assert.assertEquals(result, 2);
}
use of htsjdk.samtools.SAMFileHeader in project gatk by broadinstitute.
the class ReadUtilsUnitTest method testGetSamplesFromHeaderNoReadGroups.
@Test
public void testGetSamplesFromHeaderNoReadGroups() {
final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader(5, 1, 100);
Assert.assertTrue(header.getReadGroups().isEmpty());
Assert.assertTrue(ReadUtils.getSamplesFromHeader(header).isEmpty(), "Non-empty Set returned from ReadUtils.getSamplesFromHeader() for a header with no read groups");
}
use of htsjdk.samtools.SAMFileHeader in project gatk by broadinstitute.
the class ReadUtilsUnitTest method referenceIndexTestData.
@DataProvider(name = "ReferenceIndexTestData")
public Object[][] referenceIndexTestData() {
final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader(2, 1, 1000000);
final GATKRead googleBackedRead = new GoogleGenomicsReadToGATKReadAdapter(ArtificialReadUtils.createArtificialGoogleGenomicsRead("google", "2", 5, new byte[] { 'A', 'C', 'G', 'T' }, new byte[] { 1, 2, 3, 4 }, "4M"));
googleBackedRead.setMatePosition("1", 1);
final GATKRead samBackedRead = new SAMRecordToGATKReadAdapter(ArtificialReadUtils.createArtificialSAMRecord(header, "sam", header.getSequenceIndex("2"), 5, new byte[] { 'A', 'C', 'G', 'T' }, new byte[] { 1, 2, 3, 4 }, "4M"));
samBackedRead.setMatePosition("1", 5);
final GATKRead unmappedGoogleBackedRead = new GoogleGenomicsReadToGATKReadAdapter(ArtificialReadUtils.createArtificialGoogleGenomicsRead("google", "1", 5, new byte[] { 'A', 'C', 'G', 'T' }, new byte[] { 1, 2, 3, 4 }, "4M"));
unmappedGoogleBackedRead.setIsUnmapped();
unmappedGoogleBackedRead.setMateIsUnmapped();
final GATKRead unmappedSamBackedRead = new SAMRecordToGATKReadAdapter(ArtificialReadUtils.createArtificialSAMRecord(header, "sam", header.getSequenceIndex("1"), 5, new byte[] { 'A', 'C', 'G', 'T' }, new byte[] { 1, 2, 3, 4 }, "4M"));
unmappedSamBackedRead.setIsUnmapped();
unmappedSamBackedRead.setMateIsUnmapped();
return new Object[][] { { googleBackedRead, header, 1, 0 }, { samBackedRead, header, 1, 0 }, { unmappedGoogleBackedRead, header, -1, -1 }, { unmappedSamBackedRead, header, -1, -1 } };
}
Aggregations