public int compare(LocusScore o1, LocusScore o2) {
return o1.getStart() - o2.getStart();
}
});
while(dualIter.hasNext()){
LocusScore score = dualIter.next();
boundariesSet.add(score.getStart());
boundariesSet.add(score.getEnd());
}
Integer[] boundariesArray = boundariesSet.toArray(new Integer[0]);
Arrays.sort(boundariesArray);
int outerScoreInd = 0;
int innerScoreInd = 0;
//Calculate value for each interval
for(int bb=0; bb < boundariesArray.length-1; bb++){
int start = boundariesArray[bb];
int end = boundariesArray[bb+1];
//It shouldn't be possible for more than one LocusScore of either
//tracks to overlap each interval, since the start/ends
//were based on all start/ends of the inputs
outerScoreInd = findContains(start, end, outerScores, Math.max(outerScoreInd, 0));
innerScoreInd = findContains(start, end, innerScores, Math.max(innerScoreInd, 0));
LocusScore outerScore = getContains(outerScores, outerScoreInd);
LocusScore innerScore = getContains(innerScores, innerScoreInd);
if(outerScore == null && innerScore == null) continue;
float score = combineScores(outerScore, innerScore);
BasicScore newScore = new BasicScore(start, end, score);
combinedScoresList.add(newScore);