use of org.broadinstitute.hellbender.engine.filters.MetricsReadFilter in project gatk by broadinstitute.
the class CollectBaseDistributionByCycleSpark method calculateBaseDistributionByCycle.
/**
* Computes the MeanQualityByCycle. Creates a metrics file with relevant histograms.
*/
public MetricsFile<BaseDistributionByCycleMetrics, Integer> calculateBaseDistributionByCycle(final JavaRDD<GATKRead> reads) {
final MetricsReadFilter metricsFilter = new MetricsReadFilter(this.pfReadsOnly, this.alignedReadsOnly);
final JavaRDD<GATKRead> filteredReads = reads.filter(read -> metricsFilter.test(read));
final HistogramGenerator hist = filteredReads.aggregate(new HistogramGenerator(), (hgp, read) -> hgp.addRead(read), (hgp1, hgp2) -> hgp1.merge(hgp2));
final MetricsFile<BaseDistributionByCycleMetrics, Integer> metricsFile = getMetricsFile();
hist.addToMetricsFile(metricsFile);
return metricsFile;
}
use of org.broadinstitute.hellbender.engine.filters.MetricsReadFilter in project gatk by broadinstitute.
the class MeanQualityByCycleSpark method calculateMeanQualityByCycle.
/**
* Computes the MeanQualityByCycle. Creates a metrics file with relevant histograms.
*/
public MetricsFile<?, Integer> calculateMeanQualityByCycle(final JavaRDD<GATKRead> reads) {
final MetricsReadFilter metricsFilter = new MetricsReadFilter(this.pfReadsOnly, this.alignedReadsOnly);
final JavaRDD<GATKRead> filteredReads = reads.filter(read -> metricsFilter.test(read));
final HistogramGeneratorPair aggregate = filteredReads.aggregate(new HistogramGeneratorPair(), (hgp, read) -> hgp.addRead(read), (hgp1, hgp2) -> hgp1.merge(hgp2));
return finish(aggregate.useQuals, aggregate.useOrigQuals);
}
use of org.broadinstitute.hellbender.engine.filters.MetricsReadFilter in project gatk by broadinstitute.
the class QualityScoreDistributionSpark method runTool.
@Override
protected void runTool(final JavaSparkContext ctx) {
final JavaRDD<GATKRead> reads = getReads();
final MetricsReadFilter metricsFilter = new MetricsReadFilter(this.pfReadsOnly, this.alignedReadsOnly);
final JavaRDD<GATKRead> filteredReads = reads.filter(read -> metricsFilter.test(read));
final Counts result = filteredReads.aggregate(new Counts(includeNoCalls), (counts, read) -> counts.addRead(read), (counts1, counts2) -> counts1.merge(counts2));
final MetricsFile<?, Byte> metrics = makeMetrics(result);
saveResults(metrics, getHeaderForReads(), getReadSourceName());
}
Aggregations