Search in sources :

Example 56 with PeakListRow

use of net.sf.mzmine.datamodel.PeakListRow in project mzmine2 by mzmine.

the class Fx3DStageController method addMenuItems.

private void addMenuItems() {
    removeMenu.getItems().clear();
    for (Fx3DAbstractDataset dataset : visualizedMeshPlots) {
        MenuItem menuItem = new MenuItem(dataset.getFileName());
        removeMenu.getItems().add(menuItem);
        menuItem.setOnAction(new EventHandler<ActionEvent>() {

            public void handle(ActionEvent e) {
                LOG.finest("Context menu invoked. Remove Data file button clicked. Removing dataset " + dataset.getFileName() + " from the plot.");
                visualizedFiles.remove(dataset.getFile());
                visualizedMeshPlots.remove(dataset);
                updateGraph();
                addMenuItems();
            }
        });
    }
    addDatafileMenu.getItems().clear();
    for (RawDataFile file : allDataFiles) {
        if (!visualizedFiles.contains(file)) {
            MenuItem menuItem = new MenuItem(file.getName());
            addDatafileMenu.getItems().add(menuItem);
            final Fx3DStageController controller = this;
            menuItem.setOnAction(new EventHandler<ActionEvent>() {

                public void handle(ActionEvent e) {
                    LOG.finest("Context menu invoked. Add Data file button clicked. Adding dataset " + file.getName() + " to the plot.");
                    MZmineCore.getTaskController().addTask(new Fx3DSamplingTask(file, scanSel, mzRange, rtResolution, mzResolution, controller), TaskPriority.HIGH);
                    addMenuItems();
                }
            });
        }
    }
    addFeatureMenu.getItems().clear();
    for (PeakList peakList : allPeakLists) {
        Menu peakListMenu = new Menu(peakList.getName());
        addFeatureMenu.getItems().add(peakListMenu);
        RawDataFile[] dataFiles = peakList.getRawDataFiles();
        for (RawDataFile dataFile : dataFiles) {
            Menu dataFileMenu = new Menu(dataFile.getName());
            peakListMenu.getItems().add(dataFileMenu);
            Feature[] features = peakList.getPeaks(dataFile);
            for (Feature feature : features) {
                if (feature.getRawDataPointsRTRange().lowerEndpoint() >= rtRange.lowerEndpoint() && feature.getRawDataPointsRTRange().upperEndpoint() <= mzRange.upperEndpoint() && feature.getRawDataPointsMZRange().lowerEndpoint() >= mzRange.lowerEndpoint() && feature.getRawDataPointsMZRange().upperEndpoint() <= mzRange.upperEndpoint()) {
                    if (!visualizedFiles.contains(feature)) {
                        MenuItem menuItem = new MenuItem(feature.toString());
                        dataFileMenu.getItems().add(menuItem);
                        menuItem.setOnAction(new EventHandler<ActionEvent>() {

                            public void handle(ActionEvent e) {
                                LOG.finest("Context menu invoked. Add Feature button clicked. Adding dataset " + feature.toString() + " to the plot.");
                                PeakListRow row = peakList.getPeakRow(feature);
                                FeatureSelection featureSelection = new FeatureSelection(peakList, feature, row, dataFile);
                                Fx3DFeatureDataset featureDataset = new Fx3DFeatureDataset(featureSelection, rtResolution, mzResolution, rtRange, mzRange, maxOfAllBinnedIntensity, Color.rgb(165, 42, 42, 0.9));
                                addDataset(featureDataset);
                                addMenuItems();
                            }
                        });
                    }
                }
            }
        }
    }
}
Also used : ActionEvent(javafx.event.ActionEvent) MenuItem(javafx.scene.control.MenuItem) Feature(net.sf.mzmine.datamodel.Feature) PeakListRow(net.sf.mzmine.datamodel.PeakListRow) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) Menu(javafx.scene.control.Menu) PeakList(net.sf.mzmine.datamodel.PeakList) FeatureSelection(net.sf.mzmine.parameters.parametertypes.selectors.FeatureSelection)

Example 57 with PeakListRow

use of net.sf.mzmine.datamodel.PeakListRow in project mzmine2 by mzmine.

the class PeakListTable method getCustomToolTipComponent.

