OpenMS  2.4.0
Public Types | Protected Member Functions | Protected Attributes | List of all members
IsotopeDistribution Class Reference

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

Public Types

enum  Sorted { INTENSITY, MASS, UNDEFINED }
 
typedefs
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 &isotope_distribution)
 Copy constructor. More...
 
virtual ~IsotopeDistribution ()
 Destructor. More...
 
Accessors
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...
 
Peak1D::CoordinateType getMax () const
 returns the maximal weight isotope which is stored in the distribution More...
 
Peak1D::CoordinateType getMin () const
 returns the minimal weight isotope which is stored in the distribution 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 and resets max isotope to 0 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 the isotopes to 1 More...
 
void merge (double resolution, double min_prob)
 Merges distributions 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...
 
bool isNormalized () const
 
double averageMass () const
 
bool isConvolutionUnit () const
 
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
Peak1Doperator[] (const Size &index)
 operator which access a cell of the distribution and wraps it in SpectrumFragment struct More...
 

Protected Member Functions

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

Protected Attributes

ContainerType distribution_
 stores the isotope 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/2]

Default constructor, note max_isotope must be set later

◆ IsotopeDistribution() [2/2]

IsotopeDistribution ( const IsotopeDistribution isotope_distribution)

Copy constructor.

◆ ~IsotopeDistribution()

virtual ~IsotopeDistribution ( )
virtual

Destructor.

Member Function Documentation

◆ averageMass()

double averageMass ( ) const

◆ begin() [1/2]

Iterator begin ( )
inline

◆ begin() [2/2]

ConstIterator begin ( ) const
inline

◆ clear()

void clear ( )

◆ end() [1/2]

Iterator end ( )
inline

◆ end() [2/2]

ConstIterator end ( ) const
inline

◆ getContainer()

const ContainerType& getContainer ( ) const

◆ getMax()

Peak1D::CoordinateType getMax ( ) const

returns the maximal weight isotope which is stored in the distribution

◆ getMin()

Peak1D::CoordinateType getMin ( ) const

returns the minimal weight isotope which is stored in the distribution

◆ 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

◆ isConvolutionUnit()

bool isConvolutionUnit ( ) const

◆ isNormalized()

bool isNormalized ( ) const

◆ merge()

void merge ( double  resolution,
double  min_prob 
)

Merges distributions 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[]()

Peak1D& operator[] ( const Size index)
inline

operator which 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 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.

◆ resize()

void resize ( UInt  size)

◆ set()

void set ( const ContainerType 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 (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