totalScans = scanNumbers.length;
// Check if we have at least one scan with a mass list of given name
boolean haveMassList = false;
for (int i = 0; i < totalScans; i++) {
Scan scan = dataFile.getScan(scanNumbers[i]);
MassList massList = scan.getMassList(massListName);
if (massList != null) {
haveMassList = true;
break;
}
}
if (!haveMassList) {
setStatus(TaskStatus.ERROR);
this.errorMessage = dataFile.getName()
+ " has no mass list called '" + massListName + "'";
return;
}
// Process all scans
for (int i = 0; i < totalScans; i++) {
if (isCanceled())
return;
Scan scan = dataFile.getScan(scanNumbers[i]);
MassList massList = scan.getMassList(massListName);
// Skip those scans which do not have a mass list of given name
if (massList == null) {
processedScans++;
continue;
}
DataPoint mzPeaks[] = massList.getDataPoints();
DataPoint newMzPeaks[] = ShoulderPeaksFilter.filterMassValues(
mzPeaks, parameters);
SimpleMassList newMassList = new SimpleMassList(massListName + " "
+ suffix, scan, newMzPeaks);
scan.addMassList(newMassList);
// Remove old mass list
if (autoRemove)
scan.removeMassList(massList);
processedScans++;
}
setStatus(TaskStatus.FINISHED);