OpenMS
MassExplainer Class Reference

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

#include <OpenMS/DATASTRUCTURES/MassExplainer.h>

Collaboration diagram for MassExplainer:
[legend]

Public Types

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

Constructors and destructor

std::vector< Compomerexplanations_
 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...
 
 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...
 
MassExplaineroperator= (const MassExplainer &rhs)
 Assignment operator. More...
 
virtual ~MassExplainer ()
 Destructor. More...
 
void compute ()
 fill map with possible mass-differences along with their explanation More...
 
void setAdductBase (AdductsType adduct_base)
 Sets the set of possible adducts. More...
 
AdductsType getAdductBase () const
 Returns the set of adducts. More...
 
const CompomergetCompomerById (Size id) const
 return a compomer by its Id (useful after a query() ). 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 init_ (bool init_thresh_p)
 
bool compomerValid_ (const Compomer &cmp) const
 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...
 

Detailed Description

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

Member Typedef Documentation

◆ AdductsType

◆ CompomerIterator

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

Constructor & Destructor Documentation

◆ MassExplainer() [1/4]

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) const
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_pset 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_chargenet charge of compomer seeked
mass_to_explainmass in Da that needs explanation
mass_deltaallowed deviation from exact mass
thresh_log_pminimal log probability required
firstExplanationbegin range with candidates according to net_charge and mass
lastExplanationend 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)