Source:
void accumulateSamRecord(SAMRecord rec) { for (final AlignmentBlock alignmentBlock : rec.getAlignmentBlocks()) { int readOffset = alignmentBlock.getReadStart() - 1; int refPos = alignmentBlock.getReferenceStart(); int refOffset = refPos - rec.getAlignmentStart(); int refOffsetEnd = refPos - rec.getAlignmentStart() + alignmentBlock.getLength(); for (int j = accumulator.size(); j <= refOffsetEnd; ++j) { accumulator.add(createLocusInfo(getReferenceSequence(rec.getReferenceIndex()), rec.getAlignmentStart() + j)); } int refOffsetInterval = refOffset; int refOffsetEndInterval = refOffsetEnd; int startShift = 0; if (getIntervals() != null) { Interval interval = getCurrentInterval(); if (interval != null) { final int intervalEnd = interval.getEnd(); final int intervalStart = interval.getStart(); if ((refPos < intervalStart && refPos + alignmentBlock.getLength() < intervalStart) || (refPos > intervalEnd && refPos + alignmentBlock.getLength() > intervalEnd)) { continue; } if (refPos < intervalStart) { startShift = intervalStart - refPos; refOffsetInterval = refOffsetInterval + startShift; } if (refPos + alignmentBlock.getLength() > intervalEnd) { refOffsetEndInterval = refOffsetEndInterval - (refPos + alignmentBlock.getLength() - intervalEnd) + 1; } } } int length = refOffsetEndInterval - refOffsetInterval; EdgingRecordAndOffset recordAndOffset = createRecordAndOffset(rec, readOffset + startShift, length, refPos + startShift, EdgingRecordAndOffset.Type.BEGIN); accumulator.get(refOffsetInterval).add(recordAndOffset); EdgingRecordAndOffset recordAndOffsetEnd = createRecordAndOffset(rec, readOffset + startShift, length, refPos + startShift, EdgingRecordAndOffset.Type.END); recordAndOffsetEnd.setStart(recordAndOffset); accumulator.get(refOffsetEndInterval).add(recordAndOffsetEnd); } }

Target:
void accumulateSamRecord(SAMRecord rec) { for (final AlignmentBlock alignmentBlock : rec.getAlignmentBlocks()) { final int readOffset = alignmentBlock.getReadStart() - 1; final int refPos = alignmentBlock.getReferenceStart(); final int refOffset = refPos - rec.getAlignmentStart(); final int refOffsetEnd = refPos - rec.getAlignmentStart() + alignmentBlock.getLength(); for (int j = accumulator.size(); j <= refOffsetEnd; ++j) { accumulator.add(createLocusInfo(getReferenceSequence(rec.getReferenceIndex()), rec.getAlignmentStart() + j)); } int refOffsetInterval = refOffset; int refOffsetEndInterval = refOffsetEnd; int startShift = 0; if (getIntervals() != null) { Interval interval = getCurrentInterval(); if (interval != null) { final int intervalEnd = interval.getEnd(); final int intervalStart = interval.getStart(); if (!CoordMath.overlaps(refPos, refPos + alignmentBlock.getLength(), intervalStart, intervalEnd)) { continue; } if (refPos < intervalStart) { startShift = intervalStart - refPos; refOffsetInterval = refOffsetInterval + startShift; } final int readEnd = refPos + alignmentBlock.getLength(); if (refPos + alignmentBlock.getLength() > intervalEnd) { refOffsetEndInterval = refOffsetEndInterval - (readEnd - intervalEnd) + 1; } } } final int length = refOffsetEndInterval - refOffsetInterval; final EdgingRecordAndOffset recordAndOffset = createRecordAndOffset(rec, readOffset + startShift, length, refPos + startShift); accumulator.get(refOffsetInterval).add(recordAndOffset); final EdgingRecordAndOffset recordAndOffsetEnd = createRecordAndOffset(recordAndOffset); accumulator.get(refOffsetEndInterval).add(recordAndOffsetEnd); } }