| OpenMS 2.5.0

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MassExplainer Class Reference
Datastructures

computes empirical formulas for given mass differences using a set of allowed elements More...

`#include <OpenMS/DATASTRUCTURES/MassExplainer.h>`

## Public Types

typedef Adduct::AdductsType | AdductsType
typedef std::vector< Compomer >::const_iterator | CompomerIterator

## Public Member Functions

void | compute ()
| fill map with possible mass-differences along with their explanation More...
SignedSize | query (const Int net_charge, const float mass_to_explain, const float mass_delta, const float thresh_log_p, std::vector< Compomer >::const_iterator &firstExplanation, std::vector< Compomer >::const_iterator &lastExplanation) const
void | setAdductBase (AdductsType adduct_base)
| Sets the set of possible adducts. More...
AdductsType | getAdductBase () const
| Returns the set of adducts. More...
const Compomer & | getCompomerById (Size id) const
| return a compomer by its Id (useful after a query() ). More...

## Protected Member Functions

bool | compomerValid_ (const Compomer &cmp)
| check if the generated compomer is valid judged by its probability, charges etc More...
Adduct | createAdduct_ (const String &formula, const Int charge, const double p) const
| create a proper adduct from formula and charge and probability More...

## Protected Attributes

std::vector< Compomer > | explanations_
| store possible explanations (as formula) for a certain ChargeDifference and MassDifference More...
AdductsType | adduct_base_
| all allowed adducts, whose combination explains the mass difference More...
Int | q_min_
| minimal expected charge More...
Int | q_max_
| maximal expected charge More...
Int | max_span_
| maximal span (in terms of charge) for co-features, e.g. a cluster with q={3,6} has span=4 More...
double | thresh_p_
| minimum required probability of a compound (all other compounds are discarded) More...
Size | max_neutrals_
| Maximum number of neutral(q=0) adducts. More...

## Constructors and destructor

| MassExplainer ()
| Default constructor. More...
| MassExplainer (AdductsType adduct_base)
| Constructor. More...
| MassExplainer (Int q_min, Int q_max, Int max_span, double thresh_logp)
| Constructor. More...
| MassExplainer (AdductsType adduct_base, Int q_min, Int q_max, Int max_span, double thresh_logp, Size max_neutrals)
| Constructor. More...
MassExplainer & | operator= (const MassExplainer &rhs)
| Assignment operator. More...
virtual | ~MassExplainer ()
| Destructor. More...
void | init_ (bool init_thresh_p)

## Detailed Description

computes empirical formulas for given mass differences using a set of allowed elements

## Member Typedef Documentation

## ◆ AdductsType

typedef Adduct::AdductsType AdductsType

## ◆ CompomerIterator

typedef std::vector<Compomer>::const_iterator CompomerIterator

## Constructor & Destructor Documentation

## ◆ MassExplainer() [1/4]

MassExplainer | ( |  | ) |

Default constructor.

## ◆ MassExplainer() [2/4]

MassExplainer | ( | AdductsType | adduct_base | ) |

Constructor.

## ◆ MassExplainer() [3/4]

MassExplainer | ( | Int | q_min,
|  | Int | q_max,
|  | Int | max_span,
|  | double | thresh_logp
| ) |  |

Constructor.

## ◆ MassExplainer() [4/4]

MassExplainer | ( | AdductsType | adduct_base,
|  | Int | q_min,
|  | Int | q_max,
|  | Int | max_span,
|  | double | thresh_logp,
|  | Size | max_neutrals
| ) |  |

Constructor.

## ◆ ~MassExplainer()

virtual ~MassExplainer | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## ◆ compomerValid_()

bool compomerValid_ | ( | const Compomer & | cmp | ) |

protected

check if the generated compomer is valid judged by its probability, charges etc

## ◆ compute()

void compute | ( |  | ) |

fill map with possible mass-differences along with their explanation

## ◆ createAdduct_()

Adduct createAdduct_ | ( | const String & | formula,
|  | const Int | charge,
|  | const double | p
| ) |  | const

protected

create a proper adduct from formula and charge and probability

## ◆ getAdductBase()

AdductsType getAdductBase | ( |  | ) | const

Returns the set of adducts.

## ◆ getCompomerById()

const Compomer& getCompomerById | ( | Size | id | ) | const

return a compomer by its Id (useful after a query() ).

## ◆ init_()

void init_ | ( | bool | init_thresh_p | ) |

private

check consistency of input

Parameters

  init_thresh_p | set default threshold (set to "false" to keep current value)

## ◆ operator=()

MassExplainer& operator= | ( | const MassExplainer & | rhs | ) |

Assignment operator.

## ◆ query()

SignedSize query | ( | const Int | net_charge,
|  | const float | mass_to_explain,
|  | const float | mass_delta,
|  | const float | thresh_log_p,
|  | std::vector< Compomer >::const_iterator & | firstExplanation,
|  | std::vector< Compomer >::const_iterator & | lastExplanation
| ) |  | const

search the mass database for explanations

Parameters

  net_charge | net charge of compomer seeked
  mass_to_explain | mass in Da that needs explanation
  mass_delta | allowed deviation from exact mass
  thresh_log_p | minimal log probability required
  firstExplanation | begin range with candidates according to net_charge and mass
  lastExplanation | end range

## ◆ setAdductBase()

void setAdductBase | ( | AdductsType | adduct_base | ) |

Sets the set of possible adducts.

## Member Data Documentation

## ◆ adduct_base_

AdductsType adduct_base_

protected

all allowed adducts, whose combination explains the mass difference

## ◆ explanations_

std::vector<Compomer> explanations_

protected

store possible explanations (as formula) for a certain ChargeDifference and MassDifference

## ◆ max_neutrals_

Size max_neutrals_

protected

Maximum number of neutral(q=0) adducts.

## ◆ max_span_

Int max_span_

protected

maximal span (in terms of charge) for co-features, e.g. a cluster with q={3,6} has span=4

## ◆ q_max_

Int q_max_

protected

maximal expected charge

## ◆ q_min_

Int q_min_

protected

minimal expected charge

## ◆ thresh_p_

double thresh_p_

protected

minimum required probability of a compound (all other compounds are discarded)