Search in sources :

Example 16 with ParameterSet

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);
}
Also used : ParameterSet(net.sf.mzmine.parameters.ParameterSet) PolarityType(net.sf.mzmine.datamodel.PolarityType) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) ExitCode(net.sf.mzmine.util.ExitCode) Scan(net.sf.mzmine.datamodel.Scan)

Example 17 with ParameterSet

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;
}
Also used : ParameterSet(net.sf.mzmine.parameters.ParameterSet) MZTolerance(net.sf.mzmine.parameters.parametertypes.tolerances.MZTolerance) ExitCode(net.sf.mzmine.util.ExitCode) Nullable(javax.annotation.Nullable)

Example 18 with ParameterSet

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));
        }
    }
}
Also used : ParameterSet(net.sf.mzmine.parameters.ParameterSet)

Example 19 with ParameterSet

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 });
}
Also used : ParameterSet(net.sf.mzmine.parameters.ParameterSet) AdapMgfExportTask(net.sf.mzmine.modules.peaklistmethods.io.adap.mgfexport.AdapMgfExportTask) File(java.io.File)

Example 20 with ParameterSet

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);
}
Also used : ParameterSet(net.sf.mzmine.parameters.ParameterSet) SimpleParameterSet(net.sf.mzmine.parameters.impl.SimpleParameterSet) KovatsIndexExtractionDialog(net.sf.mzmine.modules.tools.kovats.KovatsIndexExtractionDialog) RawDataFile(net.sf.mzmine.datamodel.RawDataFile)

Aggregations

ParameterSet (net.sf.mzmine.parameters.ParameterSet)53 ExitCode (net.sf.mzmine.util.ExitCode)19 RawDataFile (net.sf.mzmine.datamodel.RawDataFile)11 File (java.io.File)9 ArrayList (java.util.ArrayList)8 SimpleParameterSet (net.sf.mzmine.parameters.impl.SimpleParameterSet)8 Task (net.sf.mzmine.taskcontrol.Task)8 Element (org.w3c.dom.Element)8 PeakList (net.sf.mzmine.datamodel.PeakList)6 MZmineModule (net.sf.mzmine.modules.MZmineModule)6 Document (org.w3c.dom.Document)6 IOException (java.io.IOException)5 DataPoint (net.sf.mzmine.datamodel.DataPoint)5 PeakListRow (net.sf.mzmine.datamodel.PeakListRow)5 Scan (net.sf.mzmine.datamodel.Scan)5 MZmineProcessingModule (net.sf.mzmine.modules.MZmineProcessingModule)5 Nonnull (javax.annotation.Nonnull)4 Feature (net.sf.mzmine.datamodel.Feature)4 IsotopePattern (net.sf.mzmine.datamodel.IsotopePattern)4 PeakListsParameter (net.sf.mzmine.parameters.parametertypes.selectors.PeakListsParameter)4