Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Protected Member Functions | Protected Attributes | List of all members
IsotopeDistribution Class Reference

Isotope distribution class. More...

#include <OpenMS/CHEMISTRY/IsotopeDistribution.h>

Public Types

typedefs
typedef std::vector< std::pair< Size, double > > ContainerType
 container type, first holds the weight of the isotope, second the probability More...
 
typedef ContainerType::iterator iterator
 
typedef ContainerType::iterator Iterator
 
typedef ContainerType::const_iterator const_iterator
 
typedef ContainerType::const_iterator ConstIterator
 
typedef ContainerType::reverse_iterator reverse_iterator
 
typedef ContainerType::reverse_iterator ReverseIterator
 
typedef ContainerType::const_reverse_iterator const_reverse_iterator
 
typedef ContainerType::const_reverse_iterator ConstReverseIterator
 

Public Member Functions

Constructors and Destructors
 IsotopeDistribution ()
 
 IsotopeDistribution (Size max_isotope)
 Detailed constructor which sets the max_isotope. More...
 
 IsotopeDistribution (const IsotopeDistribution &isotope_distribution)
 Copy constructor. More...
 
virtual ~IsotopeDistribution ()
 Destructor. More...
 
Accessors
void setMaxIsotope (Size max_isotope)
 sets the maximal isotope with max_isotope More...
 
Size getMaxIsotope () const
 returns the currently set maximum isotope More...
 
void set (const ContainerType &distribution)
 overwrites the container which holds the distribution using distribution More...
 
const ContainerTypegetContainer () const
 returns the container which holds the distribution More...
 
Size getMax () const
 returns the maximal weight isotope which is stored in the distribution More...
 
Size getMin () const
 returns the minimal weight isotope which is stored in the distribution More...
 
Size size () const
 returns the size of the distribution which is the number of isotopes in the distribution More...
 
void clear ()
 clears the distribution and resets max isotope to 0 More...
 
void estimateFromPeptideWeight (double average_weight)
 Estimate Peptide Isotopedistribution from weight and number of isotopes that should be reported. More...
 
void estimateFromPeptideWeightAndS (double average_weight, UInt S)
 Estimate peptide IsotopeDistribution from average weight and exact number of sulfurs. More...
 
void estimateFromRNAWeight (double average_weight)
 Estimate Nucleotide Isotopedistribution from weight and number of isotopes that should be reported. More...
 
void estimateFromDNAWeight (double average_weight)
 Estimate Nucleotide Isotopedistribution from weight and number of isotopes that should be reported averagine model from Zubarev, R. A.; Demirev, P. A. in "Isotope depletion of large biomolecules: Implications for molecular mass measurements.". More...
 
void 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 reported. More...
 
void 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. More...
 
void 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, fragment's average weight, and a list of isolated precursor isotopes. More...
 
void estimateForFragmentFromPeptideWeightAndS (double average_weight_precursor, UInt S_precursor, double average_weight_fragment, UInt S_fragment, const std::set< UInt > &precursor_isotopes)
 Estimate peptide fragment IsotopeDistribution from the precursor's average weight, number of sulfurs in the precursor, fragment's average weight, number of sulfurs in the fragment, and a list of isolated precursor isotopes. More...
 
void 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 weight, and a list of isolated precursor isotopes. More...
 
void 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 weight, and a list of isolated precursor isotopes. More...
 
void 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)
 Estimate fragment IsotopeDistribution from the precursor's average weight, fragment's average weight, a list of isolated precursor isotopes, and average composition. More...
 
void calcFragmentIsotopeDist (const IsotopeDistribution &fragment_isotope_dist, const IsotopeDistribution &comp_fragment_isotope_dist, const std::set< UInt > &precursor_isotopes)
 Calculate isotopic distribution for a fragment molecule. More...
 
void renormalize ()
 re-normalizes the sum of the probabilities of the isotopes to 1 More...
 
void trimRight (double cutoff)
 Trims the right side of the isotope distribution to isotopes with a significant contribution. More...
 
void trimLeft (double cutoff)
 Trims the left side of the isotope distribution to isotopes with a significant contribution. More...
 
Operators
IsotopeDistributionoperator= (const IsotopeDistribution &isotope_distribution)
 Assignment operator. More...
 
