use of net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.IsotopesDataSet in project mzmine2 by mzmine.
the class DPPIsotopeGrouperTask method compressIsotopeDataSets.
/**
* This method generates a single IsotopesDataSet from all detected isotope patterns in the
* results.
*
* @param dataPoints
* @return
*/
private IsotopesDataSet compressIsotopeDataSets(ProcessedDataPoint[] dataPoints) {
List<IsotopePattern> list = new ArrayList<>();
for (ProcessedDataPoint dp : dataPoints) {
if (dp.resultTypeExists(ResultType.ISOTOPEPATTERN)) {
list.add(((DPPIsotopePatternResult) dp.getFirstResultByType(ResultType.ISOTOPEPATTERN)).getValue());
}
}
if (list.isEmpty())
return null;
List<DataPoint> dpList = new ArrayList<>();
for (IsotopePattern pattern : list) {
for (DataPoint dp : pattern.getDataPoints()) dpList.add(dp);
}
if (dpList.isEmpty())
return null;
IsotopePattern full = new SimpleIsotopePattern(dpList.toArray(new DataPoint[0]), IsotopePatternStatus.DETECTED, "Isotope patterns");
return new IsotopesDataSet(full);
}
use of net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.IsotopesDataSet in project mzmine2 by mzmine.
the class SpectraVisualizerWindow method loadSpectrum.
public void loadSpectrum(IsotopePattern newPattern) {
Color newColor = newPattern.getStatus() == IsotopePatternStatus.DETECTED ? detectedIsotopesColor : predictedIsotopesColor;
IsotopesDataSet newDataSet = new IsotopesDataSet(newPattern);
spectrumPlot.addDataSet(newDataSet, newColor, true);
}
use of net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.IsotopesDataSet in project mzmine2 by mzmine.
the class SpectraVisualizerWindow method loadIsotopes.
public void loadIsotopes(IsotopePattern newPattern) {
// We need to find a normalization factor for the new isotope
// pattern, to show meaningful intensity range
double mz = newPattern.getHighestDataPoint().getMZ();
Range<Double> searchMZRange = Range.closed(mz - 0.5, mz + 0.5);
ScanDataSet scanDataSet = spectrumPlot.getMainScanDataSet();
double normalizationFactor = scanDataSet.getHighestIntensity(searchMZRange);
// whole scan as normalization factor.
if (normalizationFactor == 0) {
searchMZRange = Range.atLeast(0.0);
normalizationFactor = scanDataSet.getHighestIntensity(searchMZRange);
}
IsotopePattern normalizedPattern = IsotopePatternCalculator.normalizeIsotopePattern(newPattern, normalizationFactor);
Color newColor;
if (newPattern.getStatus() == IsotopePatternStatus.DETECTED)
newColor = detectedIsotopesColor;
else
newColor = predictedIsotopesColor;
IsotopesDataSet newDataSet = new IsotopesDataSet(normalizedPattern);
spectrumPlot.addDataSet(newDataSet, newColor, true);
}
use of net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.IsotopesDataSet in project mzmine2 by mzmine.
the class DPPAnyElementIsotopeGrouperTask method displayResults.
@Override
public void displayResults() {
if (displayResults || getController().isLastTaskRunning()) {
// getTargetPlot().addDataSet(compressIsotopeDataSets(getResults()), Color.GREEN, false);
int i = 0;
for (ProcessedDataPoint result : getResults()) if (result.resultTypeExists(ResultType.ISOTOPEPATTERN))
i++;
if (i == 0)
i = 1;
List<Color> clr = generateRainbowColors(i);
int j = 0;
for (ProcessedDataPoint result : getResults()) if (result.resultTypeExists(ResultType.ISOTOPEPATTERN)) {
getTargetPlot().addDataSet(new IsotopesDataSet((IsotopePattern) result.getFirstResultByType(ResultType.ISOTOPEPATTERN).getValue()), clr.get(j), false);
j++;
}
// getTargetPlot().addDataSet(new DPPResultsDataSet("Isotopes (" + getResults().length + ")",
// getResults()), color, false);
}
}
use of net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.IsotopesDataSet in project mzmine2 by mzmine.
the class SpectraToolTipGenerator method generateToolTip.
/**
* @see org.jfree.chart.labels.XYToolTipGenerator#generateToolTip(org.jfree.data.xy.XYDataset,
* int, int)
*/
public String generateToolTip(XYDataset dataset, int series, int item) {
double intValue = dataset.getYValue(series, item);
double mzValue = dataset.getXValue(series, item);
if (dataset instanceof PeakListDataSet) {
PeakListDataSet peakListDataSet = (PeakListDataSet) dataset;
Feature peak = peakListDataSet.getPeak(series, item);
PeakList peakList = peakListDataSet.getPeakList();
PeakListRow row = peakList.getPeakRow(peak);
String tooltip = "Peak: " + peak + "\nStatus: " + peak.getFeatureStatus() + "\nFeature list row: " + row + "\nData point m/z: " + mzFormat.format(mzValue) + "\nData point intensity: " + intensityFormat.format(intValue);
return tooltip;
}
if (dataset instanceof IsotopesDataSet) {
IsotopesDataSet isotopeDataSet = (IsotopesDataSet) dataset;
IsotopePattern pattern = isotopeDataSet.getIsotopePattern();
double relativeIntensity = intValue / pattern.getHighestDataPoint().getIntensity() * 100;
String tooltip = "Isotope pattern: " + pattern.getDescription() + "\nStatus: " + pattern.getStatus() + "\nData point m/z: " + mzFormat.format(mzValue) + "\nData point intensity: " + intensityFormat.format(intValue) + "\nRelative intensity: " + percentFormat.format(relativeIntensity) + "%";
return tooltip;
}
if (dataset instanceof ExtendedIsotopePatternDataSet) {
return "Isotope pattern: " + ((ExtendedIsotopePatternDataSet) dataset).getIsotopePattern().getDescription() + "\nm/z: " + mzFormat.format(mzValue) + "\nIdentity: " + ((ExtendedIsotopePatternDataSet) dataset).getItemDescription(series, item) + "\nRelative intensity: " + percentFormat.format((dataset.getY(series, item).doubleValue() * 100)) + "%";
}
String tooltip = "m/z: " + mzFormat.format(mzValue) + "\nIntensity: " + intensityFormat.format(intValue);
return tooltip;
}
Aggregations