HistogramGenerator addRead(final GATKRead read) { final byte[] quals = (useOriginalQualities ? ReadUtils.getOriginalBaseQualities(read) : read.getBaseQualities()); if (quals == null) { return this; } final int length = quals.length; final boolean isReverseStrand = read.isReverseStrand(); ensureArraysBigEnough(length + 1); for (int i = 0; i < length; ++i) { final int cycle = isReverseStrand ? length - i : i + 1; if (read.isPaired() && read.isSecondOfPair()) { secondReadTotalsByCycle[cycle] += quals[i]; secondReadCountsByCycle[cycle] += 1; } else { firstReadTotalsByCycle[cycle] += quals[i]; firstReadCountsByCycle[cycle] += 1; } } return this; }