OpenMS
IsoSpecThresholdGeneratorWrapper Class Reference

Provides a threshold-based generator of isotopologues: generates all isotopologues more probable than a given probability threshold. More...

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

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

Public Member Functions

 IsoSpecThresholdGeneratorWrapper (const std::vector< int > &isotopeNumbers, const std::vector< int > &atomCounts, const std::vector< std::vector< double > > &isotopeMasses, const std::vector< std::vector< double > > &isotopeProbabilities, double threshold, bool absolute)
 Constructor. More...
 
 IsoSpecThresholdGeneratorWrapper (const IsoSpecThresholdGeneratorWrapper &)=delete
 
 IsoSpecThresholdGeneratorWrapper (const EmpiricalFormula &formula, double threshold, bool absolute)
 Setup the algorithm to run on an EmpiricalFormula. More...
 
 ~IsoSpecThresholdGeneratorWrapper ()
 
bool nextConf () final
 Move the generator to a next isotopologue. More...
 
Peak1D getConf () final
 Obtain the current isotopologue. More...
 
double getMass () final
 Obtain the mass of the current isotopologue. More...
 
double getIntensity () final
 Obtain the intensity (probability, relative peak height) of the current configuration. More...
 
double getLogIntensity () 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 ()=default
 Destructor. More...
 

Protected Attributes

std::unique_ptr< IsoSpec::IsoThresholdGenerator > ITG
 

Detailed Description

Provides a threshold-based generator of isotopologues: generates all isotopologues more probable than a given probability threshold.

This is the simplest generator - most users will however want to use IsoSpecTotalProbGeneratorWrapper. The reason for it is that when thresholding by peak intensity one has no idea how far the obtained spectrum is from a real spectrum. For example, consider human insulin: if the threshold is set at 0.1 of the most intense peak, then the peaks above the threshold account for 99.7% of total probability for water, 82% for substance P, only 60% for human insulin, and 23% for titin. For a threshold of 0.01, the numbers will be: still 99.7% for water, 96% for substance P, 88% for human insulin and 72% for titin (it also took 5 minutes on an average notebook computer to process the 17 billion configurations involved).

As you can see the threshold does not have a straightforward correlation to the accuracy of the final spectrum obtained - and accuracy of final spectrum is often what the user is interested in. The IsoSpecTotalProbGeneratorWrapper provides a way to directly parameterize based on the desired accuracy of the final spectrum - and should be used instead in most cases. The trade-off is that it's (slightly, though much less than it used to be) slower than Threshold algorithm.

Note
The eligible isotopologues are NOT guaranteed to be generated in any particular order.

Constructor & Destructor Documentation

◆ IsoSpecThresholdGeneratorWrapper() [1/3]

IsoSpecThresholdGeneratorWrapper ( const std::vector< int > &  isotopeNumbers,
const std::vector< int > &  atomCounts,
const std::vector< std::vector< double > > &  isotopeMasses,
const std::vector< std::vector< double > > &  isotopeProbabilities,
double  threshold,
bool  absolute 
)

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
thresholdIntensity threshold: will only compute peaks above this threshold
absoluteWhether the threshold is absolute or relative (relative to the most intense peak)
Note
This constructor is only useful if you need to define non-standard abundances of isotopes, for other uses the one accepting EmpiricalFormula is easier to use.

◆ IsoSpecThresholdGeneratorWrapper() [2/3]

◆ IsoSpecThresholdGeneratorWrapper() [3/3]

IsoSpecThresholdGeneratorWrapper ( const EmpiricalFormula formula,
double  threshold,
bool  absolute 
)

Setup the algorithm to run on an EmpiricalFormula.

◆ ~IsoSpecThresholdGeneratorWrapper()

Member Function Documentation

◆ getConf()

Peak1D getConf ( )
finalvirtual

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()

double getIntensity ( )
finalvirtual

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()

double getLogIntensity ( )
finalvirtual

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()

double getMass ( )
finalvirtual

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()

bool nextConf ( )
finalvirtual

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

◆ ITG

std::unique_ptr<IsoSpec::IsoThresholdGenerator> ITG
protected