Search in sources :

Example 11 with ExtendedIsotopePattern

use of net.sf.mzmine.datamodel.impl.ExtendedIsotopePattern in project mzmine2 by mzmine.

the class DPPAnyElementIsotopeGrouperTask method getIsotopePatterns.

/**
 * Returns an array of isotope patterns for the given string. Every element gets its own isotope
 * pattern.
 *
 * @param elements String of element symbols
 * @param mergeWidth
 * @param minAbundance
 * @return
 */
public static ExtendedIsotopePattern[] getIsotopePatterns(String elements, double mergeWidth, double minAbundance) {
    SilentChemObjectBuilder builder = (SilentChemObjectBuilder) SilentChemObjectBuilder.getInstance();
    IMolecularFormula form = MolecularFormulaManipulator.getMajorIsotopeMolecularFormula(elements, builder);
    ExtendedIsotopePattern[] isotopePatterns = new ExtendedIsotopePattern[form.getIsotopeCount()];
    int i = 0;
    // create a isotope pattern for every element
    for (IIsotope element : form.isotopes()) {
        isotopePatterns[i] = (ExtendedIsotopePattern) IsotopePatternCalculator.calculateIsotopePattern(element.getSymbol(), minAbundance, mergeWidth, 1, PolarityType.NEUTRAL, true);
        i++;
    }
    // also, we want to keep track of the isotope composition, to do that cleanly, we remove the
    // lightest isotope description
    ExtendedIsotopePattern[] cleanedPatterns = new ExtendedIsotopePattern[form.getIsotopeCount()];
    i = 0;
    for (ExtendedIsotopePattern p : isotopePatterns) {
        String[] composition = p.getIsotopeCompositions();
        composition[0] = "";
        cleanedPatterns[i] = new ExtendedIsotopePattern(p.getDataPoints(), p.getStatus(), p.getDescription(), composition);
        i++;
    }
    return cleanedPatterns;
}
Also used : IIsotope(org.openscience.cdk.interfaces.IIsotope) SilentChemObjectBuilder(org.openscience.cdk.silent.SilentChemObjectBuilder) IMolecularFormula(org.openscience.cdk.interfaces.IMolecularFormula) ExtendedIsotopePattern(net.sf.mzmine.datamodel.impl.ExtendedIsotopePattern) DataPoint(net.sf.mzmine.datamodel.DataPoint) ProcessedDataPoint(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.ProcessedDataPoint)

Aggregations

ExtendedIsotopePattern (net.sf.mzmine.datamodel.impl.ExtendedIsotopePattern)11 DataPoint (net.sf.mzmine.datamodel.DataPoint)8 SimpleDataPoint (net.sf.mzmine.datamodel.impl.SimpleDataPoint)6 ArrayList (java.util.ArrayList)4 SimpleIsotopePattern (net.sf.mzmine.datamodel.impl.SimpleIsotopePattern)4 ProcessedDataPoint (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.ProcessedDataPoint)4 DPPIsotopePatternResult (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPIsotopePatternResult)2 IIsotope (org.openscience.cdk.interfaces.IIsotope)2 IMolecularFormula (org.openscience.cdk.interfaces.IMolecularFormula)2 MSDKRuntimeException (io.github.msdk.MSDKRuntimeException)1 PolarityType (net.sf.mzmine.datamodel.PolarityType)1 DPPIsotopicPeakResult (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.results.DPPIsotopicPeakResult)1 IsotopeContainer (org.openscience.cdk.formula.IsotopeContainer)1 IsotopePatternGenerator (org.openscience.cdk.formula.IsotopePatternGenerator)1 MolecularFormulaRange (org.openscience.cdk.formula.MolecularFormulaRange)1 SilentChemObjectBuilder (org.openscience.cdk.silent.SilentChemObjectBuilder)1