use of dulab.adap.datamodel.BetterPeak in project mzmine2 by mzmine.
the class EICPlot method updateData.
// public void updateData(@Nonnull List <List <NavigableMap <Double, Double>>> clusters,
// @Nonnull List <Double> colors,
// @Nonnull List <List <String>> info,
// @Nonnull List <List<Boolean>> models)
// {
// final float DEFAULT_LINE_WIDTH = 1.0f;
// final float THICK_LINE_WIDTH = 2.0f;
//
//
// // for (int i = 0; i < xyDataset.getSeriesCount(); ++i)
// // xyDataset.removeSeries(i);
// xyDataset.removeAllSeries();
// colorDataset.clear();
// toolTips.clear();
// widths.clear();
//
// int seriesID = 0;
//
// for (int i = 0; i < clusters.size(); ++i)
// {
// List <NavigableMap <Double, Double>> cluster = clusters.get(i);
// double color = colors.get(i);
//
// for (int j = 0; j < cluster.size(); ++j)
// {
// XYSeries series = new XYSeries(seriesID++);
//
// for (Entry <Double, Double> e : cluster.get(j).entrySet())
// series.add(e.getKey(), e.getValue());
//
// float width = DEFAULT_LINE_WIDTH;
// if (models.get(i).get(j)) width = THICK_LINE_WIDTH;
//
// xyDataset.addSeries(series);
// colorDataset.add(color);
// toolTips.add(info.get(i).get(j));
// widths.add(width);
// }
// }
// }
void updateData(@Nonnull List<BetterPeak> peaks, @Nonnull List<BetterComponent> modelPeaks) {
xyDataset.removeAllSeries();
xyDataset.setNotify(false);
toolTips.clear();
// Find retention-time range
double startRetTime = Double.MAX_VALUE;
double endRetTime = -Double.MAX_VALUE;
for (BetterPeak peak : modelPeaks) {
if (peak.getFirstRetTime() < startRetTime)
startRetTime = peak.getFirstRetTime();
if (peak.getLastRetTime() > endRetTime)
endRetTime = peak.getLastRetTime();
}
if (endRetTime < startRetTime)
return;
int seriesID = 0;
for (BetterPeak peak : peaks) {
XYSeries series = new XYSeries(seriesID++);
series.setDescription(PeakType.SIMPLE.name());
for (int i = 0; i < peak.chromatogram.length; ++i) {
double retTime = peak.chromatogram.getRetTime(i);
if (startRetTime <= retTime && retTime <= endRetTime)
series.add(peak.chromatogram.getRetTime(i), peak.chromatogram.getIntensity(i));
}
xyDataset.addSeries(series);
toolTips.add(String.format("M/z: %.2f\nIntensity: %.0f", peak.getMZ(), peak.getIntensity()));
}
for (BetterPeak peak : modelPeaks) {
XYSeries series = new XYSeries((seriesID++));
series.setDescription(PeakType.MODEL.name());
for (int i = 0; i < peak.chromatogram.length; ++i) series.add(peak.chromatogram.getRetTime(i), peak.chromatogram.getIntensity(i));
xyDataset.addSeries(series);
toolTips.add(String.format("Model peak\nM/z: %.2f\nIntensity: %.0f", peak.getMZ(), peak.getIntensity()));
}
xyDataset.setNotify(true);
}
Aggregations