use of org.broadinstitute.hellbender.utils.read.SAMRecordToGATKReadAdapter in project gatk by broadinstitute.
the class ReadFilterLibraryUnitTest method failsVALID_ALIGNMENT_START.
@Test
public void failsVALID_ALIGNMENT_START() {
final SAMFileHeader header = createHeaderWithReadGroups();
final GATKRead read = simpleGoodRead(header);
// GATKRead interface will not let us set invalid alignment starts,
final SAMRecord corruptSAM = read.convertToSAMRecord(header);
// so we need to convert to SAMRecord here
corruptSAM.setAlignmentStart(-1);
Assert.assertFalse(VALID_ALIGNMENT_START.test(new SAMRecordToGATKReadAdapter(corruptSAM)), read.toString());
}
use of org.broadinstitute.hellbender.utils.read.SAMRecordToGATKReadAdapter in project gatk by broadinstitute.
the class ReadsSparkSourceUnitTest method testHeadersAreStripped.
@Test(groups = "spark")
public void testHeadersAreStripped() {
JavaSparkContext ctx = SparkContextFactory.getTestSparkContext();
ReadsSparkSource readSource = new ReadsSparkSource(ctx);
final List<GATKRead> reads = readSource.getParallelReads(dirBQSR + "HiSeq.1mb.1RG.2k_lines.alternate.bam", null).collect();
for (final GATKRead read : reads) {
Assert.assertNull(((SAMRecordToGATKReadAdapter) read).getEncapsulatedSamRecord().getHeader(), "ReadSparkSource failed to null out header for read");
}
}
use of org.broadinstitute.hellbender.utils.read.SAMRecordToGATKReadAdapter in project gatk by broadinstitute.
the class CollectQualityYieldMetrics method doWork.
/**
* Main method for the program. Checks that all input files are present and
* readable and that the output file can be written to. Then iterates through
* all the records accumulating metrics. Finally writes metrics file
*/
@Override
protected Object doWork() {
final ProgressLogger progress = new ProgressLogger(logger);
File output = new File(qualityYieldMetricsArgs.output);
// Some quick parameter checking
IOUtil.assertFileIsReadable(INPUT);
IOUtil.assertFileIsWritable(output);
logger.info("Reading input file and calculating metrics.");
final SamReader sam = SamReaderFactory.makeDefault().referenceSequence(REFERENCE_SEQUENCE).open(INPUT);
final MetricsFile<QualityYieldMetrics, Integer> metricsFile = getMetricsFile();
final QualityYieldMetrics metrics = new QualityYieldMetrics();
metrics.setUseOriginalQualities(qualityYieldMetricsArgs.useOriginalQualities);
for (final SAMRecord rec : sam) {
metrics.addRead(new SAMRecordToGATKReadAdapter(rec));
progress.record(rec);
}
metrics.finish();
metricsFile.addMetric(metrics);
metricsFile.write(output);
return null;
}
Aggregations