IsotopeDistribution operator+ (const IsotopeDistribution &isotope_distribution) const
 operator which adds this distribution and the isotope_distribution to return IsotopeDisribution (similar to convolve distributions) More...
 
IsotopeDistributionoperator+= (const IsotopeDistribution &isotope_distribution)
 operator which adds isotope_distribution to this (similar to convolve distributions) More...
 
IsotopeDistribution operator* (Size factor) const
 operator which multiplies this distribution by factor (similar to factor times applying operator '+') More...
 
IsotopeDistributionoperator*= (Size factor)
 operator which multiplies this distribution by factor (similar to factor times applying operator '+=') More...
 
bool operator== (const IsotopeDistribution &isotope_distribution) const
 equality operator, returns true if the isotope_distribution is identical to this, false else More...
 
bool operator!= (const IsotopeDistribution &isotope_distribution) const
 inequality operator, returns true if the isotope_distribution differs from this, false else More...
 
Iterators
Iterator begin ()
 
Iterator end ()
 
ConstIterator begin () const
 
ConstIterator end () const
 
ReverseIterator rbegin ()
 
ReverseIterator rend ()
 
ConstReverseIterator rbegin () const
 
ConstReverseIterator rend () const
 

Protected Member Functions

void convolve_ (ContainerType &result, const ContainerType &left, const ContainerType &right) const
 convolves the distributions left and right and stores the result in result More...
 
void convolvePow_ (ContainerType &result, const ContainerType &input, Size factor) const
 convolves the distribution input factor times and stores the result in result More...
 
void convolveSquare_ (ContainerType &result, const ContainerType &input) const
 convolves the distribution input with itself and stores the result in result More...
 
void calcFragmentIsotopeDist_ (ContainerType &result, const ContainerType &fragment_isotope_dist, const ContainerType &comp_fragment_isotope_dist, const std::set< UInt > &precursor_isotopes)
 calculates the fragment distribution for a fragment molecule and stores it in result. More...
 
ContainerType fillGaps_ (const ContainerType &id) const
 fill a gapped isotope pattern (i.e. certain masses are missing), with zero probability masses More...
 

Protected Attributes

Size max_isotope_
 maximal isotopes which is used to calculate the distribution More...
 
ContainerType distribution_
 stores the isotope distribution More...
 

Detailed Description

Isotope distribution class.

Holds an isotope distribution with the weight value and according probability. Distribution can be add using the '+' or '+=' operators.

The most important value which should be set is the max isotope value. This value can be set using the setMaxIsotope method. It is an upper bound for the number of isotopes which are calculated. E.g. if it is set to 3, only the first three isotopes, Monoisotopic mass, +1 and +2 are calculated. By default all possible isotopes are calculated, which leads to a large number of values, if the mass value is large!

Member Typedef Documentation

◆ const_iterator

typedef ContainerType::const_iterator const_iterator

◆ const_reverse_iterator

typedef ContainerType::const_reverse_iterator const_reverse_iterator

◆ ConstIterator

typedef ContainerType::const_iterator ConstIterator

◆ ConstReverseIterator

typedef ContainerType::const_reverse_iterator ConstReverseIterator

◆ ContainerType

typedef std::vector<std::pair<Size, double> > ContainerType

container type, first holds the weight of the isotope, second the probability

◆ iterator

typedef ContainerType::iterator iterator

◆ Iterator

typedef ContainerType::iterator Iterator

◆ reverse_iterator

typedef ContainerType::reverse_iterator reverse_iterator

◆ ReverseIterator

typedef ContainerType::reverse_iterator ReverseIterator

Constructor & Destructor Documentation

◆ IsotopeDistribution() [1/3]

Default constructor, note max_isotope must be set later

See also
setMaxIsotope(Size max_isotope)

◆ IsotopeDistribution() [2/3]

IsotopeDistribution ( Size  max_isotope)
explicit

Detailed constructor which sets the max_isotope.

◆ IsotopeDistribution() [3/3]

IsotopeDistribution ( const IsotopeDistribution isotope_distribution)

Copy constructor.

◆ ~IsotopeDistribution()

virtual ~IsotopeDistribution ( )
virtual

Destructor.

Member Function Documentation

◆ begin() [1/2]

Iterator begin ( )
inline

◆ begin() [2/2]

ConstIterator begin ( ) const
inline

◆ calcFragmentIsotopeDist()

