- (binTime / 2.0f), scan.getRetentionTime()
+ (binTime / 2.0f));
Range mzWindow = new Range(
scan.getPrecursorMZ() - (binSize / 2.0f),
scan.getPrecursorMZ() + (binSize / 2.0f));
DataPoint point;
DataPoint maxPoint = null;
int[] regionScanNumbers = dataFile.getScanNumbers(1, rtWindow);
for (int regionScanNumber : regionScanNumbers) {
Scan regionScan = dataFile.getScan(regionScanNumber);
point = ScanUtils.findBasePeak(regionScan, mzWindow);
// no datapoint found
if (point == null) {
continue;
}
if (maxPoint == null) {
maxPoint = point;
}
int result = Double.compare(maxPoint.getIntensity(),
point.getIntensity());
if (result <= 0) {
maxPoint = point;
bestScan = regionScan;
}
}
// if no representative dataPoint
if (bestScan == null) {
continue;
}
assert maxPoint != null;
SimpleChromatographicPeak c = new SimpleChromatographicPeak(
dataFile, scan.getPrecursorMZ(),
bestScan.getRetentionTime(), maxPoint.getIntensity(),
maxPoint.getIntensity(),
new int[]{bestScan.getScanNumber()},
new DataPoint[]{maxPoint}, PeakStatus.DETECTED,
bestScan.getScanNumber(), scan.getScanNumber(), new Range(
bestScan.getRetentionTime()), new Range(
scan.getPrecursorMZ()), new Range(
maxPoint.getIntensity()));
PeakListRow entry = new SimplePeakListRow(scan.getScanNumber());
entry.addPeak(dataFile, c);
newPeakList.addRow(entry);