Search in sources :

Example 6 with DPPIsotopePatternResult

use of net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPIsotopePatternResult 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

ProcessedDataPoint (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.ProcessedDataPoint)6 DPPIsotopePatternResult (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPIsotopePatternResult)6 ArrayList (java.util.ArrayList)5 DataPoint (net.sf.mzmine.datamodel.DataPoint)5 SimpleDataPoint (net.sf.mzmine.datamodel.impl.SimpleDataPoint)4 DPPResult (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPResult)3 ExtendedIsotopePattern (net.sf.mzmine.datamodel.impl.ExtendedIsotopePattern)2 SimpleIsotopePattern (net.sf.mzmine.datamodel.impl.SimpleIsotopePattern)2 Vector (java.util.Vector)1 Nonnull (javax.annotation.Nonnull)1 IsotopePattern (net.sf.mzmine.datamodel.IsotopePattern)1 DPPIsotopicPeakResult (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPIsotopicPeakResult)1 MolecularFormulaRange (org.openscience.cdk.formula.MolecularFormulaRange)1 IIsotope (org.openscience.cdk.interfaces.IIsotope)1 IMolecularFormula (org.openscience.cdk.interfaces.IMolecularFormula)1