public JComponent getCustomToolTipComponent(MouseEvent event) {
    JComponent component = null;
    String text = this.getToolTipText(event);
    if (text == null) {
        return null;
    }
    if (text.contains(ComponentToolTipManager.CUSTOM)) {
        String[] values = text.split("-");
        int myID = Integer.parseInt(values[1].trim());
        for (PeakListRow row : peakList.getRows()) {
            if (row.getID() == myID) {
                component = new PeakSummaryComponent(row, peakList.getRawDataFiles(), true, false, false, true, false, ComponentToolTipManager.bg);
                break;
            }
        }
    } else {
        text = "<html>" + text.replace("\n", "<br>") + "</html>";
        JLabel label = new JLabel(text);
        label.setFont(UIManager.getFont("ToolTip.font"));
        JPanel panel = new JPanel();
        panel.setBackground(ComponentToolTipManager.bg);
        panel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
        panel.add(label);
        component = panel;
    }
    return component;
}
Also used : JPanel(javax.swing.JPanel) PeakListRow(net.sf.mzmine.datamodel.PeakListRow) JComponent(javax.swing.JComponent) JLabel(javax.swing.JLabel) PeakSummaryComponent(net.sf.mzmine.util.components.PeakSummaryComponent)

Example 58 with PeakListRow

use of net.sf.mzmine.datamodel.PeakListRow in project mzmine2 by mzmine.

the class PeakListTableModel method setValueAt.

public void setValueAt(Object value, int row, int col) {
    CommonColumnType columnType = getCommonColumn(col);
    PeakListRow peakListRow = peakList.getRow(row);
    if (columnType == CommonColumnType.COMMENT) {
        peakListRow.setComment((String) value);
    }
    if (columnType == CommonColumnType.IDENTITY) {
        if (value instanceof PeakIdentity)
            peakListRow.setPreferredPeakIdentity((PeakIdentity) value);
    }
}
Also used : PeakIdentity(net.sf.mzmine.datamodel.PeakIdentity) PeakListRow(net.sf.mzmine.datamodel.PeakListRow)

Example 59 with PeakListRow

use of net.sf.mzmine.datamodel.PeakListRow in project mzmine2 by mzmine.

the class PeakListTableModel method getValueAt.

/**
 * This method returns the value at given coordinates of the dataset or null if it is a missing
 * value
 */
public Object getValueAt(int row, int col) {
    PeakListRow peakListRow = peakList.getRow(row);
    if (isCommonColumn(col)) {
        CommonColumnType commonColumn = getCommonColumn(col);
        switch(commonColumn) {
            case ROWID:
                return new Integer(peakListRow.getID());
            case AVERAGEMZ:
                return new Double(peakListRow.getAverageMZ());
            case AVERAGERT:
                if (peakListRow.getAverageRT() <= 0)
                    return null;
                return new Double(peakListRow.getAverageRT());
            case COMMENT:
                return peakListRow.getComment();
            case IDENTITY:
                return peakListRow.getPreferredPeakIdentity();
            case PEAKSHAPE:
                return peakListRow;
        }
    } else {
        DataFileColumnType dataFileColumn = getDataFileColumn(col);
        RawDataFile file = getColumnDataFile(col);
        Feature peak = peakListRow.getPeak(file);
        if (peak == null) {
            if (dataFileColumn == DataFileColumnType.STATUS)
                return FeatureStatus.UNKNOWN;
            else
                return null;
        }
        switch(dataFileColumn) {
            case STATUS:
                return peak.getFeatureStatus();
            case PEAKSHAPE:
                return peak;
            case MZ:
                return peak.getMZ();
            case RT:
                if (peak.getRT() <= 0)
                    return null;
                return peak.getRT();
            case HEIGHT:
                if (peak.getHeight() <= 0)
                    return null;
                return peak.getHeight();
            case AREA:
                return peak.getArea();
            case DURATION:
                double rtLen = peak.getRawDataPointsRTRange().upperEndpoint() - peak.getRawDataPointsRTRange().lowerEndpoint();
                return rtLen;
            case CHARGE:
                if (peak.getCharge() <= 0)
                    return null;
                return new Integer(peak.getCharge());
            case RT_START:
                return peak.getRawDataPointsRTRange().lowerEndpoint();
            case RT_END:
                return peak.getRawDataPointsRTRange().upperEndpoint();
            case DATAPOINTS:
                return peak.getScanNumbers().length;
            case FWHM:
                return peak.getFWHM();
            case TF:
                return peak.getTailingFactor();
            case AF:
                return peak.getAsymmetryFactor();
            case PARENT_ROW_ID:
                return peak.getParentChromatogramRowID();
        }
    }
    return null;
}
Also used : PeakListRow(net.sf.mzmine.datamodel.PeakListRow) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) Feature(net.sf.mzmine.datamodel.Feature)

