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();
}
});
}
}
}
}
}
}
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;
}
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);
}
}
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;
}
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);
}
}
Aggregations