Search in sources :

Example 1 with PeakList

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;
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) PeakList(net.sf.mzmine.datamodel.PeakList)

Example 2 with PeakList

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);
    }
}
Also used : SpectraVisualizerWindow(net.sf.mzmine.modules.visualization.spectra.simplespectra.SpectraVisualizerWindow) PeakListRow(net.sf.mzmine.datamodel.PeakListRow) TreePath(javax.swing.tree.TreePath) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) Scan(net.sf.mzmine.datamodel.Scan) PeakList(net.sf.mzmine.datamodel.PeakList) MassListDataSet(net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.MassListDataSet) MassList(net.sf.mzmine.datamodel.MassList)

Example 3 with PeakList

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);
    }
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) PeakList(net.sf.mzmine.datamodel.PeakList)

Example 4 with PeakList

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);
}
Also used : JPanel(javax.swing.JPanel) BoxLayout(javax.swing.BoxLayout) JComponent(javax.swing.JComponent) JLabel(javax.swing.JLabel) JSeparator(javax.swing.JSeparator) JCheckBox(javax.swing.JCheckBox) BorderLayout(java.awt.BorderLayout) PeakList(net.sf.mzmine.datamodel.PeakList)

Example 5 with PeakList

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;
}
Also used : ArrayList(java.util.ArrayList) SimplePeakListAppliedMethod(net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod) SimplePeakListRow(net.sf.mzmine.datamodel.impl.SimplePeakListRow) Feature(net.sf.mzmine.datamodel.Feature) SimpleFeature(net.sf.mzmine.datamodel.impl.SimpleFeature) SimpleDataPoint(net.sf.mzmine.datamodel.impl.SimpleDataPoint) SimplePeakListRow(net.sf.mzmine.datamodel.impl.SimplePeakListRow) PeakListRow(net.sf.mzmine.datamodel.PeakListRow) DataPoint(net.sf.mzmine.datamodel.DataPoint) SimpleDataPoint(net.sf.mzmine.datamodel.impl.SimpleDataPoint) Peak(dulab.adap.datamodel.Peak) SimplePeakList(net.sf.mzmine.datamodel.impl.SimplePeakList) SimpleIsotopePattern(net.sf.mzmine.datamodel.impl.SimpleIsotopePattern) Component(dulab.adap.datamodel.Component) SimplePeakInformation(net.sf.mzmine.datamodel.impl.SimplePeakInformation) DataPoint(net.sf.mzmine.datamodel.DataPoint) SimpleDataPoint(net.sf.mzmine.datamodel.impl.SimpleDataPoint) SimpleFeature(net.sf.mzmine.datamodel.impl.SimpleFeature) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) SimplePeakList(net.sf.mzmine.datamodel.impl.SimplePeakList) PeakList(net.sf.mzmine.datamodel.PeakList) HashMap(java.util.HashMap) Map(java.util.Map) NavigableMap(java.util.NavigableMap) TreeMap(java.util.TreeMap)

Aggregations

PeakList (net.sf.mzmine.datamodel.PeakList)120 PeakListRow (net.sf.mzmine.datamodel.PeakListRow)41 Nonnull (javax.annotation.Nonnull)40 Task (net.sf.mzmine.taskcontrol.Task)37 RawDataFile (net.sf.mzmine.datamodel.RawDataFile)36 SimplePeakList (net.sf.mzmine.datamodel.impl.SimplePeakList)26 Feature (net.sf.mzmine.datamodel.Feature)19 ArrayList (java.util.ArrayList)15 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)11 SimplePeakListAppliedMethod (net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod)11 SimplePeakListRow (net.sf.mzmine.datamodel.impl.SimplePeakListRow)10 File (java.io.File)9 FileWriter (java.io.FileWriter)8 ParameterSet (net.sf.mzmine.parameters.ParameterSet)8 IOException (java.io.IOException)7 DataPoint (net.sf.mzmine.datamodel.DataPoint)7 Vector (java.util.Vector)6 IsotopePattern (net.sf.mzmine.datamodel.IsotopePattern)6 MZmineProject (net.sf.mzmine.datamodel.MZmineProject)6 PeakIdentity (net.sf.mzmine.datamodel.PeakIdentity)6