OpenMS  2.8.0
Public Types | Public Member Functions | Private Attributes | List of all members
RealMassDecomposer Class Reference

Handles decomposing of non-integer values/masses over a set of non-integer weights with an error allowed. More...

#include <OpenMS/CHEMISTRY/MASSDECOMPOSITION/IMS/RealMassDecomposer.h>

Collaboration diagram for RealMassDecomposer:
[legend]

Public Types

typedef IntegerMassDecomposer integer_decomposer_type
 Type of integer decomposer. More...
 
typedef integer_decomposer_type::value_type integer_value_type
 Type of integer values that are decomposed. More...
 
typedef integer_decomposer_type::decompositions_type decompositions_type
 Type of result decompositions from integer decomposer. More...
 
typedef unsigned long long number_of_decompositions_type
 Type of the number of decompositions. More...
 
typedef std::map< unsigned int, std::pair< unsigned int, unsigned int > > constraints_type
 

Public Member Functions

 RealMassDecomposer (const Weights &weights)
 
decompositions_type getDecompositions (double mass, double error)
 
decompositions_type getDecompositions (double mass, double error, const constraints_type &constraints)
 
number_of_decompositions_type getNumberOfDecompositions (double mass, double error)
 

Private Attributes

Weights weights_
 Weights over which values/masses to be decomposed. More...
 
std::pair< double, double > rounding_errors_
 Minimal and maximal rounding errors. More...
 
double precision_
 Precision to scale double values to integer. More...
 
std::shared_ptr< integer_decomposer_typedecomposer_
 

Detailed Description

Handles decomposing of non-integer values/masses over a set of non-integer weights with an error allowed.

Implements a decomposition of non-integer values with a certain error allowed. Exactness of decomposition can also be tuned by setting a precision factor for weights defining their scaling magnitude.

Works in fact as a wrapper for classes that handle exact mass decomposing using integer arithmetics. Instead of decomposing a single value as done by integer mass decomposers, RealMassDecomposer defines a set of values that lie in the allowed range (defined by error and false negatives appeared due to rounding), scales those to integers, decomposes them using IntegerMassDecomposer, does some checks (i.e. on false positives appeared due to rounding) and collects decompositions together.

Author
Anton Pervukhin Anton.nosp@m..Per.nosp@m.vukhi.nosp@m.n@Ce.nosp@m.BiTec.nosp@m..Uni.nosp@m.-Biel.nosp@m.efel.nosp@m.d.DE

Member Typedef Documentation

◆ constraints_type

typedef std::map<unsigned int, std::pair<unsigned int, unsigned int> > constraints_type

◆ decompositions_type

Type of result decompositions from integer decomposer.

◆ integer_decomposer_type

Type of integer decomposer.

◆ integer_value_type

Type of integer values that are decomposed.

◆ number_of_decompositions_type

typedef unsigned long long number_of_decompositions_type

Type of the number of decompositions.

Constructor & Destructor Documentation

◆ RealMassDecomposer()

RealMassDecomposer ( const Weights weights)
explicit

Constructor with weights.

Parameters
weightsWeights over which values/masses to be decomposed.

Member Function Documentation

◆ getDecompositions() [1/2]

decompositions_type getDecompositions ( double  mass,
double  error 
)

Gets all decompositions for a mass with an error allowed.

Parameters
massMass to be decomposed.
errorError allowed between given and result decomposition.
Returns
All possible decompositions for a given mass and error.

◆ getDecompositions() [2/2]

decompositions_type getDecompositions ( double  mass,
double  error,
const constraints_type constraints 
)

◆ getNumberOfDecompositions()

number_of_decompositions_type getNumberOfDecompositions ( double  mass,
double  error 
)

Gets a number of all decompositions for a mass with an error allowed. It's similar to the getDecompositions(double,double) function but less space consuming, since doesn't use container to store decompositions.

Parameters
massMass to be decomposed.
errorError allowed between given and result decomposition.
Returns
Number of all decompositions for a given mass and error.

Member Data Documentation

◆ decomposer_

std::shared_ptr<integer_decomposer_type> decomposer_
private

Decomposer to be used for exact decomposing using integer arithmetic.

◆ precision_

double precision_
private

Precision to scale double values to integer.

◆ rounding_errors_

std::pair<double, double> rounding_errors_
private

Minimal and maximal rounding errors.

◆ weights_

Weights weights_
private

Weights over which values/masses to be decomposed.