use of htsjdk.samtools.SAMReadGroupRecord 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.SAMReadGroupRecord in project gatk by broadinstitute.
the class ReadUtilsUnitTest method testReadGroupOperations.
@Test(dataProvider = "ReadsWithReadGroupData")
public void testReadGroupOperations(final GATKRead read, final SAMFileHeader header, final String expectedReadGroupID) {
final SAMReadGroupRecord readGroup = ReadUtils.getSAMReadGroupRecord(read, header);
Assert.assertEquals(readGroup.getId(), expectedReadGroupID, "Wrong read group returned from ReadUtils.getSAMReadGroupRecord()");
Assert.assertEquals(ReadUtils.getPlatform(read, header), readGroup.getPlatform(), "Wrong platform returned from ReadUtils.getPlatform()");
Assert.assertEquals(ReadUtils.getPlatformUnit(read, header), readGroup.getPlatformUnit(), "Wrong platform unit returned from ReadUtils.getPlatformUnit()");
Assert.assertEquals(ReadUtils.getLibrary(read, header), readGroup.getLibrary(), "Wrong library returned from ReadUtils.getLibrary()");
Assert.assertEquals(ReadUtils.getSampleName(read, header), readGroup.getSample(), "Wrong sample name returned from ReadUtils.getSampleName()");
}
use of htsjdk.samtools.SAMReadGroupRecord in project gatk by broadinstitute.
the class ReadUtilsUnitTest method testGetSamplesFromHeaderNoSamples.
@Test
public void testGetSamplesFromHeaderNoSamples() {
final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader(5, 1, 100);
header.setReadGroups(Arrays.asList(new SAMReadGroupRecord("ReadGroup1")));
Assert.assertEquals(header.getReadGroups().size(), 1);
Assert.assertNull(header.getReadGroups().get(0).getSample());
Assert.assertTrue(ReadUtils.getSamplesFromHeader(header).isEmpty(), "Non-empty Set returned from ReadUtils.getSamplesFromHeader() for a header with no samples");
}
use of htsjdk.samtools.SAMReadGroupRecord in project gatk by broadinstitute.
the class ReadUtilsUnitTest method testGetSamplesFromHeader.
@Test
public void testGetSamplesFromHeader() {
final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader(5, 1, 100);
final List<SAMReadGroupRecord> readGroups = new ArrayList<>();
for (int i = 1; i <= 5; ++i) {
SAMReadGroupRecord readGroup = new SAMReadGroupRecord("ReadGroup" + i);
readGroup.setSample("Sample" + i);
readGroups.add(readGroup);
}
header.setReadGroups(readGroups);
final Set<String> samples = ReadUtils.getSamplesFromHeader(header);
Assert.assertEquals(samples.size(), 5, "Wrong number of samples returned from ReadUtils.getSamplesFromHeader()");
for (int i = 1; i <= 5; ++i) {
Assert.assertTrue(samples.contains("Sample" + i), "Missing Sample" + i + " in samples returned from ReadUtils.getSamplesFromHeader()");
}
}
use of htsjdk.samtools.SAMReadGroupRecord in project gatk by broadinstitute.
the class CycleCovariateUnitTest method init.
@BeforeClass
public void init() {
RAC = new RecalibrationArgumentCollection();
covariate = new CycleCovariate(RAC);
illuminaReadGroup = new SAMReadGroupRecord("MY.ID");
illuminaReadGroup.setPlatform("illumina");
}
Aggregations