use of htsjdk.samtools.fastq.FastqReader in project gatk by broadinstitute.
the class SamToFastqIntegrationTest method testTrimming.
@Test(dataProvider = "trimmedData")
public void testTrimming(final String samFilename, final int read1Trim, final int read1MaxBases, final int expectedRead1Length, final int read2Trim, final int read2MaxBases, final int expectedRead2Length) throws IOException {
final File samFile = new File(TEST_DATA_DIR, samFilename);
final File pair1File = newTempFastqFile("pair1");
final File pair2File = newTempFastqFile("pair2");
convertFile(new String[] { "--input", samFile.getAbsolutePath(), "--FASTQ", pair1File.getAbsolutePath(), "--SECOND_END_FASTQ", pair2File.getAbsolutePath(), "--READ1_TRIM", Integer.toString(read1Trim), "--READ1_MAX_BASES_TO_WRITE", Integer.toString(read1MaxBases), "--READ2_TRIM", Integer.toString(read2Trim), "--READ2_MAX_BASES_TO_WRITE", Integer.toString(read2MaxBases) });
for (final FastqRecord first : new FastqReader(pair1File)) {
Assert.assertEquals(first.getReadString().length(), expectedRead1Length, "Incorrect read length");
Assert.assertEquals(first.getBaseQualityString().length(), expectedRead1Length, "Incorrect quality string length");
}
for (final FastqRecord second : new FastqReader(pair2File)) {
Assert.assertEquals(second.getReadString().length(), expectedRead2Length, "Incorrect read length");
Assert.assertEquals(second.getBaseQualityString().length(), expectedRead2Length, "Incorrect quality string length");
}
}
Aggregations