Search in sources :

Example 6 with Parameter

use of net.sf.mzmine.parameters.Parameter in project mzmine2 by mzmine.

the class BaselineCorrectionParameters method showSetupDialog.

/**
 * Use an InstantUpdateSetupDialog setup dialog instead of the regular one.
 */
@Override
public ExitCode showSetupDialog(Window parent, boolean valueCheckRequired) {
    Parameter<?>[] parameters = this.getParameters();
    if ((parameters == null) || (parameters.length == 0))
        return ExitCode.OK;
    thisParameters = this;
    ParameterSetupDialog dialog = new InstantUpdateSetupDialog(parent, valueCheckRequired, this);
    dialog.setVisible(true);
    return dialog.getExitCode();
}
Also used : BooleanParameter(net.sf.mzmine.parameters.parametertypes.BooleanParameter) RawDataFilesParameter(net.sf.mzmine.parameters.parametertypes.selectors.RawDataFilesParameter) Parameter(net.sf.mzmine.parameters.Parameter) StringParameter(net.sf.mzmine.parameters.parametertypes.StringParameter) ModuleComboParameter(net.sf.mzmine.parameters.parametertypes.ModuleComboParameter) IntegerParameter(net.sf.mzmine.parameters.parametertypes.IntegerParameter) DoubleParameter(net.sf.mzmine.parameters.parametertypes.DoubleParameter) ComboParameter(net.sf.mzmine.parameters.parametertypes.ComboParameter) ParameterSetupDialog(net.sf.mzmine.parameters.dialogs.ParameterSetupDialog)

Example 7 with Parameter

use of net.sf.mzmine.parameters.Parameter in project mzmine2 by mzmine.

the class ScanSelectionComponent method actionPerformed.

public void actionPerformed(ActionEvent event) {
    Object src = event.getSource();
    if (src == setButton) {
        SimpleParameterSet paramSet;
        ExitCode exitCode;
        Window parent = (Window) SwingUtilities.getAncestorOfClass(Window.class, this);
        final IntRangeParameter scanNumParameter = new IntRangeParameter("Scan number", "Range of included scan numbers", false, scanNumberRange);
        final IntegerParameter baseFilteringIntegerParameter = new IntegerParameter("Base Filtering Integer", "Enter an integer for which every multiple of that integer in the list will be filtered. (Every Nth element will be shown)", this.baseFilteringInteger, false);
        final RTRangeParameter rtParameter = new RTRangeParameter(false);
        if (scanRTRange != null)
            rtParameter.setValue(scanRTRange);
        final IntegerParameter msLevelParameter = new IntegerParameter("MS level", "MS level", msLevel, false);
        final StringParameter scanDefinitionParameter = new StringParameter("Scan definition", "Include only scans that match this scan definition. You can use wild cards, e.g. *FTMS*", scanDefinition, false);
        final String[] polarityTypes = { "Any", "+", "-" };
        final ComboParameter<String> polarityParameter = new ComboParameter<>("Polarity", "Include only scans of this polarity", polarityTypes);
        if ((polarity == PolarityType.POSITIVE) || (polarity == PolarityType.NEGATIVE))
            polarityParameter.setValue(polarity.asSingleChar());
        final String[] spectraTypes = { "Any", "Centroided", "Profile", "Thresholded" };
        final ComboParameter<String> spectrumTypeParameter = new ComboParameter<>("Spectrum type", "Include only spectra of this type", spectraTypes);
        if (spectrumType != null) {
            switch(spectrumType) {
                case CENTROIDED:
                    spectrumTypeParameter.setValue(spectraTypes[1]);
                    break;
                case PROFILE:
                    spectrumTypeParameter.setValue(spectraTypes[2]);
                    break;
                case THRESHOLDED:
                    spectrumTypeParameter.setValue(spectraTypes[3]);
                    break;
            }
        }
        paramSet = new SimpleParameterSet(new Parameter[] { scanNumParameter, baseFilteringIntegerParameter, rtParameter, msLevelParameter, scanDefinitionParameter, polarityParameter, spectrumTypeParameter });
        exitCode = paramSet.showSetupDialog(parent, true);
        if (exitCode == ExitCode.OK) {
            scanNumberRange = paramSet.getParameter(scanNumParameter).getValue();
            this.baseFilteringInteger = paramSet.getParameter(baseFilteringIntegerParameter).getValue();
            scanRTRange = paramSet.getParameter(rtParameter).getValue();
            msLevel = paramSet.getParameter(msLevelParameter).getValue();
            scanDefinition = paramSet.getParameter(scanDefinitionParameter).getValue();
            final int selectedPolarityIndex = Arrays.asList(polarityTypes).indexOf(paramSet.getParameter(polarityParameter).getValue());
            switch(selectedPolarityIndex) {
                case 1:
                    polarity = PolarityType.POSITIVE;
                    break;
                case 2:
                    polarity = PolarityType.NEGATIVE;
                    break;
                default:
                    polarity = null;
                    break;
            }
            final int selectedSpectraTypeIndex = Arrays.asList(spectraTypes).indexOf(paramSet.getParameter(spectrumTypeParameter).getValue());
            switch(selectedSpectraTypeIndex) {
                case 1:
                    spectrumType = MassSpectrumType.CENTROIDED;
                    break;
                case 2:
                    spectrumType = MassSpectrumType.PROFILE;
                    break;
                case 3:
                    spectrumType = MassSpectrumType.THRESHOLDED;
                    break;
                default:
                    spectrumType = null;
                    break;
            }
        }
    }
    if (src == clearButton) {
        scanNumberRange = null;
        baseFilteringInteger = null;
        scanRTRange = null;
        polarity = null;
        spectrumType = null;
        msLevel = null;
        scanDefinition = null;
    }
    updateRestrictionList();
}
Also used : Window(java.awt.Window) IntegerParameter(net.sf.mzmine.parameters.parametertypes.IntegerParameter) StringParameter(net.sf.mzmine.parameters.parametertypes.StringParameter) SimpleParameterSet(net.sf.mzmine.parameters.impl.SimpleParameterSet) RTRangeParameter(net.sf.mzmine.parameters.parametertypes.ranges.RTRangeParameter) IntRangeParameter(net.sf.mzmine.parameters.parametertypes.ranges.IntRangeParameter) ExitCode(net.sf.mzmine.util.ExitCode) ComboParameter(net.sf.mzmine.parameters.parametertypes.ComboParameter) Parameter(net.sf.mzmine.parameters.Parameter) StringParameter(net.sf.mzmine.parameters.parametertypes.StringParameter) IntRangeParameter(net.sf.mzmine.parameters.parametertypes.ranges.IntRangeParameter) RTRangeParameter(net.sf.mzmine.parameters.parametertypes.ranges.RTRangeParameter) ComboParameter(net.sf.mzmine.parameters.parametertypes.ComboParameter) IntegerParameter(net.sf.mzmine.parameters.parametertypes.IntegerParameter)