void calcFragmentIsotopeDist ( const IsotopeDistribution fragment_isotope_dist,
const IsotopeDistribution comp_fragment_isotope_dist,
const std::set< UInt > &  precursor_isotopes 
)

Calculate isotopic distribution for a fragment molecule.

This calculates the isotopic distribution for a fragment molecule given the isotopic distribution of the fragment and complementary fragment (as if they were precursors), and which precursor isotopes were isolated. Do consider normalising the distribution afterwards to get conditional probabilities. Equations come from Rockwood, AL; Kushnir, MA; Nelson, GJ. in "Dissociation of Individual Isotopic Peaks: Predicting Isotopic Distributions of Product Ions in MSn"

Parameters
fragment_isotope_distthe isotopic distribution of the fragment (as if it was a precursor).
comp_fragment_isotope_distthe isotopic distribution of the complementary fragment (as if it was a precursor).
precursor_isotopesa list of which precursor isotopes were isolated. 0 corresponds to the mono-isotopic molecule (M0), 1->M1, etc.

◆ calcFragmentIsotopeDist_()

void calcFragmentIsotopeDist_ ( ContainerType result,
const ContainerType fragment_isotope_dist,
const ContainerType comp_fragment_isotope_dist,
const std::set< UInt > &  precursor_isotopes 
)
protected

calculates the fragment distribution for a fragment molecule and stores it in result.

Parameters
fragment_isotope_distthe isotopic distribution of the fragment (as if it was a precursor).
comp_fragment_isotope_distthe isotopic distribution of the complementary fragment (as if it was a precursor).
precursor_isotopeswhich precursor isotopes were isolated. 0 corresponds to the mono-isotopic molecule (M0), 1->M1, etc.

◆ clear()

void clear ( )

clears the distribution and resets max isotope to 0

◆ convolve_()

void convolve_ ( ContainerType result,
const ContainerType left,
const ContainerType right 
) const
protected

convolves the distributions left and right and stores the result in result

◆ convolvePow_()

void convolvePow_ ( ContainerType result,
const ContainerType input,
Size  factor 
) const
protected

convolves the distribution input factor times and stores the result in result

◆ convolveSquare_()

void convolveSquare_ ( ContainerType result,
const ContainerType input 
) const
protected

convolves the distribution input with itself and stores the result in result

◆ end() [1/2]

Iterator end ( )
inline

◆ end() [2/2]

ConstIterator end ( ) const
inline

◆ estimateForFragmentFromDNAWeight()

void 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 weight, and a list of isolated precursor isotopes.

The max_depth of the isotopic distribution is set to max(precursor_isotopes)+1.

Parameters
average_weight_precursoraverage weight of the precursor nucleotide
average_weight_fragmentaverage weight of the fragment
precursor_isotopesthe precursor isotopes that were isolated. 0 corresponds to the mono-isotopic molecule (M0), 1->M1, etc.
Precondition
average_weight_precursor >= average_weight_fragment
average_weight_precursor > 0
average_weight_fragment > 0
precursor_isotopes.size() > 0

◆ estimateForFragmentFromPeptideWeight()

void 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, fragment's average weight, and a list of isolated precursor isotopes.

The max_depth of the isotopic distribution is set to max(precursor_isotopes)+1.

Parameters
average_weight_precursoraverage weight of the precursor peptide
average_weight_fragmentaverage weight of the fragment
precursor_isotopesthe precursor isotopes that were isolated. 0 corresponds to the mono-isotopic molecule (M0), 1->M1, etc.
Precondition
average_weight_precursor >= average_weight_fragment
average_weight_fragment > 0
average_weight_precursor > 0
precursor_isotopes.size() > 0

◆ estimateForFragmentFromPeptideWeightAndS()

void estimateForFragmentFromPeptideWeightAndS ( double  average_weight_precursor,
UInt  S_precursor,
double  average_weight_fragment,
UInt  S_fragment,
const std::set< UInt > &  precursor_isotopes 
)

Estimate peptide fragment IsotopeDistribution from the precursor's average weight, number of sulfurs in the precursor, fragment's average weight, number of sulfurs in the fragment, and a list of isolated precursor isotopes.

The max_depth of the isotopic distribution is set to max(precursor_isotopes)+1.

