IsoSpec  1.95
Public Member Functions | List of all members
IsoSpec::IsoThresholdGenerator Class Reference

The generator of isotopologues above a given threshold value. More...

#include <isoSpec++.h>

Inheritance diagram for IsoSpec::IsoThresholdGenerator:
IsoSpec::IsoGenerator IsoSpec::Iso

Public Member Functions

void get_conf_signature (int *space) const override final
 
 IsoThresholdGenerator (Iso &&iso, double _threshold, bool _absolute=true, int _tabSize=1000, int _hashSize=1000, bool reorder_marginals=true)
 The move-constructor. More...
 
ISOSPEC_FORCE_INLINE bool advanceToNextConfiguration () override final
 Advance to the next, not yet visited, most probable isotopologue. More...
 
ISOSPEC_FORCE_INLINE double lprob () const override final
 Get the log-probability of the current isotopologue. More...
 
ISOSPEC_FORCE_INLINE double mass () const override final
 Get the mass of the current isotopologue. More...
 
ISOSPEC_FORCE_INLINE double prob () const override final
 Get the probability of the current isotopologue. More...
 
void terminate_search ()
 Block the subsequent search of isotopologues.
 
void reset ()
 
size_t count_confs ()
 
- Public Member Functions inherited from IsoSpec::IsoGenerator
 IsoGenerator (Iso &&iso, bool alloc_partials=true)
 Move constructor.
 
virtual ~IsoGenerator ()
 Destructor.
 
- Public Member Functions inherited from IsoSpec::Iso
 Iso (int _dimNumber, const int *_isotopeNumbers, const int *_atomCounts, const double *const *_isotopeMasses, const double *const *_isotopeProbabilities)
 General constructror. More...
 
 Iso (const char *formula)
 Constructor from the formula object.
 
 Iso (Iso &&other)
 The move constructor.
 
 Iso (const Iso &other, bool fullcopy)
 The copy constructor. More...
 
virtual ~Iso ()
 Destructor.
 
double getLightestPeakMass () const
 Get the mass of the lightest peak in the isotopic distribution.
 
double getHeaviestPeakMass () const
 Get the mass of the heaviest peak in the isotopic distribution.
 
double getModeLProb () const
 Get the log-probability of the mode-configuration (if there are many modes, they share this value).
 
int getDimNumber () const
 Get the number of elements in the chemical formula of the molecule.
 
int getAllDim () const
 Get the total number of isotopes of elements present in a chemical formula.
 

Additional Inherited Members

- Public Attributes inherited from IsoSpec::Iso
bool disowned
 
- Protected Attributes inherited from IsoSpec::IsoGenerator
double * partialLProbs
 
double * partialMasses
 
double * partialProbs
 
- Protected Attributes inherited from IsoSpec::Iso
int dimNumber
 
int * isotopeNumbers
 
int * atomCounts
 
unsigned int confSize
 
int allDim
 
Marginal ** marginals
 
double modeLProb
 

Detailed Description

The generator of isotopologues above a given threshold value.

Attention: the calculated configurations are only partially ordeded and the user should not assume they will be ordered. This algorithm computes N isotopologues in O(N). It is a considerable advantage w.r.t. the IsoOrderedGenerator.

Definition at line 235 of file isoSpec++.h.

Constructor & Destructor Documentation

◆ IsoThresholdGenerator()

IsoSpec::IsoThresholdGenerator::IsoThresholdGenerator ( Iso &&  iso,
double  _threshold,
bool  _absolute = true,
int  _tabSize = 1000,
int  _hashSize = 1000,
bool  reorder_marginals = true 
)

The move-constructor.

Parameters
isoAn instance of the Iso class.
_thresholdThe threshold value.
_absoluteIf true, the _threshold is interpreted as the absolute minimal peak height for the isotopologues. If false, the _threshold is the fraction of the heighest peak's probability.
tabSizeThe size of the extension of the table with configurations.
hashSizeThe size of the hash-table used to store subisotopologues and check if they have been already calculated.

Definition at line 311 of file isoSpec++.cpp.

Member Function Documentation

◆ advanceToNextConfiguration()

ISOSPEC_FORCE_INLINE bool IsoSpec::IsoThresholdGenerator::advanceToNextConfiguration ( )
inlinefinaloverridevirtual

Advance to the next, not yet visited, most probable isotopologue.

Returns
Return false if it is not possible to advance.

Implements IsoSpec::IsoGenerator.

Definition at line 296 of file isoSpec++.h.

◆ count_confs()

size_t IsoSpec::IsoThresholdGenerator::count_confs ( )

Count the number of configurations in the distribution. This can be used to pre-allocate enough memory to store it (e.g. std::vector's reserve() method - this is faster than depending on the vector's dynamic resizing, even though it means that the configuration space is walked through twice. This method has to be called before the first call to advanceToNextConfiguration and has undefined results (incl. segfaults) otherwise.

Definition at line 401 of file isoSpec++.cpp.

◆ lprob()

ISOSPEC_FORCE_INLINE double IsoSpec::IsoThresholdGenerator::lprob ( ) const
inlinefinaloverridevirtual

Get the log-probability of the current isotopologue.

Returns
The log-probability of the current isotopologue.

Reimplemented from IsoSpec::IsoGenerator.

Definition at line 335 of file isoSpec++.h.

◆ mass()

ISOSPEC_FORCE_INLINE double IsoSpec::IsoThresholdGenerator::mass ( ) const
inlinefinaloverridevirtual

Get the mass of the current isotopologue.

Returns
The mass of the current isotopologue.

Reimplemented from IsoSpec::IsoGenerator.

Definition at line 336 of file isoSpec++.h.

◆ prob()

ISOSPEC_FORCE_INLINE double IsoSpec::IsoThresholdGenerator::prob ( ) const
inlinefinaloverridevirtual

Get the probability of the current isotopologue.

Returns
The probability of the current isotopologue.

Reimplemented from IsoSpec::IsoGenerator.

Definition at line 337 of file isoSpec++.h.

◆ reset()

void IsoSpec::IsoThresholdGenerator::reset ( )

Reset the generator to the beginning of the sequence. Allows it to be reused, eg. to go through the conf space once, calculate the amount of space needed to store configurations, then to allocate that memory, and go through it again, this time saving configurations (and is in fact faster than allocating a std::vector and depending on it to grow as needed. This is cheaper than throwing away the generator and making a new one too: marginal distributions don't need to be recalculated.

Definition at line 411 of file isoSpec++.cpp.


The documentation for this class was generated from the following files: