added check of elements parameter in isotope grouper task
@@ -109,9 +109,11 @@ public class DPPIsotopeGrouperTask extends DataPointProcessingTask {
}
// check formula
- if (!FormulaUtils.checkMolecularFormula(elements)) {
+ if (elements == null || elements.equals("") || !FormulaUtils.checkMolecularFormula(elements)) {
+ setErrorMessage("Invalid element parameter in " + this.getClass().getName());
setStatus(TaskStatus.ERROR);
logger.warning("Invalid element parameter in " + this.getClass().getName());
+ return;
}
ExtendedIsotopePattern[] elementPattern =
@@ -156,43 +158,6 @@ public class DPPIsotopeGrouperTask extends DataPointProcessingTask {
}
- private String getResultIsoComp(DPPIsotopePatternResult result) {
- String str = "";
- for (ProcessedDataPoint dp : result.getLinkedDataPoints()) {
- String c = "";
- DPPIsotopeCompositionResult comps =
- (DPPIsotopeCompositionResult) dp.getFirstResultByType(ResultType.ISOTOPECOMPOSITION);
- for (String comp : comps.getValue())
- c += comp + ", ";
- c = c.substring(0, c.length() - 2);
- str += format.format(dp.getMZ()) + " (" + c + "), ";
- }
- str = str.substring(0, str.length() - 2);
- return str;
- }
-
- public class BufferElement {
- final double ppm;
- final ProcessedDataPoint dp;
-
- BufferElement(double ppm, ProcessedDataPoint dp) {
- this.ppm = ppm;
- this.dp = dp;
- }
-
- public double getPpm() {
- return ppm;
- }
-
- public ProcessedDataPoint getDp() {
- return dp;
- }
- }
-
- public static double ppmDiff(double realmz, double calcmz) {
- return 10E6 * (realmz - calcmz) / calcmz;
- }
-
public static IsotopePattern checkOverlappingIsotopes(IsotopePattern pattern, IIsotope[] isotopes,
double mergeWidth, double minAbundance) {
DataPoint[] dp = pattern.getDataPoints();
@@ -311,7 +276,8 @@ public class DPPIsotopeGrouperTask extends DataPointProcessingTask {
@Override
public String getTaskDescription() {
- return "Isotope grouping for Scan #" + getTargetPlot().getMainScanDataSet().getScan().getScanNumber();
+ return "Isotope grouping for Scan #"
+ + getTargetPlot().getMainScanDataSet().getScan().getScanNumber();
}
@Override
@@ -343,39 +309,6 @@ public class DPPIsotopeGrouperTask extends DataPointProcessingTask {
}
}
- /**
- * This method generates a single IsotopesDataSet from all detected isotope patterns in the
- * results.
- *
- * @param dataPoints
- * @return
- */
- private IsotopesDataSet compressIsotopeDataSets(ProcessedDataPoint[] dataPoints) {
- List<IsotopePattern> list = new ArrayList<>();
-
- for (ProcessedDataPoint dp : dataPoints) {
- if (dp.resultTypeExists(ResultType.ISOTOPEPATTERN)) {
- list.add(((DPPIsotopePatternResult) dp.getFirstResultByType(ResultType.ISOTOPEPATTERN))
- .getValue());
- }
- }
- if (list.isEmpty())
- return null;
-
- List<DataPoint> dpList = new ArrayList<>();
-
- for (IsotopePattern pattern : list) {
- for (DataPoint dp : pattern.getDataPoints())
- dpList.add(dp);
- }
- if (dpList.isEmpty())
- return null;
-
- IsotopePattern full = new SimpleIsotopePattern(dpList.toArray(new DataPoint[0]),
- IsotopePatternStatus.DETECTED, "Isotope patterns");
- return new IsotopesDataSet(full);
- }
-
public static List<Color> generateRainbowColors(int num) {
List<Color> clr = new ArrayList<>(num);
if (num == 0) {