Example 8 with Parameter

use of net.sf.mzmine.parameters.Parameter in project mzmine2 by mzmine.

the class MsMsVisualizerWindow method actionPerformed.

/**
 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
 */
public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    if (command.equals("SHOW_SPECTRUM")) {
        CursorPosition pos = getCursorPosition();
        if (pos != null) {
            SpectraVisualizerModule.showNewSpectrumWindow(pos.getDataFile(), pos.getScanNumber());
        }
    }
    if (command.equals("SETUP_AXES")) {
        AxesSetupDialog dialog = new AxesSetupDialog(this, IDAPlot.getXYPlot());
        dialog.setVisible(true);
    }
    if (command.equals("SHOW_DATA_POINTS")) {
        IDAPlot.switchDataPointsVisible();
    }
    if (command.equals("SWITCH_TOOLTIPS")) {
        if (tooltipMode) {
            IDAPlot.showPeaksTooltips(false);
            toolBar.setTooltipButton(false);
            tooltipMode = false;
        } else {
            IDAPlot.showPeaksTooltips(true);
            toolBar.setTooltipButton(true);
            tooltipMode = true;
        }
    }
    if (command.equals("FIND_SPECTRA")) {
        // Parameters
        final DoubleParameter inputMZ = new DoubleParameter("Ion m/z", "m/z value of ion to search for.");
        final MZToleranceParameter inputMZTolerance = new MZToleranceParameter();
        final DoubleParameter inputIntensity = new DoubleParameter("Min. ion intensity", "Only ions with intensities above this value will be searched for.");
        final BooleanParameter inputNL = new BooleanParameter("Neutral Loss", "If selected, the ion to be searched for will be a neutral loss ion.\nIn this case, only ions above the min. intensity will be examined.", false);
        final ComboParameter<Colors> inputColors = new ComboParameter<Colors>("Color", "The color which the data points will be marked with.", Colors.values());
        Parameter<?>[] parameters = new Parameter<?>[5];
        parameters[0] = inputMZ;
        parameters[1] = inputMZTolerance;
        parameters[2] = inputIntensity;
        parameters[3] = inputNL;
        parameters[4] = inputColors;
        final ParameterSet parametersSearch = new SimpleParameterSet(parameters);
        ExitCode exitCode = parametersSearch.showSetupDialog(this, true);
        if (exitCode != ExitCode.OK)
            return;
        double searchMZ = parametersSearch.getParameter(inputMZ).getValue();
        MZTolerance searchMZTolerance = parametersSearch.getParameter(inputMZTolerance).getValue();
        double minIntensity = parametersSearch.getParameter(inputIntensity).getValue();
        boolean neutralLoss = parametersSearch.getParameter(inputNL).getValue();
        Color highligtColor = Color.red;
        ;
        if (parametersSearch.getParameter(inputColors).getValue().equals(Colors.green)) {
            highligtColor = Color.green;
        }
        if (parametersSearch.getParameter(inputColors).getValue().equals(Colors.blue)) {
            highligtColor = Color.blue;
        }
        // Find and highlight spectra with specific ion
        dataset.highlightSpectra(searchMZ, searchMZTolerance, minIntensity, neutralLoss, highligtColor);
        // Add legend entry
        LegendItemCollection chartLegend = IDAPlot.getXYPlot().getLegendItems();
        chartLegend.add(new LegendItem("Ion: " + searchMZ, "", "MS/MS spectra which contain the " + searchMZ + " ion\nTolerance: " + searchMZTolerance.toString() + "\nMin intensity: " + minIntensity, "", new Ellipse2D.Double(0, 0, 7, 7), highligtColor));
        IDAPlot.getXYPlot().setFixedLegendItems(chartLegend);
    }
}
Also used : ParameterSet(net.sf.mzmine.parameters.ParameterSet) SimpleParameterSet(net.sf.mzmine.parameters.impl.SimpleParameterSet) MZTolerance(net.sf.mzmine.parameters.parametertypes.tolerances.MZTolerance) DoubleParameter(net.sf.mzmine.parameters.parametertypes.DoubleParameter) MZToleranceParameter(net.sf.mzmine.parameters.parametertypes.tolerances.MZToleranceParameter) SimpleParameterSet(net.sf.mzmine.parameters.impl.SimpleParameterSet) LegendItemCollection(org.jfree.chart.LegendItemCollection) ExitCode(net.sf.mzmine.util.ExitCode) Color(java.awt.Color) BooleanParameter(net.sf.mzmine.parameters.parametertypes.BooleanParameter) AxesSetupDialog(net.sf.mzmine.util.dialogs.AxesSetupDialog) ComboParameter(net.sf.mzmine.parameters.parametertypes.ComboParameter) LegendItem(org.jfree.chart.LegendItem) Parameter(net.sf.mzmine.parameters.Parameter) WindowSettingsParameter(net.sf.mzmine.parameters.parametertypes.WindowSettingsParameter) DoubleParameter(net.sf.mzmine.parameters.parametertypes.DoubleParameter) ComboParameter(net.sf.mzmine.parameters.parametertypes.ComboParameter) BooleanParameter(net.sf.mzmine.parameters.parametertypes.BooleanParameter) MZToleranceParameter(net.sf.mzmine.parameters.parametertypes.tolerances.MZToleranceParameter) CursorPosition(net.sf.mzmine.modules.visualization.tic.CursorPosition)