Parameters
average_weight_precursoraverage weight of the precursor peptide
S_precursorThe exact number of Sulfurs in the precursor peptide
average_weight_fragmentaverage weight of the fragment
S_fragmentThe exact number of Sulfurs in the fragment
precursor_isotopesthe precursor isotopes that were isolated
Precondition
S_fragment <= average_weight_fragment / average_weight(sulfur)
S_precursor - S_fragment <= (average_weight_precursor - average_weight_fragment) / average_weight(sulfur)
average_weight_precursor >= average_weight_fragment
average_weight_precursor > 0
average_weight_fragment > 0
precursor_isotopes.size() > 0

◆ estimateForFragmentFromRNAWeight()

void 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 weight, and a list of isolated precursor isotopes.

The max_depth of the isotopic distribution is set to max(precursor_isotopes)+1.

Parameters
average_weight_precursoraverage weight of the precursor nucleotide
average_weight_fragmentaverage weight of the fragment
precursor_isotopesthe precursor isotopes that were isolated. 0 corresponds to the mono-isotopic molecule (M0), 1->M1, etc.
Precondition
average_weight_precursor >= average_weight_fragment
average_weight_precursor > 0
average_weight_fragment > 0
precursor_isotopes.size() > 0

◆ estimateForFragmentFromWeightAndComp()

void 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 
)

Estimate fragment IsotopeDistribution from the precursor's average weight, fragment's average weight, a list of isolated precursor isotopes, and average composition.

The max_depth of the isotopic distribution is set to max(precursor_isotopes)+1.

Parameters
average_weight_precursoraverage weight of the precursor molecule
average_weight_fragmentaverage weight of the fragment molecule
precursor_isotopesthe precursor isotopes that were isolated. 0 corresponds to the mono-isotopic molecule (M0), 1->M1, etc.
CThe approximate relative stoichiometry of Carbons to other elements in this molecule
HThe approximate relative stoichiometry of Hydrogens to other elements in this molecule
NThe approximate relative stoichiometry of Nitrogens to other elements in this molecule
OThe approximate relative stoichiometry of Oxygens to other elements in this molecule
SThe approximate relative stoichiometry of Sulfurs to other elements in this molecule
PThe approximate relative stoichiometry of Phosphoruses to other elements in this molecule
Precondition
S, C, H, N, O, P >= 0
average_weight_precursor >= average_weight_fragment
average_weight_precursor > 0
average_weight_fragment > 0
precursor_isotopes.size() > 0

◆ estimateFromDNAWeight()

void estimateFromDNAWeight ( double  average_weight)

Estimate Nucleotide Isotopedistribution from weight and number of isotopes that should be reported averagine model from Zubarev, R. A.; Demirev, P. A. in "Isotope depletion of large biomolecules: Implications for molecular mass measurements.".

◆ estimateFromPeptideWeight()

void estimateFromPeptideWeight ( double  average_weight)

Estimate Peptide Isotopedistribution from weight and number of isotopes that should be reported.

Implementation using the averagine model proposed by Senko et al. in "Determination of Monoisotopic Masses and Ion Populations for Large Biomolecules from Resolved Isotopic Distributions"

Referenced by IsotopeMarker::apply(), TOPPMetaProSIP::calculateCorrelation(), MetaProSIPDecomposition::calculateIsotopePatternsFor13CRangeOfAveraginePeptide(), MetaProSIPDecomposition::calculateIsotopePatternsFor15NRangeOfAveraginePeptide(), MetaProSIPDecomposition::calculateIsotopePatternsFor18ORangeOfAveraginePeptide(), and MetaProSIPDecomposition::calculateIsotopePatternsFor2HRangeOfAveraginePeptide().

◆ estimateFromPeptideWeightAndS()

void estimateFromPeptideWeightAndS ( double  average_weight,
UInt  S 
)

Estimate peptide IsotopeDistribution from average weight and exact number of sulfurs.

Parameters
average_weightAverage weight to estimate an EmpiricalFormula for
SThe exact number of Sulfurs in this molecule
Precondition
S <= average_weight / average_weight(sulfur)
average_weight >= 0

◆ estimateFromRNAWeight()

void estimateFromRNAWeight ( double  average_weight)

Estimate Nucleotide Isotopedistribution from weight and number of isotopes that should be reported.

averagine model from Zubarev, R. A.; Demirev, P. A. in "Isotope depletion of large biomolecules: Implications for molecular mass measurements."

◆ estimateFromWeightAndComp()

