Search in sources :

Example 1 with IsotopesDataSet

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);
}
Also used : ProcessedDataPoint(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.ProcessedDataPoint) DataPoint(net.sf.mzmine.datamodel.DataPoint) ProcessedDataPoint(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.ProcessedDataPoint) ArrayList(java.util.ArrayList) IsotopePattern(net.sf.mzmine.datamodel.IsotopePattern) SimpleIsotopePattern(net.sf.mzmine.datamodel.impl.SimpleIsotopePattern) SimpleIsotopePattern(net.sf.mzmine.datamodel.impl.SimpleIsotopePattern) IsotopesDataSet(net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.IsotopesDataSet)

Example 2 with IsotopesDataSet

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);
}
Also used : Color(java.awt.Color) IsotopesDataSet(net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.IsotopesDataSet)

Example 3 with IsotopesDataSet

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);
}
Also used : ScanDataSet(net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.ScanDataSet) Color(java.awt.Color) IsotopePattern(net.sf.mzmine.datamodel.IsotopePattern) IsotopesDataSet(net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.IsotopesDataSet)

Example 4 with IsotopesDataSet

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);
    }
}
Also used : ProcessedDataPoint(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.ProcessedDataPoint) Color(java.awt.Color) IsotopesDataSet(net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.IsotopesDataSet) DataPoint(net.sf.mzmine.datamodel.DataPoint) ProcessedDataPoint(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.ProcessedDataPoint)

Example 5 with IsotopesDataSet

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;
}
Also used : ExtendedIsotopePatternDataSet(net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.ExtendedIsotopePatternDataSet) PeakListRow(net.sf.mzmine.datamodel.PeakListRow) PeakListDataSet(net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.PeakListDataSet) IsotopePattern(net.sf.mzmine.datamodel.IsotopePattern) IsotopesDataSet(net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.IsotopesDataSet) PeakList(net.sf.mzmine.datamodel.PeakList) Feature(net.sf.mzmine.datamodel.Feature)

Aggregations

IsotopesDataSet (net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.IsotopesDataSet)6 Color (java.awt.Color)3 IsotopePattern (net.sf.mzmine.datamodel.IsotopePattern)3 DataPoint (net.sf.mzmine.datamodel.DataPoint)2 ProcessedDataPoint (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.ProcessedDataPoint)2 ArrayList (java.util.ArrayList)1 Feature (net.sf.mzmine.datamodel.Feature)1 PeakList (net.sf.mzmine.datamodel.PeakList)1 PeakListRow (net.sf.mzmine.datamodel.PeakListRow)1 SimpleIsotopePattern (net.sf.mzmine.datamodel.impl.SimpleIsotopePattern)1 ExtendedIsotopePatternDataSet (net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.ExtendedIsotopePatternDataSet)1 PeakListDataSet (net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.PeakListDataSet)1 ScanDataSet (net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.ScanDataSet)1 XYItemRenderer (org.jfree.chart.renderer.xy.XYItemRenderer)1 XYDataset (org.jfree.data.xy.XYDataset)1