Example 60 with PeakListRow

use of net.sf.mzmine.datamodel.PeakListRow in project mzmine2 by mzmine.

the class IntensityPlotModule method showIntensityPlot.

public static void showIntensityPlot(@Nonnull MZmineProject project, PeakList peakList, PeakListRow[] rows) {
    ParameterSet parameters = MZmineCore.getConfiguration().getModuleParameters(IntensityPlotModule.class);
    parameters.getParameter(IntensityPlotParameters.peakList).setValue(PeakListsSelectionType.SPECIFIC_PEAKLISTS, new PeakList[] { peakList });
    parameters.getParameter(IntensityPlotParameters.dataFiles).setChoices(peakList.getRawDataFiles());
    parameters.getParameter(IntensityPlotParameters.dataFiles).setValue(peakList.getRawDataFiles());
    parameters.getParameter(IntensityPlotParameters.selectedRows).setValue(rows);
    UserParameter<?, ?>[] projectParams = project.getParameters();
    Object[] xAxisSources = new Object[projectParams.length + 1];
    xAxisSources[0] = IntensityPlotParameters.rawDataFilesOption;
    for (int i = 0; i < projectParams.length; i++) {
        xAxisSources[i + 1] = new ParameterWrapper(projectParams[i]);
    }
    parameters.getParameter(IntensityPlotParameters.xAxisValueSource).setChoices(xAxisSources);
    ExitCode exitCode = parameters.showSetupDialog(null, true);
    if (exitCode == ExitCode.OK) {
        PeakListRow[] selectedRows = parameters.getParameter(IntensityPlotParameters.selectedRows).getMatchingRows(peakList);
        if (selectedRows.length == 0) {
            MZmineCore.getDesktop().displayErrorMessage(null, "No rows selected");
            return;
        }
        IntensityPlotWindow newFrame = new IntensityPlotWindow(parameters.cloneParameterSet());
        newFrame.setVisible(true);
    }
}
Also used : ParameterSet(net.sf.mzmine.parameters.ParameterSet) UserParameter(net.sf.mzmine.parameters.UserParameter) PeakListRow(net.sf.mzmine.datamodel.PeakListRow) ExitCode(net.sf.mzmine.util.ExitCode)

Aggregations

PeakListRow (net.sf.mzmine.datamodel.PeakListRow)148 Feature (net.sf.mzmine.datamodel.Feature)71 RawDataFile (net.sf.mzmine.datamodel.RawDataFile)55 SimplePeakListRow (net.sf.mzmine.datamodel.impl.SimplePeakListRow)54 PeakList (net.sf.mzmine.datamodel.PeakList)44 SimplePeakList (net.sf.mzmine.datamodel.impl.SimplePeakList)39 ArrayList (java.util.ArrayList)31 SimpleFeature (net.sf.mzmine.datamodel.impl.SimpleFeature)31 DataPoint (net.sf.mzmine.datamodel.DataPoint)29 SimplePeakListAppliedMethod (net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod)26 Scan (net.sf.mzmine.datamodel.Scan)25 PeakIdentity (net.sf.mzmine.datamodel.PeakIdentity)20 PeakListRowSorter (net.sf.mzmine.util.PeakListRowSorter)17 SimpleDataPoint (net.sf.mzmine.datamodel.impl.SimpleDataPoint)13 PeakListAppliedMethod (net.sf.mzmine.datamodel.PeakList.PeakListAppliedMethod)12 HashMap (java.util.HashMap)11 Vector (java.util.Vector)11 ParameterSet (net.sf.mzmine.parameters.ParameterSet)11 IsotopePattern (net.sf.mzmine.datamodel.IsotopePattern)10 MassList (net.sf.mzmine.datamodel.MassList)10