use of net.sf.mzmine.parameters.ParameterSet in project mzmine2 by mzmine.
the class FormulaPredictionModule method showSingleRowIdentificationDialog.
public static void showSingleRowIdentificationDialog(PeakListRow row) {
ParameterSet parameters = MZmineCore.getConfiguration().getModuleParameters(FormulaPredictionModule.class);
double mzValue = row.getAverageMZ();
parameters.getParameter(FormulaPredictionParameters.neutralMass).setIonMass(mzValue);
int bestScanNum = row.getBestPeak().getRepresentativeScanNumber();
if (bestScanNum > 0) {
RawDataFile dataFile = row.getBestPeak().getDataFile();
Scan bestScan = dataFile.getScan(bestScanNum);
PolarityType scanPolarity = bestScan.getPolarity();
switch(scanPolarity) {
case POSITIVE:
parameters.getParameter(FormulaPredictionParameters.neutralMass).setIonType(IonizationType.POSITIVE_HYDROGEN);
break;
case NEGATIVE:
parameters.getParameter(FormulaPredictionParameters.neutralMass).setIonType(IonizationType.NEGATIVE_HYDROGEN);
break;
default:
break;
}
}
int charge = row.getBestPeak().getCharge();
if (charge > 0) {
parameters.getParameter(FormulaPredictionParameters.neutralMass).setCharge(charge);
}
ExitCode exitCode = parameters.showSetupDialog(MZmineCore.getDesktop().getMainWindow(), true);
if (exitCode != ExitCode.OK) {
return;
}
SingleRowPredictionTask newTask = new SingleRowPredictionTask(parameters.cloneParameterSet(), row);
// execute the sequence
MZmineCore.getTaskController().addTask(newTask);
}
use of net.sf.mzmine.parameters.ParameterSet in project mzmine2 by mzmine.
the class MzRangeMassCalculatorModule method showRangeCalculationDialog.
/**
* Shows the calculation dialog and returns the calculated m/z range. May return null in case user
* clicked Cancel.
*/
@Nullable
public static Range<Double> showRangeCalculationDialog() {
ParameterSet myParameters = MZmineCore.getConfiguration().getModuleParameters(MzRangeMassCalculatorModule.class);
if (myParameters == null)
return null;
ExitCode exitCode = myParameters.showSetupDialog(null, true);
if (exitCode != ExitCode.OK)
return null;
Double mz = myParameters.getParameter(MzRangeMassCalculatorParameters.mz).getValue();
MZTolerance mzTolerance = myParameters.getParameter(MzRangeMassCalculatorParameters.mzTolerance).getValue();
if ((mz == null) || (mzTolerance == null))
return null;
Range<Double> mzRange = mzTolerance.getToleranceRange(mz);
return mzRange;
}
use of net.sf.mzmine.parameters.ParameterSet in project mzmine2 by mzmine.
the class SiriusProcessingModule method showSingleRowIdentificationDialog.
/**
* Show dialog for identifying a single peak-list row.
*
* @param row the feature list row.
*/
public static void showSingleRowIdentificationDialog(final PeakListRow row) {
final ParameterSet parameters = new SingleRowIdentificationParameters();
// Set m/z.
parameters.getParameter(SingleRowIdentificationParameters.ION_MASS).setValue(row.getAverageMZ());
if (parameters.showSetupDialog(MZmineCore.getDesktop().getMainWindow(), true) == ExitCode.OK) {
String massListName = parameters.getParameter(SingleRowIdentificationParameters.MASS_LIST).getValue();
List<String> massLists = MassListComponent.getMassListNames();
int fingerCandidates, siriusCandidates, timer;
timer = parameters.getParameter(SingleRowIdentificationParameters.SIRIUS_TIMEOUT).getValue();
siriusCandidates = parameters.getParameter(SingleRowIdentificationParameters.SIRIUS_CANDIDATES).getValue();
fingerCandidates = parameters.getParameter(SingleRowIdentificationParameters.FINGERID_CANDIDATES).getValue();
if (timer <= 0 || siriusCandidates <= 0 || fingerCandidates <= 0) {
MZmineCore.getDesktop().displayErrorMessage(MZmineCore.getDesktop().getMainWindow(), "Sirius parameters can't be negative");
} else if (!massLists.contains(massListName)) {
MZmineCore.getDesktop().displayErrorMessage(MZmineCore.getDesktop().getMainWindow(), "Mass List parameter", String.format("Mass List parameter is set wrong [%s]", massListName));
} else {
// Run task.
MZmineCore.getTaskController().addTask(new SingleRowIdentificationTask(parameters.cloneParameterSet(), row));
}
}
}
use of net.sf.mzmine.parameters.ParameterSet in project mzmine2 by mzmine.
the class GnpsGcExportAndSubmitTask method addAdapMgfTask.
/**
* Export mgf (adap mgf export) of clustered spectra
*
* @param parameters
* @return
*/
private AbstractTask addAdapMgfTask(ParameterSet parameters) {
File full = parameters.getParameter(GnpsGcExportAndSubmitParameters.FILENAME).getValue();
String name = FileAndPathUtil.eraseFormat(full.getName());
full = FileAndPathUtil.getRealFilePath(full.getParentFile(), name, "mgf");
ParameterSet mgfParam = MZmineCore.getConfiguration().getModuleParameters(AdapMgfExportModule.class);
mgfParam.getParameter(AdapMgfExportParameters.FILENAME).setValue(full);
mgfParam.getParameter(AdapMgfExportParameters.FRACTIONAL_MZ).setValue(true);
mgfParam.getParameter(AdapMgfExportParameters.REPRESENTATIVE_MZ).setValue(representativeMZ);
return new AdapMgfExportTask(mgfParam, new PeakList[] { peakList });
}
use of net.sf.mzmine.parameters.ParameterSet in project mzmine2 by mzmine.
the class GnpsGcSubmitParameters method openKovatsDialog.
/**
* OPen Kovats creation dialog, save file and retrieve file
*
* @param pn
*/
private void openKovatsDialog(FileNameComponent pn) {
// at least one raw data file in project
RawDataFile[] raw = MZmineCore.getProjectManager().getCurrentProject().getDataFiles();
if (raw == null || raw.length <= 0) {
DialogLoggerUtil.showMessageDialogForTime(MZmineCore.getDesktop().getMainWindow(), "No RAW data files", "Cannot use Kovats extraction without raw data files in this project", 3500);
return;
}
// todo open dialog
ParameterSet param = MZmineCore.getConfiguration().getModuleParameters(KovatsIndexExtractionModule.class);
KovatsIndexExtractionDialog kd = new KovatsIndexExtractionDialog(null, param, savedFile -> pn.setValue(savedFile));
kd.setVisible(true);
}
Aggregations