} else {
float normalizationFactor = 1.0f;
List<LocusScore> scores = new ArrayList(nBins);
double scale = (double) (endLocation - startLocation) / nBins;
Accumulator accumulator = new Accumulator(windowFunction, 5);
int accumulatedStart = -1;
int accumulatedEnd = -1;
int lastEndBin = 0;
int size = starts.length;
// Loop through and bin scores for this interval.
for (int i = 0; i < size; i++) {
int true_end = ends == null ? starts[i] + 1 : ends[i];
float v = values[i] * normalizationFactor;
if (starts[i] >= endLocation) {
break; // We're beyond the end of the requested interval
} else if (true_end <= startLocation || Float.isNaN(v)) {
//Not yet to interval, or not a number
continue;
}
// Bound feature at interval, other "piece" will be in another tile.
int s = Math.max(startLocation, starts[i]);
int e = Math.min(endLocation, true_end);
String probeName = features == null ? null : features[i];
// Compute bin numbers, relative to start of this tile
int endBin = (int) ((e - startLocation) / scale);
int startBin = (int) ((s - startLocation) / scale);
// If this feature spans multiple bins, or extends beyond last end bin, record
if (endBin > lastEndBin || endBin > startBin) {
if (accumulator.hasData()) {
scores.add(getCompositeScore(accumulator, accumulatedStart, accumulatedEnd));
accumulator = new Accumulator(windowFunction, 5);
}
}
if (endBin > startBin) {
scores.add(new NamedScore(s, e, v, probeName));
} else {
if (!accumulator.hasData()) accumulatedStart = s;
accumulatedEnd = e;
accumulator.add(e - s, v, probeName);
}
lastEndBin = endBin;
}
// Cleanup
if (accumulator.hasData()) {
scores.add(getCompositeScore(accumulator, accumulatedStart, accumulatedEnd));
}
tile.addAllScores(scores);
}