Search in sources :

Example 16 with UserParameter

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

the class RowsFilterTask method getPeakCount.

private int getPeakCount(PeakListRow row, String groupingParameter) {
    if (groupingParameter.contains("Filtering by ")) {
        HashMap<String, Integer> groups = new HashMap<String, Integer>();
        for (RawDataFile file : project.getDataFiles()) {
            UserParameter<?, ?>[] params = project.getParameters();
            for (UserParameter<?, ?> p : params) {
                groupingParameter = groupingParameter.replace("Filtering by ", "");
                if (groupingParameter.equals(p.getName())) {
                    String parameterValue = String.valueOf(project.getParameterValue(p, file));
                    if (row.hasPeak(file)) {
                        if (groups.containsKey(parameterValue)) {
                            groups.put(parameterValue, groups.get(parameterValue) + 1);
                        } else {
                            groups.put(parameterValue, 1);
                        }
                    } else {
                        groups.put(parameterValue, 0);
                    }
                }
            }
        }
        Set<String> ref = groups.keySet();
        Iterator<String> it = ref.iterator();
        int min = Integer.MAX_VALUE;
        while (it.hasNext()) {
            String name = it.next();
            int val = groups.get(name);
            if (val < min) {
                min = val;
            }
        }
        return min;
    } else {
        return row.getNumberOfPeaks();
    }
}
Also used : UserParameter(net.sf.mzmine.parameters.UserParameter) HashMap(java.util.HashMap) RawDataFile(net.sf.mzmine.datamodel.RawDataFile)

Example 17 with UserParameter

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

the class PeakFilterParameters method showSetupDialog.

@Override
public ExitCode showSetupDialog(Window parent, boolean valueCheckRequired) {
    // Update the parameter choices
    UserParameter<?, ?>[] newChoices = MZmineCore.getProjectManager().getCurrentProject().getParameters();
    String[] choices;
    if (newChoices == null || newChoices.length == 0) {
        choices = new String[1];
        choices[0] = "No parameters defined";
    } else {
        choices = new String[newChoices.length + 1];
        choices[0] = "Ignore groups";
        for (int i = 0; i < newChoices.length; i++) {
            choices[i + 1] = "Filtering by " + newChoices[i].getName();
        }
    }
    ParameterSetupDialog dialog = new ParameterSetupDialog(parent, valueCheckRequired, this);
    dialog.setVisible(true);
    return dialog.getExitCode();
}
Also used : UserParameter(net.sf.mzmine.parameters.UserParameter) ParameterSetupDialog(net.sf.mzmine.parameters.dialogs.ParameterSetupDialog)

Example 18 with UserParameter

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

the class SignificanceParameters method showSetupDialog.

@Override
public ExitCode showSetupDialog(Window parent, boolean valueCheckRequired) {
    // Update the parameter choices
    MZmineProject project = MZmineCore.getProjectManager().getCurrentProject();
    UserParameter[] newChoices = project.getParameters();
    getParameter(SignificanceParameters.selectionData).setChoices(newChoices);
    // Add a message
    String message = "<html>To view the results of ANOVA test, export the feature list to CSV file " + "and look for column ANOVA_P_VALUE. Click Help for details.</html>";
    ParameterSetupDialog dialog = new ParameterSetupDialog(parent, valueCheckRequired, this, message);
    dialog.setVisible(true);
    return dialog.getExitCode();
}
Also used : UserParameter(net.sf.mzmine.parameters.UserParameter) MZmineProject(net.sf.mzmine.datamodel.MZmineProject) ParameterSetupDialog(net.sf.mzmine.parameters.dialogs.ParameterSetupDialog)

Example 19 with UserParameter

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

the class OptionalParameter method setValueFromComponent.

@Override
public void setValueFromComponent(OptionalParameterComponent component) {
    this.value = component.isSelected();
    if (value) {
        JComponent embeddedComponent = component.getEmbeddedComponent();
        ((UserParameter) this.embeddedParameter).setValueFromComponent(embeddedComponent);
    }
}
Also used : UserParameter(net.sf.mzmine.parameters.UserParameter) JComponent(javax.swing.JComponent)

Example 20 with UserParameter

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

the class ModuleComboParameter method getValue.

public MZmineProcessingStep<ModuleType> getValue() {
    if (value == null)
        return null;
    // First check that the module has all parameters set
    ParameterSet embeddedParameters = value.getParameterSet();
    if (embeddedParameters == null)
        return value;
    for (Parameter<?> p : embeddedParameters.getParameters()) {
        if (p instanceof UserParameter) {
            UserParameter<?, ?> up = (UserParameter<?, ?>) p;
            Object upValue = up.getValue();
            if (upValue == null)
                return null;
        }
    }
    return value;
}
Also used : ParameterSet(net.sf.mzmine.parameters.ParameterSet) UserParameter(net.sf.mzmine.parameters.UserParameter)

Aggregations

UserParameter (net.sf.mzmine.parameters.UserParameter)22 JComponent (javax.swing.JComponent)8 RawDataFile (net.sf.mzmine.datamodel.RawDataFile)5 MZmineProject (net.sf.mzmine.datamodel.MZmineProject)4 ArrayList (java.util.ArrayList)3 JComboBox (javax.swing.JComboBox)3 JLabel (javax.swing.JLabel)3 Parameter (net.sf.mzmine.parameters.Parameter)3 ParameterSet (net.sf.mzmine.parameters.ParameterSet)3 GridBagPanel (net.sf.mzmine.util.components.GridBagPanel)3 DataPoint (net.sf.mzmine.datamodel.DataPoint)2 ParameterSetupDialog (net.sf.mzmine.parameters.dialogs.ParameterSetupDialog)2 DoubleParameter (net.sf.mzmine.parameters.parametertypes.DoubleParameter)2 StringParameter (net.sf.mzmine.parameters.parametertypes.StringParameter)2 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 FileReader (java.io.FileReader)1 IOException (java.io.IOException)1 java.util (java.util)1 HashMap (java.util.HashMap)1