use of net.sf.mzmine.chartbasics.gui.swing.EChartPanel in project mzmine2 by mzmine.
the class MultiMSMSWindow method updateAllCharts.
/**
* Create new charts
*/
public void updateAllCharts() {
msone = null;
group = new ChartGroup(showCrosshair, showCrosshair, true, false);
// MS1
if (createMS1) {
Scan scan = null;
Feature best = null;
for (PeakListRow r : rows) {
Feature f = raw == null ? r.getBestPeak() : r.getPeak(raw);
if (f != null && (best == null || f.getHeight() > best.getHeight())) {
best = f;
}
}
if (best != null) {
scan = best.getDataFile().getScan(best.getRepresentativeScanNumber());
EChartPanel cp = SpectrumChartFactory.createScanChartPanel(scan, showTitle, showLegend);
if (cp != null)
msone = new ChartViewWrapper(cp);
}
} else {
// pseudo MS1 from all rows and isotope pattern
EChartPanel cp = PseudoSpectrum.createChartPanel(rows, raw, false, "pseudo");
if (cp != null) {
cp.getChart().getLegend().setVisible(showLegend);
cp.getChart().getTitle().setVisible(showTitle);
msone = new ChartViewWrapper(cp);
}
}
if (msone != null)
group.add(msone);
// MS2 of all rows
for (PeakListRow row : rows) {
EChartPanel c = SpectrumChartFactory.createMSMSChartPanel(row, raw, showTitle, showLegend, alwaysShowBest, useBestForMissingRaw);
if (c != null) {
group.add(new ChartViewWrapper(c));
}
}
renewCharts(group);
}
use of net.sf.mzmine.chartbasics.gui.swing.EChartPanel in project mzmine2 by mzmine.
the class SpectrumChartFactory method createChartPanel.
public static EChartPanel createChartPanel(JFreeChart chart) {
if (chart == null)
return null;
//
EChartPanel pn = new EChartPanel(chart);
XYItemRenderer renderer = chart.getXYPlot().getRenderer();
PseudoSpectraItemLabelGenerator labelGenerator = new PseudoSpectraItemLabelGenerator(pn);
renderer.setDefaultItemLabelsVisible(true);
renderer.setDefaultItemLabelPaint(Color.BLACK);
renderer.setSeriesItemLabelGenerator(0, labelGenerator);
return pn;
}
use of net.sf.mzmine.chartbasics.gui.swing.EChartPanel in project mzmine2 by mzmine.
the class PseudoSpectrum method createChartPanel.
public static EChartPanel createChartPanel(PeakListRow[] group, RawDataFile raw, boolean sum, String title) {
PseudoSpectrumDataSet data = createDataSet(group, raw, sum);
if (data == null)
return null;
JFreeChart chart = createChart(data, raw, sum, title);
if (chart != null) {
EChartPanel pn = new EChartPanel(chart);
XYItemRenderer renderer = chart.getXYPlot().getRenderer();
PseudoSpectraItemLabelGenerator labelGenerator = new PseudoSpectraItemLabelGenerator(pn);
renderer.setDefaultItemLabelsVisible(true);
renderer.setDefaultItemLabelPaint(Color.BLACK);
renderer.setSeriesItemLabelGenerator(0, labelGenerator);
return pn;
}
return null;
}
use of net.sf.mzmine.chartbasics.gui.swing.EChartPanel in project mzmine2 by mzmine.
the class VanKrevelenDiagramTask method run.
@Override
public void run() {
try {
setStatus(TaskStatus.PROCESSING);
logger.info("Create Van Krevelen diagram of " + peakList);
// Task canceled?
if (isCanceled())
return;
JFreeChart chart = null;
// 2D, if no third dimension was selected
if (zAxisLabel.equals("none")) {
chart = create2DVanKrevelenDiagram();
} else // 3D, if a third dimension was selected
{
chart = create3DVanKrevelenDiagram();
}
chart.setBackgroundPaint(Color.white);
// create chart JPanel
EChartPanel chartPanel = new EChartPanel(chart, true, true, true, true, false);
// Create Van Krevelen Diagram window
VanKrevelenDiagramWindow frame = new VanKrevelenDiagramWindow(chart, chartPanel, filteredRows);
// create chart JPanel
frame.add(chartPanel, BorderLayout.CENTER);
// set title properties
TextTitle chartTitle = chart.getTitle();
chartTitle.setMargin(5, 0, 0, 0);
chartTitle.setFont(titleFont);
LegendTitle legend = chart.getLegend();
legend.setVisible(false);
frame.setTitle(title);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setBackground(Color.white);
frame.setVisible(true);
frame.pack();
logger.info("Finished creating van Krevelen diagram of " + peakList);
JOptionPane.showMessageDialog(frame, "Results summary:\n" + displayedFeatures + " feature list rows are displayed in the Van Krevelen diagram.\n" + featuresWithFormulasWithoutCHO + " feature list rows are not displayed, because the annotated molecular formula does not contain the elements C, H, and O.\n" + featuresWithoutFormula + " feature list rows are not displayed, because no molecular formula was assigned.");
setStatus(TaskStatus.FINISHED);
} catch (Throwable t) {
setErrorMessage("Nothing to plot here or some peaks have other identities than molecular formulas.\n" + "Have you annotated your features with molecular formulas?\n" + "You can use the feature list method \"Formula prediction\" to handle the task.");
setStatus(TaskStatus.ERROR);
}
}
use of net.sf.mzmine.chartbasics.gui.swing.EChartPanel in project mzmine2 by mzmine.
the class MSMSLibrarySubmissionWindow method updateAllChartSelectors.
/**
* Create new scan selector panels
*/
public void updateAllChartSelectors() {
group = new ChartGroup(showCrosshair, showCrosshair, true, false);
pnCharts.removeAll();
GridLayout layout = new GridLayout(0, 1);
pnCharts.setLayout(layout);
if (checkInput()) {
Integer minSignals = paramSubmit.getParameter(LibrarySubmitParameters.minSignals).getValue();
Double noiseLevel = paramSubmit.getParameter(LibrarySubmitParameters.noiseLevel).getValue();
String massListName = paramSubmit.getParameter(LibrarySubmitParameters.massList).getValue();
if (minSignals != null && noiseLevel != null && massListName != null) {
ScanSortMode sort = (ScanSortMode) getComboSortMode().getSelectedItem();
if (rows != null) {
// create MS2 of all rows
for (int i = 0; i < rows.length; i++) {
PeakListRow row = rows[i];
ScanSelectPanel pn = new ScanSelectPanel(row, sort, noiseLevel, minSignals, massListName);
pnScanSelect[i] = pn;
pn.addChartChangedListener(chart -> regroupCharts());
pnCharts.add(pn);
// add to group
EChartPanel c = pn.getChart();
if (c != null) {
group.add(new ChartViewWrapper(c));
}
}
} else if (scanList != null) {
// all selectors of scanlist
for (int i = 0; i < scanList.size(); i++) {
Scan[] scansEntry = scanList.get(i);
ScanSelectPanel pn = new ScanSelectPanel(scansEntry, sort, noiseLevel, minSignals, massListName);
pnScanSelect[i] = pn;
pn.addChartChangedListener(chart -> regroupCharts());
pnCharts.add(pn);
// add to group
EChartPanel c = pn.getChart();
if (c != null) {
group.add(new ChartViewWrapper(c));
}
}
}
}
streamSelection().forEach(pn -> {
pn.setFragmentScan(isFragmentScan);
// only show exclude/check button if more than 1 entry
pn.setShowExcludeButton(pnScanSelect.length > 1);
});
}
pnCharts.revalidate();
pnCharts.repaint();
}
Aggregations