Aggregations

Parameter (net.sf.mzmine.parameters.Parameter)8 UserParameter (net.sf.mzmine.parameters.UserParameter)5 JComboBox (javax.swing.JComboBox)3 JComponent (javax.swing.JComponent)3 JLabel (javax.swing.JLabel)3 ComboParameter (net.sf.mzmine.parameters.parametertypes.ComboParameter)3 GridBagPanel (net.sf.mzmine.util.components.GridBagPanel)3 DataPoint (net.sf.mzmine.datamodel.DataPoint)2 SimpleParameterSet (net.sf.mzmine.parameters.impl.SimpleParameterSet)2 BooleanParameter (net.sf.mzmine.parameters.parametertypes.BooleanParameter)2 DoubleParameter (net.sf.mzmine.parameters.parametertypes.DoubleParameter)2 IntegerParameter (net.sf.mzmine.parameters.parametertypes.IntegerParameter)2 StringParameter (net.sf.mzmine.parameters.parametertypes.StringParameter)2 ExitCode (net.sf.mzmine.util.ExitCode)2 Element (org.w3c.dom.Element)2 Color (java.awt.Color)1 Window (java.awt.Window)1 JEditorPane (javax.swing.JEditorPane)1 JPanel (javax.swing.JPanel)1 JScrollPane (javax.swing.JScrollPane)1