Search in sources :

Example 1 with MetricsReadFilter

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;
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) BaseDistributionByCycleMetrics(org.broadinstitute.hellbender.tools.picard.analysis.BaseDistributionByCycleMetrics) MetricsReadFilter(org.broadinstitute.hellbender.engine.filters.MetricsReadFilter)

Example 2 with MetricsReadFilter

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);
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) MetricsReadFilter(org.broadinstitute.hellbender.engine.filters.MetricsReadFilter)

Example 3 with MetricsReadFilter

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());
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) MetricsReadFilter(org.broadinstitute.hellbender.engine.filters.MetricsReadFilter)

Aggregations

MetricsReadFilter (org.broadinstitute.hellbender.engine.filters.MetricsReadFilter)3 GATKRead (org.broadinstitute.hellbender.utils.read.GATKRead)3 BaseDistributionByCycleMetrics (org.broadinstitute.hellbender.tools.picard.analysis.BaseDistributionByCycleMetrics)1