Search in sources :

Example 6 with RawDataFile

use of net.sf.mzmine.datamodel.RawDataFile 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 7 with RawDataFile

use of net.sf.mzmine.datamodel.RawDataFile 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 8 with RawDataFile

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

the class Fx3DVisualizerModule method runModule.

@SuppressWarnings("null")
@Override
@Nonnull
public ExitCode runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection<Task> tasks) {
    final RawDataFile[] currentDataFiles = parameters.getParameter(Fx3DVisualizerParameters.dataFiles).getValue().getMatchingRawDataFiles();
    final ScanSelection scanSel = parameters.getParameter(Fx3DVisualizerParameters.scanSelection).getValue();
    final List<FeatureSelection> featureSelList = parameters.getParameter(Fx3DVisualizerParameters.features).getValue();
    LOG.finest("Feature selection is:" + featureSelList.toString());
    for (FeatureSelection selection : featureSelList) {
        LOG.finest("Selected features are:" + selection.getFeature().toString());
    }
    Range<Double> rtRange = ScanUtils.findRtRange(scanSel.getMatchingScans(MZmineCore.getProjectManager().getCurrentProject().getDataFiles()[0]));
    ParameterSet myParameters = MZmineCore.getConfiguration().getModuleParameters(Fx3DVisualizerModule.class);
    Range<Double> mzRange = myParameters.getParameter(Fx3DVisualizerParameters.mzRange).getValue();
    int rtRes = myParameters.getParameter(Fx3DVisualizerParameters.rtResolution).getValue();
    int mzRes = myParameters.getParameter(Fx3DVisualizerParameters.mzResolution).getValue();
    Platform.runLater(() -> {
        if (!Platform.isSupported(ConditionalFeature.SCENE3D)) {
            JOptionPane.showMessageDialog(null, "The platform does not provide 3D support.");
            return;
        }
        FXMLLoader loader = new FXMLLoader((getClass().getResource("Fx3DStage.fxml")));
        Stage stage = null;
        try {
            stage = loader.load();
            LOG.finest("Stage has been successfully loaded from the FXML loader.");
        } catch (IOException e) {
            e.printStackTrace();
            return;
        }
        String title = "";
        Fx3DStageController controller = loader.getController();
        controller.setScanSelection(scanSel);
        controller.setRtAndMzResolutions(rtRes, mzRes);
        controller.setRtAndMzValues(rtRange, mzRange);
        for (int i = 0; i < currentDataFiles.length; i++) {
            MZmineCore.getTaskController().addTask(new Fx3DSamplingTask(currentDataFiles[i], scanSel, mzRange, rtRes, mzRes, controller), TaskPriority.HIGH);
        }
        controller.addFeatureSelections(featureSelList);
        for (int i = 0; i < currentDataFiles.length; i++) {
            title = title + currentDataFiles[i].toString() + " ";
        }
        stage.show();
        stage.setMinWidth(stage.getWidth());
        stage.setMinHeight(stage.getHeight());
    });
    return ExitCode.OK;
}
Also used : ParameterSet(net.sf.mzmine.parameters.ParameterSet) ScanSelection(net.sf.mzmine.parameters.parametertypes.selectors.ScanSelection) IOException(java.io.IOException) FXMLLoader(javafx.fxml.FXMLLoader) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) Stage(javafx.stage.Stage) FeatureSelection(net.sf.mzmine.parameters.parametertypes.selectors.FeatureSelection) Nonnull(javax.annotation.Nonnull)

Example 9 with RawDataFile

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

the class HistogramPlotDataset method updateHistogramDataset.

public void updateHistogramDataset() {
    this.list.clear();
    Feature[] peaks;
    double[] values = null;
    for (RawDataFile dataFile : rawDataFiles) {
        peaks = peakList.getPeaks(dataFile);
        values = new double[peaks.length];
        for (int i = 0; i < peaks.length; i++) {
            switch(dataType) {
                case AREA:
                    values[i] = peaks[i].getArea();
                    break;
                case HEIGHT:
                    values[i] = peaks[i].getHeight();
                    break;
                case MASS:
                    values[i] = peaks[i].getMZ();
                    break;
                case RT:
                    values[i] = peaks[i].getRT();
                    break;
            }
        }
        addSeries(dataFile.getName(), values);
    }
}
Also used : RawDataFile(net.sf.mzmine.datamodel.RawDataFile) Feature(net.sf.mzmine.datamodel.Feature)

Example 10 with RawDataFile

use of net.sf.mzmine.datamodel.RawDataFile 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)

Aggregations

RawDataFile (net.sf.mzmine.datamodel.RawDataFile)185 Feature (net.sf.mzmine.datamodel.Feature)59 PeakListRow (net.sf.mzmine.datamodel.PeakListRow)52 DataPoint (net.sf.mzmine.datamodel.DataPoint)51 Scan (net.sf.mzmine.datamodel.Scan)40 ArrayList (java.util.ArrayList)33 PeakList (net.sf.mzmine.datamodel.PeakList)33 Nonnull (javax.annotation.Nonnull)24 SimpleDataPoint (net.sf.mzmine.datamodel.impl.SimpleDataPoint)24 SimplePeakList (net.sf.mzmine.datamodel.impl.SimplePeakList)24 SimplePeakListRow (net.sf.mzmine.datamodel.impl.SimplePeakListRow)22 Task (net.sf.mzmine.taskcontrol.Task)20 SimplePeakListAppliedMethod (net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod)19 SimpleFeature (net.sf.mzmine.datamodel.impl.SimpleFeature)17 IOException (java.io.IOException)14 ParameterSet (net.sf.mzmine.parameters.ParameterSet)14 File (java.io.File)13 MassList (net.sf.mzmine.datamodel.MassList)13 PeakListAppliedMethod (net.sf.mzmine.datamodel.PeakList.PeakListAppliedMethod)13 TreeMap (java.util.TreeMap)10