public void sort(Set<String> unsortedChromosomes) {
for (String c : unsortedChromosomes) {
String chr = genome.getChromosomeAlias(c);
final IntArrayList starts = startLocationsMap.get(chr);
int sz = starts.size();
int[] indices = new int[sz];
for (int i = 0; i < indices.length; i++) {
indices[i] = i;
}
(new ArrayHeapIntSorter()).sort(indices, new IntComparator() {
public int compare(int arg0, int arg1) {
return starts.get(arg0) - starts.get(arg1);
}
});
int[] sortedStarts = reorder(indices, startLocationsMap.get(chr));
int[] sortedEnds = reorder(indices, endLocationsMap.get(chr));
float[] sortedData = reorder(indices, dataMap.get(chr));
startLocationsMap.put(chr, new IntArrayList(sortedStarts));
endLocationsMap.put(chr, new IntArrayList(sortedEnds));
dataMap.put(chr, new FloatArrayList(sortedData));
}
}