use of htsjdk.samtools.fastq.FastqRecord in project gatk by broadinstitute.
the class SamToFastqIntegrationTest method createFastqReadHeaderSet.
private Set<String> createFastqReadHeaderSet(final File file) {
final Set<String> set = new HashSet<>();
final FastqReader freader = new FastqReader(file);
while (freader.hasNext()) {
final FastqRecord frec = freader.next();
set.add(frec.getReadName());
}
return set;
}
use of htsjdk.samtools.fastq.FastqRecord in project gatk by broadinstitute.
the class FastqToSam method doUnpaired.
/** Creates a simple SAM file from a single fastq file. */
protected int doUnpaired(final FastqReader freader, final SAMFileWriter writer) {
int readCount = 0;
final ProgressLogger progress = new ProgressLogger(LOG);
for (; freader.hasNext(); readCount++) {
final FastqRecord frec = freader.next();
final SAMRecord srec = createSamRecord(writer.getFileHeader(), getReadName(frec.getReadName(), false), frec, false);
srec.setReadPairedFlag(false);
writer.addAlignment(srec);
progress.record(srec);
}
writer.close();
return readCount;
}
use of htsjdk.samtools.fastq.FastqRecord in project gridss by PapenfussLab.
the class SplitReadIdentificationHelperTest method getSplitReadRealignments_should_consider_strand.
@Test
public void getSplitReadRealignments_should_consider_strand() {
SAMRecord r = Read(0, 1, "2S1M3S");
r.setReadBases(B("ACGTTC"));
r.setBaseQualities(B("123456"));
r.setReadName("r");
r.setReadNegativeStrandFlag(true);
List<FastqRecord> result = SplitReadIdentificationHelper.getSplitReadRealignments(r, false, getContext().getEvidenceIDGenerator());
assertEquals(2, result.size());
// SSSMSS cigar
// GAACGT read
// 654321 base qualities
// 012345 offset
assertEquals(getContext().getEvidenceIDGenerator().getAlignmentUniqueName(r) + "#4", result.get(0).getReadName());
assertEquals("GT", result.get(0).getReadString());
assertEquals(SAMUtils.phredToFastq(B("21")), result.get(0).getBaseQualityString());
assertEquals(getContext().getEvidenceIDGenerator().getAlignmentUniqueName(r) + "#0", result.get(1).getReadName());
assertEquals("GAA", result.get(1).getReadString());
assertEquals(SAMUtils.phredToFastq(B("654")), result.get(1).getBaseQualityString());
}
use of htsjdk.samtools.fastq.FastqRecord in project gridss by PapenfussLab.
the class SplitReadIdentificationHelperTest method getSplitReadRealignments_should_split_start.
@Test
public void getSplitReadRealignments_should_split_start() {
SAMRecord r = Read(0, 1, "2S4M");
r.setReadBases(B("ACGTTC"));
r.setBaseQualities(B("123456"));
List<FastqRecord> result = SplitReadIdentificationHelper.getSplitReadRealignments(r, false, getContext().getEvidenceIDGenerator());
assertEquals(1, result.size());
assertEquals("AC", result.get(0).getReadString());
assertEquals(SAMUtils.phredToFastq(B("12")), result.get(0).getBaseQualityString());
}
use of htsjdk.samtools.fastq.FastqRecord in project gridss by PapenfussLab.
the class SplitReadIdentificationHelperTest method getSplitReadRealignments_should_split_both_ends.
@Test
public void getSplitReadRealignments_should_split_both_ends() {
SAMRecord r = Read(0, 1, "2S1M3S");
r.setReadBases(B("ACGTTC"));
r.setBaseQualities(B("123456"));
List<FastqRecord> result = SplitReadIdentificationHelper.getSplitReadRealignments(r, false, getContext().getEvidenceIDGenerator());
assertEquals(2, result.size());
assertEquals("AC", result.get(0).getReadString());
assertEquals(SAMUtils.phredToFastq(B("12")), result.get(0).getBaseQualityString());
assertEquals("TTC", result.get(1).getReadString());
assertEquals(SAMUtils.phredToFastq(B("456")), result.get(1).getBaseQualityString());
}
Aggregations