OpenMS  2.8.0
CoarseIsotopePatternGenerator.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2021.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Chris Bielow $
32 // $Authors: Clemens Groepl, Andreas Bertsch, Chris Bielow $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
39 
40 #include <set>
41 
42 namespace OpenMS
43 {
96  class OPENMS_DLLAPI CoarseIsotopePatternGenerator
98  {
99 
100  public:
101  CoarseIsotopePatternGenerator(const Size max_isotope = 0, const bool round_masses = false);
102 
104 
107 
113  void setMaxIsotope(const Size& max_isotope);
114 
116  void setRoundMasses(const bool round_masses);
117 
120 
122  bool getRoundMasses() const;
124 
132  IsotopeDistribution run(const EmpiricalFormula&) const override;
133 
141 
152 
172  static IsotopeDistribution approximateFromPeptideWeight(double mass, UInt num_peaks = 20, UInt charge = 1);
173 
184  static std::vector<double> approximateIntensities(double mass, UInt num_peaks = 20);
185 
193 
200 
206  IsotopeDistribution estimateFromWeightAndComp(double average_weight, double C, double H, double N, double O, double S, double P);
207 
222  IsotopeDistribution estimateFromWeightAndCompAndS(double average_weight, UInt S, double C, double H, double N, double O, double P);
223 
238  IsotopeDistribution estimateForFragmentFromPeptideWeight(double average_weight_precursor, double average_weight_fragment, const std::set<UInt>& precursor_isotopes);
239 
259  IsotopeDistribution estimateForFragmentFromPeptideWeightAndS(double average_weight_precursor, UInt S_precursor, double average_weight_fragment, UInt S_fragment, const std::set<UInt>& precursor_isotopes) const;
260 
275  IsotopeDistribution estimateForFragmentFromRNAWeight(double average_weight_precursor, double average_weight_fragment, const std::set<UInt>& precursor_isotopes);
276 
291  IsotopeDistribution estimateForFragmentFromDNAWeight(double average_weight_precursor, double average_weight_fragment, const std::set<UInt>& precursor_isotopes);
292 
314  IsotopeDistribution estimateForFragmentFromWeightAndComp(double average_weight_precursor, double average_weight_fragment, const std::set<UInt>& precursor_isotopes, double C, double H, double N, double O, double S, double P) const;
315 
334  IsotopeDistribution calcFragmentIsotopeDist(const IsotopeDistribution& fragment_isotope_dist, const IsotopeDistribution& comp_fragment_isotope_dist, const std::set<UInt>& precursor_isotopes, const double fragment_mono_mass) const;
335 
337 
340 
341  protected:
342 
345 
348 
351 
358  IsotopeDistribution calcFragmentIsotopeDist_(const IsotopeDistribution::ContainerType& fragment_isotope_dist, const IsotopeDistribution::ContainerType& comp_fragment_isotope_dist, const std::set<UInt>& precursor_isotopes) const;
359 
362 
367 
368  };
369 
370 } // namespace OpenMS
Isotope pattern generator for coarse isotope distributions.
Definition: CoarseIsotopePatternGenerator.h:98
IsotopeDistribution estimateForFragmentFromDNAWeight(double average_weight_precursor, double average_weight_fragment, const std::set< UInt > &precursor_isotopes)
Estimate DNA fragment IsotopeDistribution from the precursor's average weight, fragment's average wei...
IsotopeDistribution estimateFromPeptideWeightAndS(double average_weight, UInt S)
Estimate peptide IsotopeDistribution from average weight and exact number of sulfurs.
IsotopeDistribution calcFragmentIsotopeDist_(const IsotopeDistribution::ContainerType &fragment_isotope_dist, const IsotopeDistribution::ContainerType &comp_fragment_isotope_dist, const std::set< UInt > &precursor_isotopes) const
calculates the fragment distribution for a fragment molecule and stores it in result.
Size max_isotope_
maximal isotopes which is used to calculate the distribution
Definition: CoarseIsotopePatternGenerator.h:364
Size getMaxIsotope() const
returns the currently set maximum isotope
IsotopeDistribution estimateFromWeightAndComp(double average_weight, double C, double H, double N, double O, double S, double P)
Estimate Isotopedistribution from weight, average composition, and number of isotopes that should be ...
IsotopeDistribution estimateFromDNAWeight(double average_weight)
Estimate Nucleotide Isotopedistribution from weight and number of isotopes that should be reported av...
IsotopeDistribution estimateFromRNAWeight(double average_weight)
Estimate Nucleotide Isotopedistribution from weight and number of isotopes that should be reported.
IsotopeDistribution estimateFromWeightAndCompAndS(double average_weight, UInt S, double C, double H, double N, double O, double P)
Estimate IsotopeDistribution from weight, exact number of sulfurs, and average remaining composition.
static std::vector< double > approximateIntensities(double mass, UInt num_peaks=20)
roughly approximate intensity distribution of peptidic isotope patterns from monoisotopic weight usin...
CoarseIsotopePatternGenerator & operator=(const CoarseIsotopePatternGenerator &iso)
IsotopeDistribution estimateFromPeptideWeight(double average_weight)
Estimate Peptide Isotopedistribution from weight and number of isotopes that should be reported.
static IsotopeDistribution approximateFromPeptideWeight(double mass, UInt num_peaks=20, UInt charge=1)
roughly approximate peptide IsotopeDistribution from monoisotopic weight using Poisson distribution....
IsotopeDistribution::ContainerType convolve(const IsotopeDistribution::ContainerType &left, const IsotopeDistribution::ContainerType &right) const
convolves the distributions left and right and stores the result in result
bool getRoundMasses() const
returns the current value of the flag to return expected masses (true) or atomic numbers (false).
bool round_masses_
flag to determine whether masses should be rounded or not
Definition: CoarseIsotopePatternGenerator.h:366
IsotopeDistribution run(const EmpiricalFormula &) const override
Creates an isotope distribution from an empirical sum formula.
IsotopeDistribution::ContainerType convolvePow_(const IsotopeDistribution::ContainerType &input, Size factor) const
convolves the distribution input factor times and stores the result in result
void setMaxIsotope(const Size &max_isotope)
sets the maximal isotope with max_isotope
IsotopeDistribution::ContainerType correctMass_(const IsotopeDistribution::ContainerType &input, const double mono_weight) const
converts the masses of distribution input from atomic numbers to accurate masses
IsotopeDistribution estimateForFragmentFromWeightAndComp(double average_weight_precursor, double average_weight_fragment, const std::set< UInt > &precursor_isotopes, double C, double H, double N, double O, double S, double P) const
Estimate fragment IsotopeDistribution from the precursor's average weight, fragment's average weight,...
IsotopeDistribution estimateForFragmentFromRNAWeight(double average_weight_precursor, double average_weight_fragment, const std::set< UInt > &precursor_isotopes)
Estimate RNA fragment IsotopeDistribution from the precursor's average weight, fragment's average wei...
IsotopeDistribution::ContainerType fillGaps_(const IsotopeDistribution::ContainerType &id) const
fill a gapped isotope pattern (i.e. certain masses are missing), with zero probability masses
IsotopeDistribution::ContainerType convolveSquare_(const IsotopeDistribution::ContainerType &input) const
convolves the distribution input with itself and stores the result in result
IsotopeDistribution calcFragmentIsotopeDist(const IsotopeDistribution &fragment_isotope_dist, const IsotopeDistribution &comp_fragment_isotope_dist, const std::set< UInt > &precursor_isotopes, const double fragment_mono_mass) const
Calculate isotopic distribution for a fragment molecule.
IsotopeDistribution estimateForFragmentFromPeptideWeight(double average_weight_precursor, double average_weight_fragment, const std::set< UInt > &precursor_isotopes)
Estimate peptide fragment IsotopeDistribution from the precursor's average weight,...
CoarseIsotopePatternGenerator(const Size max_isotope=0, const bool round_masses=false)
void setRoundMasses(const bool round_masses)
sets the round_masses_ flag to round masses to integer values (true) or return accurate masses (false...
IsotopeDistribution estimateForFragmentFromPeptideWeightAndS(double average_weight_precursor, UInt S_precursor, double average_weight_fragment, UInt S_fragment, const std::set< UInt > &precursor_isotopes) const
Estimate peptide fragment IsotopeDistribution from the precursor's average weight,...
Representation of an empirical formula.
Definition: EmpiricalFormula.h:82
Definition: IsotopeDistribution.h:65
std::vector< MassAbundance > ContainerType
Definition: IsotopeDistribution.h:72
Provides an interface for different isotope pattern generator methods.
Definition: IsotopePatternGenerator.h:54
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47