void 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 reported.

◆ estimateFromWeightAndCompAndS()

void 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.

Parameters
average_weightAverage weight to estimate an IsotopeDistribution for
SThe exact numbers of Sulfurs in this molecule
CThe approximate relative stoichiometry of Carbons to other elements (excluding Sulfur) in this molecule
HThe approximate relative stoichiometry of Hydrogens to other elements (excluding Sulfur) in this molecule
NThe approximate relative stoichiometry of Nitrogens to other elements (excluding Sulfur) in this molecule
OThe approximate relative stoichiometry of Oxygens to other elements (excluding Sulfur) in this molecule
PThe approximate relative stoichiometry of Phosphoruses to other elements (excluding Sulfur) in this molecule
Precondition
S, C, H, N, O, P >= 0
average_weight >= 0

◆ fillGaps_()

ContainerType fillGaps_ ( const ContainerType id) const
protected

fill a gapped isotope pattern (i.e. certain masses are missing), with zero probability masses

◆ getContainer()

const ContainerType& getContainer ( ) const

◆ getMax()

Size getMax ( ) const

returns the maximal weight isotope which is stored in the distribution

◆ getMaxIsotope()

Size getMaxIsotope ( ) const

returns the currently set maximum isotope

◆ getMin()

Size getMin ( ) const

returns the minimal weight isotope which is stored in the distribution

◆ operator!=()

bool operator!= ( const IsotopeDistribution isotope_distribution) const

inequality operator, returns true if the isotope_distribution differs from this, false else

◆ operator*()

IsotopeDistribution operator* ( Size  factor) const

operator which multiplies this distribution by factor (similar to factor times applying operator '+')

◆ operator*=()

IsotopeDistribution& operator*= ( Size  factor)

operator which multiplies this distribution by factor (similar to factor times applying operator '+=')

◆ operator+()

IsotopeDistribution operator+ ( const IsotopeDistribution isotope_distribution) const

operator which adds this distribution and the isotope_distribution to return IsotopeDisribution (similar to convolve distributions)

◆ operator+=()

IsotopeDistribution& operator+= ( const IsotopeDistribution isotope_distribution)

operator which adds isotope_distribution to this (similar to convolve distributions)

◆ operator=()

IsotopeDistribution& operator= ( const IsotopeDistribution isotope_distribution)

Assignment operator.

◆ operator==()

bool operator== ( const IsotopeDistribution isotope_distribution) const

equality operator, returns true if the isotope_distribution is identical to this, false else

◆ rbegin() [1/2]

ReverseIterator rbegin ( )
inline

◆ rbegin() [2/2]

ConstReverseIterator rbegin ( ) const
inline

◆ rend() [1/2]

ReverseIterator rend ( )
inline

◆ rend() [2/2]

ConstReverseIterator rend ( ) const
inline

◆ renormalize()

void renormalize ( )

re-normalizes the sum of the probabilities of the isotopes to 1

The re-normalisation is needed as in distributions with a lot of isotopes (and with high max isotope) the calculations tend to be inexact.

◆ set()

void set ( const ContainerType distribution)

◆ setMaxIsotope()

void setMaxIsotope ( Size  max_isotope)

sets the maximal isotope with max_isotope

sets the maximal isotope which is included in the distribution and used to limit the calculations. This is useful as distributions with numerous isotopes tend to have a lot of numerical zeros at the end

◆ size()

Size size ( ) const

returns the size of the distribution which is the number of isotopes in the distribution

◆ trimLeft()

void trimLeft ( double  cutoff)

Trims the left side of the isotope distribution to isotopes with a significant contribution.

If the isotope distribution is calculated for large masses (and with high max isotope) it might happen that many entries contain only small numbers. This function can be used to remove these entries.

Do consider normalising the distribution afterwards.

◆ trimRight()

void trimRight ( double  cutoff)

Trims the right side of the isotope distribution to isotopes with a significant contribution.

If the isotope distribution is calculated for large masses (and with high max isotope) it might happen that many entries contain only small numbers. This function can be used to remove these entries.

Do consider normalising the distribution afterwards.

Member Data Documentation

◆ distribution_

ContainerType distribution_
protected

stores the isotope distribution

◆ max_isotope_

Size max_isotope_
protected

maximal isotopes which is used to calculate the distribution


OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:09 using doxygen 1.8.13