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();
}
}
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();
}
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();
}
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);
}
}
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;
}
Aggregations