Fix bug in ADAP Chromatogram building
@@ -309,6 +309,8 @@ public class ADAPChromatogramBuilderTask extends AbstractTask {
toBeLowerBound = 0.0;
toBeUpperBound = 0.0;
}
+
+ if (toBeLowerBound < toBeUpperBound) {
Range<Double> newRange = Range.open(toBeLowerBound, toBeUpperBound);
ADAPChromatogram newChrom = new ADAPChromatogram(dataFile, allScanNumbers);
@@ -317,11 +319,19 @@ public class ADAPChromatogramBuilderTask extends AbstractTask {
newChrom.setHighPointMZ(mzPeak.getMZ());
-
rangeToChromMap.put(newRange, newChrom);
// also need to put it in the set -> this is where the range can be efficiently found.
rangeSet.add(newRange);
+ }
+ else if (toBeLowerBound.equals(toBeUpperBound) && plusRange != null) {
+ ADAPChromatogram curChrom = rangeToChromMap.get(plusRange);
+ curChrom.addMzPeak(mzPeak.getScanNumber(), mzPeak);
+ }
+ else
+ throw new IllegalStateException(String.format("Incorrect range [%f, %f] for m/z %f",
+ toBeLowerBound, toBeUpperBound, mzPeak.getMZ()));
+
} else {
// In this case we do not need to update the rangeSet
