OpenMS  2.7.0
List of all members
IsotopeDistribution Class Reference

#include <OpenMS/CHEMISTRY/ISOTOPEDISTRIBUTION/IsotopeDistribution.h>

Collaboration diagram for IsotopeDistribution:
[legend]

Public Types

typedefs
enum  Sorted { INTENSITY , MASS , UNDEFINED }
 
typedef Peak1D MassAbundance
 container type, first holds the weight of the isotope, second the probability More...
 
typedef std::vector< MassAbundanceContainerType
 
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 (const IsotopeDistribution &)=default
 Copy constructor. More...
 
 IsotopeDistribution (IsotopeDistribution &&) noexcept=default
 Move constructor. More...
 
virtual ~IsotopeDistribution ()=default
 Destructor. More...
 
Accessors
void set (const ContainerType &distribution)
 overwrites the container which holds the distribution using distribution More...
 
void set (ContainerType &&distribution)
 overwrites the container which holds the distribution using distribution More...
 
const ContainerTypegetContainer () const
 returns the container which holds the distribution More...
 
Peak1D::CoordinateType getMax () const
 returns the isotope with the largest m/z More...
 
Peak1D::CoordinateType getMin () const
 returns the isotope with the smallest m/z More...
 
Peak1D getMostAbundant () const
 returns the most abundant 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 More...
 
void resize (UInt size)
 
void trimIntensities (double cutoff)
 remove intensities below the cutoff More...
 
void sortByIntensity ()
 sort isotope distribution by intensity More...
 
void sortByMass ()
 sort isotope distribution by mass More...
 
void renormalize ()
 Re-normalizes the sum of the probabilities of all the isotopes to 1. More...
 
void merge (double resolution, double min_prob)
 Merges distributions of arbitrary data points with constant defined resolution. 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...
 
double averageMass () const
 Compute average mass of isotope distribution (weighted average of all isotopes) More...
 
Operators
IsotopeDistributionoperator= (const IsotopeDistribution &isotope_distribution)
 Assignment 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...
 
bool operator< (const IsotopeDistribution &isotope_distribution) const
 less operator More...
 
Iterators
Iterator begin ()
 
Iterator end ()
 
ConstIterator begin () const
 
ConstIterator end () const
 
ReverseIterator rbegin ()
 
ReverseIterator rend ()
 
ConstReverseIterator rbegin () const
 
ConstReverseIterator rend () const
 
void insert (const Peak1D::CoordinateType &mass, const Peak1D::IntensityType &intensity)
 

Data Access Operators

ContainerType distribution_
 stores the isotope distribution More...
 
Peak1Doperator[] (const Size &index)
 operator to access a cell of the distribution and wraps it in SpectrumFragment struct More...
 
const Peak1Doperator[] (const Size &index) const
 const operator to access a cell of the distribution and wraps it in SpectrumFragment struct More...
 
void sort_ (std::function< bool(const MassAbundance &p1, const MassAbundance &p2)> sorter)
 sort wrapper of the distribution More...
 
void transform_ (std::function< void(MassAbundance &)> lambda)
 takes a function as a parameter to transform the distribution More...
 

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<MassAbundance> ContainerType

◆ iterator

typedef ContainerType::iterator iterator

◆ Iterator

typedef ContainerType::iterator Iterator

◆ MassAbundance

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

◆ reverse_iterator

typedef ContainerType::reverse_iterator reverse_iterator

◆ ReverseIterator

typedef ContainerType::reverse_iterator ReverseIterator

Member Enumeration Documentation

◆ Sorted

enum Sorted
Enumerator
INTENSITY 
MASS 
UNDEFINED 

Constructor & Destructor Documentation

◆ IsotopeDistribution() [1/3]

Default constructor

◆ IsotopeDistribution() [2/3]

Copy constructor.

◆ IsotopeDistribution() [3/3]

IsotopeDistribution ( IsotopeDistribution &&  )
defaultnoexcept

Move constructor.

◆ ~IsotopeDistribution()

virtual ~IsotopeDistribution ( )
virtualdefault

Destructor.

Member Function Documentation

◆ averageMass()

double averageMass ( ) const

Compute average mass of isotope distribution (weighted average of all isotopes)

◆ begin() [1/2]

Iterator begin ( )
inline

◆ begin() [2/2]

ConstIterator begin ( ) const
inline

◆ clear()

void clear ( )

clears the distribution

◆ end() [1/2]

Iterator end ( )
inline

◆ end() [2/2]

ConstIterator end ( ) const
inline

◆ getContainer()

const ContainerType& getContainer ( ) const

returns the container which holds the distribution

◆ getMax()

Peak1D::CoordinateType getMax ( ) const

returns the isotope with the largest m/z

◆ getMin()

Peak1D::CoordinateType getMin ( ) const

returns the isotope with the smallest m/z

◆ getMostAbundant()

Peak1D getMostAbundant ( ) const

returns the most abundant isotope which is stored in the distribution

◆ insert()

void insert ( const Peak1D::CoordinateType mass,
const Peak1D::IntensityType intensity 
)
inline

◆ merge()

void merge ( double  resolution,
double  min_prob 
)

Merges distributions of arbitrary data points with constant defined resolution.

It creates a new IsotopeDistribution Container and assigns each isotope to the nearest bin. This function should be used to downsample the existing distribution. If the size of the new Container is larger this function throws an IllegalArgument Exception.

◆ operator!=()

bool operator!= ( const IsotopeDistribution isotope_distribution) const

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

◆ operator<()

bool operator< ( const IsotopeDistribution isotope_distribution) const

less operator

◆ 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

◆ operator[]() [1/2]

Peak1D& operator[] ( const Size index)
inline

operator to access a cell of the distribution and wraps it in SpectrumFragment struct

◆ operator[]() [2/2]

const Peak1D& operator[] ( const Size index) const
inline

const operator to access a cell of the distribution and wraps it in SpectrumFragment struct

◆ 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 all the isotopes to 1.

The re-normalisation may be needed as in some distributions with a lot of isotopes the calculations tend to be inexact.

◆ resize()

void resize ( UInt  size)

◆ set() [1/2]

void set ( const ContainerType distribution)

overwrites the container which holds the distribution using distribution

◆ set() [2/2]

void set ( ContainerType &&  distribution)

overwrites the container which holds the distribution using distribution

◆ size()

Size size ( ) const

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

◆ sort_()

void sort_ ( std::function< bool(const MassAbundance &p1, const MassAbundance &p2)>  sorter)
protected

sort wrapper of the distribution

◆ sortByIntensity()

void sortByIntensity ( )

sort isotope distribution by intensity

◆ sortByMass()

void sortByMass ( )

sort isotope distribution by mass

◆ transform_()

void transform_ ( std::function< void(MassAbundance &)>  lambda)
protected

takes a function as a parameter to transform the distribution

◆ trimIntensities()

void trimIntensities ( double  cutoff)

remove intensities below the cutoff

◆ 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, it might happen that many entries contain only small numbers. This function can be used to remove these entries.

Note
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, it might happen that many entries contain only small numbers. This function can be used to remove these entries.

Note
Consider normalising the distribution afterwards.

Member Data Documentation

◆ distribution_

ContainerType distribution_
protected

stores the isotope distribution