OpenMS  2.6.0
Public Member Functions | Protected Attributes | List of all members
IsoSpecOrderedGeneratorWrapper Class Reference

Generate the stream of configurations, ordered from most likely to least likely. More...

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

Inheritance diagram for IsoSpecOrderedGeneratorWrapper:
[legend]
Collaboration diagram for IsoSpecOrderedGeneratorWrapper:
[legend]

Public Member Functions

 IsoSpecOrderedGeneratorWrapper (const std::vector< int > &isotopeNumbers, const std::vector< int > &atomCounts, const std::vector< std::vector< double > > &isotopeMasses, const std::vector< std::vector< double > > &isotopeProbabilities)
 Constructor. More...
 
 IsoSpecOrderedGeneratorWrapper (const EmpiricalFormula &formula)
 Setup the algorithm to run on an EmpiricalFormula. More...
 
virtual bool nextConf () override final
 Move the generator to a next isotopologue. More...
 
virtual Peak1D getConf () override final
 Obtain the current isotopologue. More...
 
virtual double getMass () override final
 Obtain the mass of the current isotopologue. More...
 
virtual double getIntensity () override final
 Obtain the intensity (probability, relative peak height) of the current configuration. More...
 
virtual double getLogIntensity () override final
 Obtain the natural logarithm of the intensity (probability, relative peak height) of the current configuration. More...
 
- Public Member Functions inherited from IsoSpecGeneratorWrapper
virtual ~IsoSpecGeneratorWrapper ()
 Destructor. More...
 

Protected Attributes

IsoSpec::IsoOrderedGenerator IOG
 

Detailed Description

Generate the stream of configurations, ordered from most likely to least likely.

This generator walks through the entire set of isotopologues of a given molecule, allowing the user to terminate the search on the fly. The returned isotopologues are guaranteed to be generated in order of descending probability (unlike the previous two generators which make no such guarantees).

This causes the algorithm to run in O(n*log(n)) and means that is it much slower than the previous two.

You should only use this generator if you don't know up-front when to stop the walk through the configuration space, and need to make the decision on the fly. If you know the threshold or the total probability needed, and only need the configurations sorted, it will be much faster to generate them using one of the previous algorithms and sort them afterwards.

Constructor & Destructor Documentation

◆ IsoSpecOrderedGeneratorWrapper() [1/2]

IsoSpecOrderedGeneratorWrapper ( const std::vector< int > &  isotopeNumbers,
const std::vector< int > &  atomCounts,
const std::vector< std::vector< double > > &  isotopeMasses,
const std::vector< std::vector< double > > &  isotopeProbabilities 
)

Constructor.

Parameters
isotopeNumbersA vector of how many isotopes each element has, e.g. [2, 2, 3])
atomCountsHow many atoms of each we have [e.g. 12, 6, 6 for Glucose]
isotopeMassesArray with the individual elements isotopic masses
isotopeProbabilitiesArray with the individual elements isotopic probabilities

◆ IsoSpecOrderedGeneratorWrapper() [2/2]

Setup the algorithm to run on an EmpiricalFormula.

Member Function Documentation

◆ getConf()

virtual Peak1D getConf ( )
inlinefinaloverridevirtual

Obtain the current isotopologue.

Returns
The current isotopologue as a Peak1D
Note
It is invalid (undefined results) to call this method before the first call to nextConf(), or after it returns false

Implements IsoSpecGeneratorWrapper.

◆ getIntensity()

virtual double getIntensity ( )
inlinefinaloverridevirtual

Obtain the intensity (probability, relative peak height) of the current configuration.

Returns
The intensity (probability) of the current isotopologue
Note
It is invalid (undefined results) to call this method before the first call to nextConf(), or after it returns false

Implements IsoSpecGeneratorWrapper.

◆ getLogIntensity()

virtual double getLogIntensity ( )
inlinefinaloverridevirtual

Obtain the natural logarithm of the intensity (probability, relative peak height) of the current configuration.

This will be more precise (and faster) than just calling std::log(getIntensity()) - it will produce correct results even for configurations so unlikely that the double-precision floating point number returned from getIntensity() underflows to zero.

Returns
The natural logarithm of intensity (probability) of the current isotopologue
Note
It is invalid (undefined results) to call this method before the first call to nextConf(), or after it returns false

Implements IsoSpecGeneratorWrapper.

◆ getMass()

virtual double getMass ( )
inlinefinaloverridevirtual

Obtain the mass of the current isotopologue.

Returns
The mass of the current isotopologue
Note
It is invalid (undefined results) to call this method before the first call to nextConf(), or after it returns false

Implements IsoSpecGeneratorWrapper.

◆ nextConf()

virtual bool nextConf ( )
inlinefinaloverridevirtual

Move the generator to a next isotopologue.

Advance the internal generator to the next isotopologue. The value returned determines whether the generator has been exhausted (that is, all eligible configurations have already been visited). It is invalid to call any other generator methods before the first call to nextConf(), as well as after this method returns false.

Returns
A boolean value stating whether the generator has been exhausted.

Implements IsoSpecGeneratorWrapper.

Member Data Documentation

◆ IOG

IsoSpec::IsoOrderedGenerator IOG
protected