}
binAdaptor.skipTo(startLocation);
int position = binAdaptor.getPosition();
ObjectArrayList<LocusScore> result = new ObjectArrayList<LocusScore>();
result.add(new BasicScore(initialStartPosition, position, 0.0f));
while (binAdaptor.hasNextTransition() && position < endLocation) {
binAdaptor.nextTransition();
// position is the zero-based position before the count is changed by the transition
position = binAdaptor.getPosition();
// count is how many reads cover the length bases that follow position.
final double count = selectedWindowFunction == WindowFunction.mean ? binAdaptor.getAverage() : binAdaptor.getMax();
final double normalizedCount = count / normalizationFactor;
final int length = binAdaptor.getLength();
// System.out.printf("adding results %d-%d count=%g %n", position, position + length , normalizedCount);
BasicScore bs = new BasicScore(position, position + length, (float) normalizedCount);
result.add(bs);
this.currentMax = Math.max(currentMax, normalizedCount);
if (!hasPrecomputedStats) {
// estimate on the fly from the subset of data seen so far:
numBasesSeen += length * count;
if (count != 0) {
numSitesSeen += length;
}
}
}
result.add(new BasicScore(position, endLocation, 0.0f));
return result;
} catch (IOException e) {
LOG.error(e);
throw new DataLoadException(