if ( debuggingWriter != null )
for ( final GATKSAMRecord read : reads )
debuggingWriter.addAlignment(read);
final LocusIteratorByState libs = new LocusIteratorByState(reads.iterator(), LocusIteratorByState.NO_DOWNSAMPLING,
true, genomeLocParser, SampleListUtils.asSet(samples), false);
final List<ReadBackedPileup> pileups = new LinkedList<>();
final int startPos = activeRegionSpan.getStart();
AlignmentContext next = libs.advanceToLocus(startPos, true);
for ( int curPos = startPos; curPos <= activeRegionSpan.getStop(); curPos++ ) {
if ( next != null && next.getLocation().getStart() == curPos ) {
pileups.add(next.getBasePileup());
next = libs.hasNext() ? libs.next() : null;
} else {
// no data, so we create empty pileups
pileups.add(new ReadBackedPileupImpl(genomeLocParser.createGenomeLoc(activeRegionSpan.getContig(), curPos)));
}
}