use of net.sf.mzmine.datamodel.PeakList in project mzmine2 by mzmine.
the class PeakListTreeModel method getPeakLists.
public synchronized PeakList[] getPeakLists() {
int childrenCount = getChildCount(rootNode);
PeakList[] result = new PeakList[childrenCount];
for (int j = 0; j < childrenCount; j++) {
DefaultMutableTreeNode child = (DefaultMutableTreeNode) getChild(rootNode, j);
result[j] = (PeakList) child.getUserObject();
}
return result;
}
use of net.sf.mzmine.datamodel.PeakList in project mzmine2 by mzmine.
the class ProjectTreeMouseHandler method handleDoubleClickEvent.
private void handleDoubleClickEvent(MouseEvent e) {
TreePath clickedPath = tree.getPathForLocation(e.getX(), e.getY());
if (clickedPath == null)
return;
DefaultMutableTreeNode node = (DefaultMutableTreeNode) clickedPath.getLastPathComponent();
Object clickedObject = node.getUserObject();
if (clickedObject instanceof RawDataFile) {
RawDataFile clickedFile = (RawDataFile) clickedObject;
TICVisualizerModule.setupNewTICVisualizer(clickedFile);
}
if (clickedObject instanceof PeakList) {
PeakList clickedPeakList = (PeakList) clickedObject;
PeakListTableModule.showNewPeakListVisualizerWindow(clickedPeakList);
}
if (clickedObject instanceof Scan) {
Scan clickedScan = (Scan) clickedObject;
SpectraVisualizerModule.showNewSpectrumWindow(clickedScan.getDataFile(), clickedScan.getScanNumber());
}
if (clickedObject instanceof MassList) {
MassList clickedMassList = (MassList) clickedObject;
Scan clickedScan = clickedMassList.getScan();
SpectraVisualizerWindow window = SpectraVisualizerModule.showNewSpectrumWindow(clickedScan.getDataFile(), clickedScan.getScanNumber());
MassListDataSet dataset = new MassListDataSet(clickedMassList);
window.addDataSet(dataset, Color.green);
}
if (clickedObject instanceof PeakListRow) {
PeakListRow clickedPeak = (PeakListRow) clickedObject;
PeakSummaryVisualizerModule.showNewPeakSummaryWindow(clickedPeak);
}
}
use of net.sf.mzmine.datamodel.PeakList in project mzmine2 by mzmine.
the class RawDataTreeModel method valueForPathChanged.
public void valueForPathChanged(TreePath path, Object value) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
Object object = node.getUserObject();
String newName = (String) value;
if (object instanceof RawDataFile) {
RawDataFile df = (RawDataFile) object;
df.setName(newName);
}
if (object instanceof PeakList) {
PeakList pl = (PeakList) object;
pl.setName(newName);
}
}
use of net.sf.mzmine.datamodel.PeakList in project mzmine2 by mzmine.
the class ADAP3DecompositionV1_5SetupDialog method addDialogComponents.
@Override
protected void addDialogComponents() {
super.addDialogComponents();
comboPeakList = new JComboBox<>();
comboClustersModel = new DefaultComboBoxModel<>();
comboClusters = new JComboBox<>(comboClustersModel);
retTimeMZPlot = new SimpleScatterPlot("Retention time", "m/z");
retTimeIntensityPlot = new EICPlot();
PeakList[] peakLists = MZmineCore.getDesktop().getSelectedPeakLists();
// -----------------------------
// Panel with preview parameters
// -----------------------------
preview = new JCheckBox("Show preview");
preview.addActionListener(this);
preview.setHorizontalAlignment(SwingConstants.CENTER);
if (peakLists == null || peakLists.length == 0)
preview.setEnabled(false);
else
preview.setEnabled(true);
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);
comboPeakList.setFont(COMBO_FONT);
for (final PeakList peakList : peakLists) if (peakList.getNumberOfRawDataFiles() == 1)
comboPeakList.addItem(peakList);
comboPeakList.addActionListener(this);
comboClusters.setFont(COMBO_FONT);
comboClusters.addActionListener(this);
pnlLabelsFields = GUIUtils.makeTablePanel(2, 2, new JComponent[] { new JLabel("Feature list"), comboPeakList, new JLabel("Cluster list"), comboClusters });
pnlVisible = new JPanel(new BorderLayout());
pnlVisible.add(previewPanel, BorderLayout.NORTH);
// --------------------------------------------------------------------
// ----- Tabbed panel with plots --------------------------------------
// --------------------------------------------------------------------
// pnlTabs = new JTabbedPane();
pnlTabs = new JPanel();
pnlTabs.setLayout(new BoxLayout(pnlTabs, BoxLayout.Y_AXIS));
retTimeMZPlot.setMinimumSize(MIN_DIMENSIONS);
JPanel pnlPlotRetTimeClusters = new JPanel(new BorderLayout());
pnlPlotRetTimeClusters.setBackground(Color.white);
pnlPlotRetTimeClusters.add(retTimeMZPlot, BorderLayout.CENTER);
GUIUtils.addMarginAndBorder(pnlPlotRetTimeClusters, 10);
pnlTabs.add(pnlPlotRetTimeClusters);
retTimeIntensityPlot.setMinimumSize(MIN_DIMENSIONS);
JPanel pnlPlotShapeClusters = new JPanel(new BorderLayout());
pnlPlotShapeClusters.setBackground(Color.white);
pnlPlotShapeClusters.add(retTimeIntensityPlot, BorderLayout.CENTER);
GUIUtils.addMarginAndBorder(pnlPlotShapeClusters, 10);
pnlTabs.add(pnlPlotShapeClusters);
super.mainPanel.add(pnlVisible, 0, super.getNumberOfParameters() + 3, 2, 1, 0, 0, GridBagConstraints.HORIZONTAL);
}
use of net.sf.mzmine.datamodel.PeakList in project mzmine2 by mzmine.
the class ADAP3DecompositionV1_5Task method decomposePeaks.
private PeakList decomposePeaks(PeakList peakList) throws CloneNotSupportedException, IOException {
RawDataFile dataFile = peakList.getRawDataFile(0);
// Create new feature list.
final PeakList resolvedPeakList = new SimplePeakList(peakList + " " + parameters.getParameter(ADAP3DecompositionV1_5Parameters.SUFFIX).getValue(), dataFile);
// Load previous applied methods.
for (final PeakList.PeakListAppliedMethod method : peakList.getAppliedMethods()) {
resolvedPeakList.addDescriptionOfAppliedTask(method);
}
// Add task description to feature list.
resolvedPeakList.addDescriptionOfAppliedTask(new SimplePeakListAppliedMethod("Peak deconvolution by ADAP-3", parameters));
// Collect peak information
List<Peak> peaks = getPeaks(peakList, this.parameters.getParameter(ADAP3DecompositionV1_5Parameters.EDGE_TO_HEIGHT_RATIO).getValue(), this.parameters.getParameter(ADAP3DecompositionV1_5Parameters.DELTA_TO_HEIGHT_RATIO).getValue());
// Find components (a.k.a. clusters of peaks with fragmentation spectra)
List<Component> components = getComponents(peaks);
// Create PeakListRow for each components
List<PeakListRow> newPeakListRows = new ArrayList<>();
int rowID = 0;
for (final Component component : components) {
if (component.getSpectrum().isEmpty())
continue;
PeakListRow row = new SimplePeakListRow(++rowID);
// Add the reference peak
PeakListRow refPeakRow = originalPeakList.getRow(component.getBestPeak().getInfo().peakID);
Feature refPeak = new SimpleFeature(refPeakRow.getBestPeak());
// Add spectrum
List<DataPoint> dataPoints = new ArrayList<>();
for (Map.Entry<Double, Double> entry : component.getSpectrum().entrySet()) {
dataPoints.add(new SimpleDataPoint(entry.getKey(), entry.getValue()));
}
refPeak.setIsotopePattern(new SimpleIsotopePattern(dataPoints.toArray(new DataPoint[dataPoints.size()]), IsotopePattern.IsotopePatternStatus.PREDICTED, "Spectrum"));
row.addPeak(dataFile, refPeak);
// Add PeakInformation
if (refPeakRow.getPeakInformation() == null) {
SimplePeakInformation information = new SimplePeakInformation(new HashMap<>(refPeakRow.getPeakInformation().getAllProperties()));
row.setPeakInformation(information);
}
// Set row properties
row.setAverageMZ(refPeakRow.getAverageMZ());
row.setAverageRT(refPeakRow.getAverageRT());
// resolvedPeakList.addRow(row);
newPeakListRows.add(row);
}
// ------------------------------------
// Sort new peak rows by retention time
// ------------------------------------
Collections.sort(newPeakListRows, new Comparator<PeakListRow>() {
@Override
public int compare(PeakListRow row1, PeakListRow row2) {
double retTime1 = row1.getAverageRT();
double retTime2 = row2.getAverageRT();
return Double.compare(retTime1, retTime2);
}
});
for (PeakListRow row : newPeakListRows) resolvedPeakList.addRow(row);
return resolvedPeakList;
}
Aggregations