use of net.sf.mzmine.datamodel.PeakList in project mzmine2 by mzmine.
the class ADAP3AlignerTask method findPeakListRow.
/**
* Find the existing {@link PeakListRow} for a given feature list ID and row ID.
*
* @param peakListID number of a feature list in the array of {@link PeakList}. The numeration starts with 0.
* @param rowID integer that is returned by method getId() of {@link PeakListRow}.
* @return an instance of {@link PeakListRow} if an existing row is found. Otherwise it returns null.
*/
@Nullable
private PeakListRow findPeakListRow(final int peakListID, final int rowID) {
// Find feature list
PeakList peakList = findPeakList(peakListID);
if (peakList == null)
return null;
// Find row
PeakListRow row = null;
for (final PeakListRow r : peakList.getRows()) if (rowID == r.getID()) {
row = r;
break;
}
return row;
}
use of net.sf.mzmine.datamodel.PeakList in project mzmine2 by mzmine.
the class SmoothingModule method runModule.
@Override
@Nonnull
public ExitCode runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection<Task> tasks) {
PeakList[] peakLists = parameters.getParameter(SmoothingParameters.peakLists).getValue().getMatchingPeakLists();
for (final PeakList peakList : peakLists) {
Task newTask = new SmoothingTask(project, peakList, parameters);
tasks.add(newTask);
}
return ExitCode.OK;
}
use of net.sf.mzmine.datamodel.PeakList in project mzmine2 by mzmine.
the class ProjectOpeningTask method loadPeakList.
private void loadPeakList(InputStream is, String peakListName) throws IOException, ParserConfigurationException, SAXException, InstantiationException, IllegalAccessException {
logger.info("Loading feature list " + peakListName);
currentLoadedObjectName = peakListName;
PeakList newPeakList = peakListOpenHandler.readPeakList(is);
newProject.addPeakList(newPeakList);
// Add quality parameters to peaks
QualityParameters.calculateQualityParameters(newPeakList);
}
use of net.sf.mzmine.datamodel.PeakList in project mzmine2 by mzmine.
the class PeakResolverSetupDialog method addDialogComponents.
/**
* This function add all the additional components for this dialog over the original
* ParameterSetupDialog.
*/
@Override
protected void addDialogComponents() {
super.addDialogComponents();
final PeakList[] peakLists = MZmineCore.getProjectManager().getCurrentProject().getPeakLists();
// Elements of panel.
preview = new JCheckBox("Show preview");
preview.addActionListener(this);
preview.setHorizontalAlignment(SwingConstants.CENTER);
preview.setEnabled(peakLists.length > 0);
// Preview panel.
final JPanel previewPanel = new JPanel(new BorderLayout());
previewPanel.add(new JSeparator(), BorderLayout.NORTH);
previewPanel.add(preview, BorderLayout.CENTER);
previewPanel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH);
// Feature list combo-box.
comboPeakList = new JComboBox<PeakList>();
comboPeakList.setFont(COMBO_FONT);
for (final PeakList peakList : peakLists) {
if (peakList.getNumberOfRawDataFiles() == 1) {
comboPeakList.addItem(peakList);
}
}
comboPeakList.addActionListener(this);
// Peaks combo box.
comboPeak = new JComboBox<PeakListRow>();
comboPeak.setFont(COMBO_FONT);
comboPeak.setRenderer(new PeakPreviewComboRenderer());
comboPeak.setPreferredSize(new Dimension(PREFERRED_PEAK_COMBO_WIDTH, comboPeak.getPreferredSize().height));
pnlLabelsFields = GUIUtils.makeTablePanel(2, 2, new JComponent[] { new JLabel("Feature list"), comboPeakList, new JLabel("Chromatogram"), comboPeak });
// Put all together.
pnlVisible = new JPanel(new BorderLayout());
pnlVisible.add(previewPanel, BorderLayout.NORTH);
// TIC plot.
ticPlot = new TICPlot(this);
ticPlot.setMinimumSize(MINIMUM_TIC_DIMENSIONS);
// Tool bar.
final TICToolBar toolBar = new TICToolBar(ticPlot);
toolBar.getComponentAtIndex(0).setVisible(false);
// Panel for XYPlot.
pnlPlotXY = new JPanel(new BorderLayout());
pnlPlotXY.setBackground(Color.white);
pnlPlotXY.add(ticPlot, BorderLayout.CENTER);
pnlPlotXY.add(toolBar, BorderLayout.EAST);
GUIUtils.addMarginAndBorder(pnlPlotXY, 10);
mainPanel.add(pnlVisible, 0, getNumberOfParameters() + 3, 2, 1, 0, 0, GridBagConstraints.HORIZONTAL);
// Layout and position.
updateBounds();
}
use of net.sf.mzmine.datamodel.PeakList in project mzmine2 by mzmine.
the class ScatterPlotVisualizerModule method runModule.
@Override
@Nonnull
public ExitCode runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection<Task> tasks) {
PeakList[] peakLists = parameters.getParameter(ScatterPlotParameters.peakLists).getValue().getMatchingPeakLists();
if ((peakLists == null) || (peakLists.length != 1)) {
MZmineCore.getDesktop().displayErrorMessage(MZmineCore.getDesktop().getMainWindow(), "Please select a single aligned feature list");
return ExitCode.ERROR;
}
PeakList peakList = peakLists[0];
if (peakList.getNumberOfRawDataFiles() < 2) {
MZmineCore.getDesktop().displayErrorMessage(MZmineCore.getDesktop().getMainWindow(), "There is only one raw data file in the selected " + "feature list, it is necessary at least two for comparison");
return ExitCode.ERROR;
}
ScatterPlotWindow newWindow = new ScatterPlotWindow(peakList);
newWindow.setVisible(true);
return ExitCode.OK;
}
Aggregations