use of org.broadinstitute.hellbender.metrics.QualityYieldMetrics in project gatk by broadinstitute.
the class QualityYieldMetricsCollectorSpark method collectMetrics.
/**
* Do the actual metrics collection on the provided RDD.
* @param filteredReads The reads to be analyzed for this collector.
* @param samHeader The SAMFileHeader associated with the reads in the input RDD.
*/
@Override
public void collectMetrics(final JavaRDD<GATKRead> filteredReads, final SAMFileHeader samHeader) {
final QualityYieldMetrics metrics = filteredReads.aggregate(new QualityYieldMetrics().setUseOriginalQualities(args.useOriginalQualities), (hgp, read) -> hgp.addRead(read), (hgp1, hgp2) -> hgp1.combine(hgp2)).finish();
metricsFile.addMetric(metrics);
}
use of org.broadinstitute.hellbender.metrics.QualityYieldMetrics 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