public IndividualAlignmentSummaryMetricsCollector( final AlignmentSummaryMetrics.Category pairingCategory, final String sample, final String library, final String readGroup) { metrics = new AlignmentSummaryMetrics(); metrics.CATEGORY = pairingCategory; metrics.SAMPLE = sample; metrics.LIBRARY = library; metrics.READ_GROUP = readGroup; }
public void onComplete() { // summarize read data if (metrics.TOTAL_READS > 0) { metrics.PCT_PF_READS = (double) metrics.PF_READS / (double) metrics.TOTAL_READS; metrics.PCT_ADAPTER = this.adapterReads / (double) metrics.PF_READS; metrics.MEAN_READ_LENGTH = readLengthHistogram.getMean(); // Calculate BAD_CYCLES metrics.BAD_CYCLES = 0; for (final Histogram<Integer>.Bin cycleBin : badCycleHistogram.values()) { final double badCyclePercentage = cycleBin.getValue() / metrics.TOTAL_READS; if (badCyclePercentage >= .8) { metrics.BAD_CYCLES++; } } if (doRefMetrics) { if (metrics.PF_READS > 0) metrics.PCT_PF_READS_ALIGNED = (double) metrics.PF_READS_ALIGNED / (double) metrics.PF_READS; if (metrics.PF_READS_ALIGNED > 0) metrics.PCT_READS_ALIGNED_IN_PAIRS = (double) metrics.READS_ALIGNED_IN_PAIRS / (double) metrics.PF_READS_ALIGNED; if (metrics.PF_READS_ALIGNED > 0) metrics.STRAND_BALANCE = numPositiveStrand / (double) metrics.PF_READS_ALIGNED; if (this.chimerasDenominator > 0) metrics.PCT_CHIMERAS = this.chimeras / (double) this.chimerasDenominator; if (nonBisulfiteAlignedBases > 0) metrics.PF_MISMATCH_RATE = mismatchHistogram.getSum() / (double) nonBisulfiteAlignedBases; metrics.PF_HQ_MEDIAN_MISMATCHES = hqMismatchHistogram.getMedian(); if (hqNonBisulfiteAlignedBases > 0) metrics.PF_HQ_ERROR_RATE = hqMismatchHistogram.getSum() / (double) hqNonBisulfiteAlignedBases; if (metrics.PF_ALIGNED_BASES > 0) metrics.PF_INDEL_RATE = this.indels / (double) metrics.PF_ALIGNED_BASES; } } }