allow single scans in adap chromatogram builder, but protect by opt out confirmation
@@ -24,13 +24,18 @@ import io.github.mzmine.parameters.dialogs.ParameterSetupDialog;
import io.github.mzmine.parameters.impl.IonMobilitySupport;
import io.github.mzmine.parameters.impl.SimpleParameterSet;
import io.github.mzmine.parameters.parametertypes.DoubleParameter;
+import io.github.mzmine.parameters.parametertypes.HiddenParameter;
import io.github.mzmine.parameters.parametertypes.IntegerParameter;
+import io.github.mzmine.parameters.parametertypes.OptOutParameter;
import io.github.mzmine.parameters.parametertypes.StringParameter;
import io.github.mzmine.parameters.parametertypes.selectors.RawDataFilesParameter;
import io.github.mzmine.parameters.parametertypes.selectors.ScanSelection;
import io.github.mzmine.parameters.parametertypes.selectors.ScanSelectionParameter;
import io.github.mzmine.parameters.parametertypes.tolerances.MZToleranceParameter;
import io.github.mzmine.util.ExitCode;
+import java.util.Collection;
+import java.util.Map;
+import javafx.scene.control.ButtonType;
import org.jetbrains.annotations.NotNull;
public class ADAPChromatogramBuilderParameters extends SimpleParameterSet {
@@ -46,7 +51,7 @@ public class ADAPChromatogramBuilderParameters extends SimpleParameterSet {
+ "to be recognized as a chromatogram.\n"
+ "The optimal value depends on the chromatography system setup. The best way to set this parameter\n"
+ "is by studying the raw data and determining what is the typical time span of chromatographic features.",
- 5, true, 2, null);
+ 5, true, 1, null);
public static final MZToleranceParameter mzTolerance = new MZToleranceParameter(
"Scan to scan accuracy (m/z)", "m/z tolerance of the same compound between two scans.\n"
@@ -67,10 +72,15 @@ public class ADAPChromatogramBuilderParameters extends SimpleParameterSet {
MZmineCore.getConfiguration().getIntensityFormat());
// End Owen Edit
+ public static final HiddenParameter<OptOutParameter, Map<String, Boolean>> allowSingleScans = new HiddenParameter<>(
+ new OptOutParameter("Allow single scan chromatograms",
+ "Allows selection of single scans as chromatograms. This is useful for "
+ + "feature table generation if MALDI point measurements."));
+
public ADAPChromatogramBuilderParameters() {
super(
new Parameter[]{dataFiles, scanSelection, minimumScanSpan, IntensityThresh2, startIntensity,
- mzTolerance, suffix});
+ mzTolerance, suffix, allowSingleScans});
}
@Override
@@ -99,4 +109,29 @@ public class ADAPChromatogramBuilderParameters extends SimpleParameterSet {
public IonMobilitySupport getIonMobilitySupport() {
return IonMobilitySupport.RESTRICTED;
}
+
+ @Override
+ public boolean checkParameterValues(Collection<String> errorMessages) {
+ if (!super.checkParameterValues(errorMessages)) {
+ return false;
+ }
+
+ final Boolean singleScansOkOptOut = getParameter(allowSingleScans).getValue()
+ .get("optoutsinglescancheck");
+
+ if (getParameter(minimumScanSpan).getValue() <= 1 && (singleScansOkOptOut == null
+ || singleScansOkOptOut == false)) {
+ ButtonType buttonType = MZmineCore.getDesktop()
+ .createAlertWithOptOut("Confirmation", "Single consecutive scan selected.",
+ "The number of consecutive scans was set to <= 1.\nThis can lead to more noise"
+ + " detected as EICs.\nDo you want to proceed?", "Do not show again.",
+ b -> this.getParameter(allowSingleScans).getValue()
+ .put("optoutsinglescancheck", b));
+ if(buttonType.equals(ButtonType.YES)) {
+ return true;
+ }
+ return false;
+ }
+ return true;
+ }
}
