Search in sources :

Example 1 with DPPResult

use of net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPResult in project mzmine2 by mzmine.

the class IsotopePatternUtils method getIsotopicPeakResults.

/**
 * Returns a list of all DPPIsotopicPeakResults
 *
 * @param dp the ProcessedDataPoint to gather the list from.
 * @return List of all results, empty if no such results exists.
 */
@Nonnull
public static List<DPPIsotopicPeakResult> getIsotopicPeakResults(@Nonnull ProcessedDataPoint dp) {
    List<DPPIsotopicPeakResult> results = new ArrayList<>();
    if (!dp.resultTypeExists(ResultType.ISOTOPICPEAK))
        return results;
    List<DPPResult<?>> patternResults = dp.getAllResultsByType(ResultType.ISOTOPICPEAK);
    for (int i = 0; i < patternResults.size(); i++) results.add((DPPIsotopicPeakResult) patternResults.get(i));
    return results;
}
Also used : DPPResult(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPResult) ArrayList(java.util.ArrayList) DPPIsotopicPeakResult(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPIsotopicPeakResult) DataPoint(net.sf.mzmine.datamodel.DataPoint) SimpleDataPoint(net.sf.mzmine.datamodel.impl.SimpleDataPoint) ProcessedDataPoint(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.ProcessedDataPoint) Nonnull(javax.annotation.Nonnull)

Example 2 with DPPResult

use of net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPResult in project mzmine2 by mzmine.

the class IsotopePatternUtils method mergeIsotopePatternResults.

// -------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------
// old-new
public static void mergeIsotopePatternResults(ProcessedDataPoint dp) {
    if (!dp.resultTypeExists(ResultType.ISOTOPEPATTERN))
        return;
    List<DPPIsotopePatternResult> patternResults = getIsotopePatternResults(dp);
    List<DPPResult<?>> newResults = new ArrayList<>();
    for (DPPIsotopePatternResult dpPatternResult : patternResults) {
        ProcessedDataPoint[] dpPattern = dpPatternResult.getLinkedDataPoints();
        int patternCharge = dpPatternResult.getCharge();
        for (ProcessedDataPoint p : dpPattern) {
            List<DPPIsotopePatternResult> pPatternResults = getIsotopePatternResults(p);
            for (DPPIsotopePatternResult pPatternResult : pPatternResults) {
                if (pPatternResult.getCharge() != patternCharge)
                    continue;
                ProcessedDataPoint[] dataPoints = pPatternResult.getLinkedDataPoints();
                p.removeResult(pPatternResult);
                newResults.add(new DPPIsotopePatternResult(new SimpleIsotopePattern(dataPoints, IsotopePatternStatus.DETECTED, ""), dataPoints, patternCharge));
            }
        }
    }
    dp.getAllResultsByType(ResultType.ISOTOPEPATTERN);
    dp.addAllResults(newResults);
    logger.finest("-------------------------");
    for (DPPResult<?> result : newResults) logger.finest("FINAL: " + format.format(dp.getMZ()) + " pattern: " + getResultIsoComp((DPPIsotopePatternResult) result));
// TODO: test
}
Also used : DPPResult(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPResult) ProcessedDataPoint(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.ProcessedDataPoint) DPPIsotopePatternResult(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPIsotopePatternResult) ArrayList(java.util.ArrayList) SimpleIsotopePattern(net.sf.mzmine.datamodel.impl.SimpleIsotopePattern) DataPoint(net.sf.mzmine.datamodel.DataPoint) SimpleDataPoint(net.sf.mzmine.datamodel.impl.SimpleDataPoint) ProcessedDataPoint(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.ProcessedDataPoint)

Example 3 with DPPResult

use of net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPResult in project mzmine2 by mzmine.

the class IsotopePatternUtils method getIsotopePatternResults.

/**
 * Convenience method to get all isotope pattern results in a List<DPPIsotopePatternResult> list
 *
 * @param dp
 * @return
 */
@Nonnull
public static List<DPPIsotopePatternResult> getIsotopePatternResults(@Nonnull ProcessedDataPoint dp) {
    List<DPPIsotopePatternResult> results = new ArrayList<>();
    if (!dp.resultTypeExists(ResultType.ISOTOPEPATTERN))
        return results;
    List<DPPResult<?>> patternResults = dp.getAllResultsByType(ResultType.ISOTOPEPATTERN);
    for (int i = 0; i < patternResults.size(); i++) results.add((DPPIsotopePatternResult) patternResults.get(i));
    return results;
}
Also used : DPPResult(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPResult) DPPIsotopePatternResult(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPIsotopePatternResult) ArrayList(java.util.ArrayList) DataPoint(net.sf.mzmine.datamodel.DataPoint) SimpleDataPoint(net.sf.mzmine.datamodel.impl.SimpleDataPoint) ProcessedDataPoint(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.ProcessedDataPoint) Nonnull(javax.annotation.Nonnull)

Example 4 with DPPResult

use of net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPResult in project mzmine2 by mzmine.

the class IsotopePatternUtils method getChargeStates.

/**
 * @param dp a processed data point.
 * @return an empty list if no isotope pattern was detected, a list of the charge states if there
 *         was at least one charge detected.
 */
public static List<Integer> getChargeStates(ProcessedDataPoint dp) {
    List<Integer> charges = new ArrayList<>();
    List<DPPResult<?>> patternResults = dp.getAllResultsByType(ResultType.ISOTOPEPATTERN);
    for (int x = 0; x < patternResults.size(); x++) {
        DPPIsotopePatternResult pattern = (DPPIsotopePatternResult) patternResults.get(x);
        boolean add = true;
        for (int i = 0; i < charges.size(); i++) {
            if (charges.get(i).intValue() == pattern.getCharge()) {
                add = false;
            }
        }
        if (add) {
            charges.add(pattern.getCharge());
        }
    }
    return charges;
}
Also used : DPPResult(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPResult) DPPIsotopePatternResult(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPIsotopePatternResult) ArrayList(java.util.ArrayList) DataPoint(net.sf.mzmine.datamodel.DataPoint) SimpleDataPoint(net.sf.mzmine.datamodel.impl.SimpleDataPoint) ProcessedDataPoint(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.ProcessedDataPoint)

Aggregations

ArrayList (java.util.ArrayList)4 DataPoint (net.sf.mzmine.datamodel.DataPoint)4 SimpleDataPoint (net.sf.mzmine.datamodel.impl.SimpleDataPoint)4 ProcessedDataPoint (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.ProcessedDataPoint)4 DPPResult (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPResult)4 DPPIsotopePatternResult (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPIsotopePatternResult)3 Nonnull (javax.annotation.Nonnull)2 SimpleIsotopePattern (net.sf.mzmine.datamodel.impl.SimpleIsotopePattern)1 DPPIsotopicPeakResult (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPIsotopicPeakResult)1