---
name: "IsoSpec"
section: "3"
platform: "linux"
package: "libisospec++-dev"
version: "2.2.1-4.1+b3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/IsoSpec"
---

# IsoSpec(3)

## NAME

IsoSpec

## SYNOPSIS

### Classes

class **Allocator**\
 class **ConfEqual**\
 class **ConfOrder**\
 class **ConfOrderMarginal**\
 class **ConfOrderMarginalDescending**\
 class **DirtyAllocator**\
 class **FixedEnvelope**\
 class **Iso**\
 The **Iso** class for the calculation of the isotopic distribution.  class **IsoGenerator**\
 The generator of isotopologues.  class **IsoLayeredGenerator**\
 class **IsoOrderedGenerator**\
 The generator of isotopologues sorted by their probability of occurrence.  class **IsoStochasticGenerator**\
 class **IsoThresholdGenerator**\
 The generator of isotopologues above a given threshold value.  class **KeyHasher**\
 class **LayeredMarginal**\
 **LayeredMarginal** class.  class **Marginal**\
 The marginal distribution class (a subisotopologue).  class **MarginalTrek**\
 The marginal distribution class (a subisotopologue).  class **OrderMarginalsBySizeDecresing**\
 class **PrecalculatedMarginal**\
 Precalculated **Marginal** class.  struct **ProbAndConfPtr**\
 class **ReverseOrder**\
 class **SSummator**\
 class **Summator**\
 class **TableOrder**\
 class **TSummator**\

### Typedefs

typedef double **RealType**\
 typedef int64\_t **IntType**\
 typedef int \* **Conf**\

### Functions

template\<typename T \> void **copyConf** (const T \*source, T \*destination, int dim)\
 IntType **btrd** (IntType \_t, RealType p, IntType m, std::mt19937 &urng=random\_gen)\
 IntType **invert** (IntType t, RealType p, std::mt19937 &urng=random\_gen)\
 IntType **boost\_binomial\_distribution\_variate** (IntType t\_arg, RealType p\_arg, std::mt19937 &urng=random\_gen)\
 void **parse\_fasta** (const char \*fasta, int atomCounts\[6\])\
 template\<typename T \> void **reorder\_array** (T \*arr, size\_t \*order, size\_t size, bool can\_destroy=false)\
 double **AbyssalWassersteinDistanceGrad** (**FixedEnvelope** \*const \*envelopes, const double \*scales, double \*ret\_gradient, size\_t N, double abyss\_depth\_exp, double abyss\_depth\_the)\
 void **release\_g\_lfact\_table** ()\
 double \* **alloc\_lfact\_table** ()\
 double **RationalApproximation** (double t)\
 double **NormalCDFInverse** (double p)\
 double **NormalCDFInverse** (double p, double mean, double stdev)\
 double **NormalCDF** (double x, double mean, double stdev)\
 double **NormalPDF** (double x, double mean, double stdev)\
 double **LowerIncompleteGamma2** (int a, double x)\
 double **InverseLowerIncompleteGamma2** (int a, double x)\
 std::mt19937 **random\_gen** (random\_dev())\
 std::uniform\_real\_distribution\< double \> **stdunif** (0.0, 1.0)\
 size\_t **rdvariate\_binom** (size\_t tries, double succ\_prob, std::mt19937 &rgen)\
 double **InverseChiSquareCDF2** (int k, double x)\
 double **rdvariate\_beta\_1\_b** (double b, std::mt19937 &rgen=random\_gen)\
 unsigned int **parse\_formula** (const char \*formula, std::vector\< double \> &isotope\_masses, std::vector\< double \> &isotope\_probabilities, int \*\*isotopeNumbers, int \*\*atomCounts, unsigned int \*confSize, bool use\_nominal\_masses)\
 void **writeInitialConfiguration** (const int atomCnt, const int isotopeNo, const double \*lprobs, int \*res)\
 Find one of the most probable subisotopologues.  double \* **getMLogProbs** (const double \*probs, int isoNo)\
 double **get\_loggamma\_nominator** (int x)\
 int **verify\_atom\_cnt** (int atomCnt)\
 void \* **quickselect** (void \*\*array, int n, int start, int end)\
 double **combinedSum** (const int \*conf, const std::vector\< double \> \*\*valuesContainer, int dimNumber)\
 double **combinedSum** (const int \*conf, const **pod\_vector**\< double \> \*\*valuesContainer, int dimNumber)\
 int \* **getConf** (void \*conf)\
 double **getLProb** (void \*conf)\
 double **unnormalized\_logProb** (const int \*conf, const double \*logProbs, int dim)\
 double **calc\_mass** (const int \*conf, const double \*masses, int dim)\
 template\<typename T \> void **printArray** (const T \*array, int size, const char \*prefix='')\
 template\<typename T \> void **printVector** (const std::vector\< T \> &vec)\
 template\<typename T \> void **printOffsets** (const T \*\*array, int size, const T \*offset, const char \*prefix='')\
 template\<typename T \> void **printNestedArray** (const T \*\*array, const int \*shape, int size)\
 void \* **quickselect** (const void \*\*array, int n, int start, int end)\
 Quickly select the n'th positional statistic, including the weights.  template\<typename T \> void **dealloc\_table** (T \*tbl, int dim)\
 template\<typename T \> void **realloc\_append** (T \*\*array, T what, size\_t old\_array\_size)\
 template\<typename T \> size\_t \* **get\_order** (T \*order\_array, size\_t N)\
 template\<typename T \> size\_t \* **get\_inverse\_order** (T \*order\_array, size\_t N)\
 template\<typename TA , typename TB \> void **impose\_order** (size\_t \*O, size\_t N, TA \*A, TB \*B)\

### Variables

const size\_t **isospec\_number\_of\_isotopic\_entries** = ISOSPEC\_NUMBER\_OF\_ISOTOPIC\_ENTRIES\
 const int **elem\_table\_ID** \[ISOSPEC\_NUMBER\_OF\_ISOTOPIC\_ENTRIES\]\
 const int **elem\_table\_atomicNo** \[ISOSPEC\_NUMBER\_OF\_ISOTOPIC\_ENTRIES\]\
 const double **elem\_table\_mass** \[ISOSPEC\_NUMBER\_OF\_ISOTOPIC\_ENTRIES\]\
 const double **elem\_table\_massNo** \[ISOSPEC\_NUMBER\_OF\_ISOTOPIC\_ENTRIES\]\
 const int **elem\_table\_extraNeutrons** \[ISOSPEC\_NUMBER\_OF\_ISOTOPIC\_ENTRIES\]\
 const char \* **elem\_table\_element** \[ISOSPEC\_NUMBER\_OF\_ISOTOPIC\_ENTRIES\]\
 const char \* **elem\_table\_symbol** \[ISOSPEC\_NUMBER\_OF\_ISOTOPIC\_ENTRIES\]\
 const bool **elem\_table\_Radioactive** \[ISOSPEC\_NUMBER\_OF\_ISOTOPIC\_ENTRIES\]\
 const double **elem\_table\_probability** \[ISOSPEC\_NUMBER\_OF\_ISOTOPIC\_ENTRIES\]\
 const double **elem\_table\_log\_probability** \[ISOSPEC\_NUMBER\_OF\_ISOTOPIC\_ENTRIES\]\
 const int **aa\_isotope\_numbers** \[6\] = {2, 2, 2, 3, 4, 6}\
 const double **aa\_elem\_masses** \[19\]\
 const double **aa\_elem\_nominal\_masses** \[19\]\
 const double **aa\_elem\_probabilities** \[19\]\
 const int **aa\_symbol\_to\_elem\_counts** \[256 \*6\]\
 double \* **g\_lfact\_table** = alloc\_lfact\_table()\
 const double **sqrt\_pi** = 1.772453850905516027298167483341145182798\
 std::random\_device **random\_dev**\
 const double **pi** = 3.14159265358979323846264338328\
 const double **logpi** = 1.144729885849400174143427351353058711647294812915311571513623071472137769884826079783623270275489708\
 std::mt19937 **random\_gen**\
 std::uniform\_real\_distribution\< double \> **stdunif**\

## Detailed Description

Copyright (C) 2015-2020 Mateusz Łącki and Michał Startek.

This file is part of **IsoSpec**.

**IsoSpec** is free software: you can redistribute it and/or modify it under the terms of the Simplified ('2-clause') BSD licence.

**IsoSpec** is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

You should have received a copy of the Simplified BSD Licence along with **IsoSpec**. If not, see https://opensource.org/licenses/BSD-2-Clause.

## Typedef Documentation

### typedef int\* IsoSpec::Conf

Definition at line **22** of file **conf.h**.

### typedef int64\_t IsoSpec::IntType

Definition at line **28** of file **btrd.h**.

### typedef double IsoSpec::RealType

Definition at line **27** of file **btrd.h**.

## Function Documentation

### double \* IsoSpec::alloc\_lfact\_table ()

Definition at line **32** of file **isoMath.cpp**.

### IntType IsoSpec::boost\_binomial\_distribution\_variate (IntType t\_arg, RealType p\_arg, std::mt19937 & urng = `random_gen`)

Definition at line **189** of file **btrd.h**.

### IntType IsoSpec::btrd (IntType \_t, RealType p, IntType m, std::mt19937 & urng = `random_gen`)

Definition at line **77** of file **btrd.h**.

### double IsoSpec::calc\_mass (const int \* conf, const double \* masses, int dim)` [inline]`

Definition at line **71** of file **misc.h**.

### double IsoSpec::combinedSum (const int \* conf, const pod\_vector\< double \> \*\* valuesContainer, int dimNumber)` [inline]`

Definition at line **38** of file **misc.h**.

### double IsoSpec::combinedSum (const int \* conf, const std::vector\< double \> \*\* valuesContainer, int dimNumber)` [inline]`

Definition at line **29** of file **misc.h**.

### template\<typename T \> void IsoSpec::copyConf (const T \* source, T \* destination, int dim)` [inline]`

Definition at line **26** of file **allocator.h**.

### template\<typename T \> void IsoSpec::dealloc\_table (T \* tbl, int dim)

Definition at line **133** of file **misc.h**.

### template\<typename T \> size\_t \* IsoSpec::get\_inverse\_order (T \* order\_array, size\_t N)

Definition at line **162** of file **misc.h**.

### double IsoSpec::get\_loggamma\_nominator (int x)

Definition at line **149** of file **marginalTrek++.cpp**.

### template\<typename T \> size\_t \* IsoSpec::get\_order (T \* order\_array, size\_t N)

Definition at line **151** of file **misc.h**.

### int \* IsoSpec::getConf (void \* conf)` [inline]`

Definition at line **47** of file **misc.h**.

### double IsoSpec::getLProb (void \* conf)` [inline]`

Definition at line **54** of file **misc.h**.

### double \* IsoSpec::getMLogProbs (const double \* probs, int isoNo)

Here we order the processor to round the numbers up rather than down. Rounding down could result in the algorithm falling in an infinite loop because of the numerical instability of summing.

Definition at line **122** of file **marginalTrek++.cpp**.

### template\<typename TA , typename TB \> void IsoSpec::impose\_order (size\_t \* O, size\_t N, TA \* A, TB \* B)

Definition at line **173** of file **misc.h**.

### double IsoSpec::InverseChiSquareCDF2 (int k, double x)` [inline]`

Definition at line **68** of file **isoMath.h**.

### double IsoSpec::InverseLowerIncompleteGamma2 (int a, double x)

Definition at line **131** of file **isoMath.cpp**.

### IntType IsoSpec::invert (IntType t, RealType p, std::mt19937 & urng = `random_gen`)

Definition at line **160** of file **btrd.h**.

### double IsoSpec::LowerIncompleteGamma2 (int a, double x)

Definition at line **104** of file **isoMath.cpp**.

### double IsoSpec::NormalCDF (double x, double mean, double stdev)

Definition at line **70** of file **isoMath.cpp**.

### double IsoSpec::NormalCDFInverse (double p)

Definition at line **57** of file **isoMath.cpp**.

### double IsoSpec::NormalCDFInverse (double p, double mean, double stdev)

Definition at line **65** of file **isoMath.cpp**.

### double IsoSpec::NormalPDF (double x, double mean, double stdev)

Definition at line **95** of file **isoMath.cpp**.

### void IsoSpec::parse\_fasta (const char \* fasta, int atomCounts\[6\])` [inline]`

Definition at line **33** of file **fasta.h**.

### unsigned int IsoSpec::parse\_formula (const char \* formula, std::vector\< double \> & isotope\_masses, std::vector\< double \> & isotope\_probabilities, int \*\* isotopeNumbers, int \*\* atomCounts, unsigned int \* confSize, bool use\_nominal\_masses)

Definition at line **355** of file **isoSpec++.cpp**.

### template\<typename T \> void IsoSpec::printArray (const T \* array, int size, const char \* prefix = `''`)

Definition at line **85** of file **misc.h**.

### template\<typename T \> void IsoSpec::printNestedArray (const T \*\* array, const int \* shape, int size)

Definition at line **108** of file **misc.h**.

### template\<typename T \> void IsoSpec::printOffsets (const T \*\* array, int size, const T \* offset, const char \* prefix = `''`)

Definition at line **99** of file **misc.h**.

### template\<typename T \> void IsoSpec::printVector (const std::vector\< T \> & vec)

Definition at line **94** of file **misc.h**.

### void \* IsoSpec::quickselect (void \*\* array, int n, int start, int end)

Definition at line **28** of file **misc.cpp**.

### double IsoSpec::RationalApproximation (double t)

Definition at line **47** of file **isoMath.cpp**.

### double IsoSpec::rdvariate\_beta\_1\_b (double b, std::mt19937 & rgen = `random_gen`)` [inline]`

Definition at line **76** of file **isoMath.h**.

### size\_t IsoSpec::rdvariate\_binom (size\_t tries, double succ\_prob, std::mt19937 & rgen)

Definition at line **153** of file **isoMath.cpp**.

### template\<typename T \> void IsoSpec::realloc\_append (T \*\* array, T what, size\_t old\_array\_size)

Definition at line **142** of file **misc.h**.

### void IsoSpec::release\_g\_lfact\_table ()

Definition at line **23** of file **isoMath.cpp**.

### template\<typename T \> void IsoSpec::reorder\_array (T \* arr, size\_t \* order, size\_t size, bool can\_destroy = `false`)

Definition at line **134** of file **fixedEnvelopes.cpp**.

### double IsoSpec::unnormalized\_logProb (const int \* conf, const double \* logProbs, int dim)` [inline]`

Definition at line **61** of file **misc.h**.

### int IsoSpec::verify\_atom\_cnt (int atomCnt)

Definition at line **156** of file **marginalTrek++.cpp**.

### void IsoSpec::writeInitialConfiguration (const int atomCnt, const int isotopeNo, const double \* lprobs, int \* res)

Find one of the most probable subisotopologues. The algorithm uses the hill-climbing algorithm. It starts from a subisotopologue close to the mean of the underlying multinomial distribution. There might be more than one modes, in case of which this function will return only one of them, close to the mean.

**Parameters**

*atomCnt*

Here we perform hill climbing to the mode of the marginal distribution (the subisotopologue distribution). We start from the point close to the mean of the underlying multinomial distribution.

Definition at line **50** of file **marginalTrek++.cpp**.

## Variable Documentation

### const double IsoSpec::aa\_elem\_masses

**Initial value:**.PP

```
= {
    elem_table_mass[9], elem_table_mass[10],
    elem_table_mass[0], elem_table_mass[1],
    elem_table_mass[11], elem_table_mass[12],
    elem_table_mass[13], elem_table_mass[14], elem_table_mass[15],
    elem_table_mass[29], elem_table_mass[30], elem_table_mass[31], elem_table_mass[32],
    elem_table_mass[85], elem_table_mass[86], elem_table_mass[87], elem_table_mass[88], elem_table_mass[89], elem_table_mass[90]
}
```

Definition at line **27** of file **fasta.cpp**.

### const double IsoSpec::aa\_elem\_nominal\_masses

**Initial value:**.PP

```
= {
    elem_table_massNo[9], elem_table_massNo[10],
    elem_table_massNo[0], elem_table_massNo[1],
    elem_table_massNo[11], elem_table_massNo[12],
    elem_table_massNo[13], elem_table_massNo[14], elem_table_massNo[15],
    elem_table_massNo[29], elem_table_massNo[30], elem_table_massNo[31], elem_table_massNo[32],
    elem_table_massNo[85], elem_table_massNo[86], elem_table_massNo[87], elem_table_massNo[88], elem_table_massNo[89], elem_table_massNo[90]
}
```

Definition at line **37** of file **fasta.cpp**.

### const double IsoSpec::aa\_elem\_probabilities

**Initial value:**.PP

```
= {
    elem_table_probability[9], elem_table_probability[10],
    elem_table_probability[0], elem_table_probability[1],
    elem_table_probability[11], elem_table_probability[12],
    elem_table_probability[13], elem_table_probability[14], elem_table_probability[15],
    elem_table_probability[29], elem_table_probability[30], elem_table_probability[31], elem_table_probability[32],
    elem_table_probability[85], elem_table_probability[86], elem_table_probability[87], elem_table_probability[88], elem_table_probability[89], elem_table_probability[90]
}
```

Definition at line **47** of file **fasta.cpp**.

### const int IsoSpec::aa\_isotope\_numbers = {2, 2, 2, 3, 4, 6}

Definition at line **25** of file **fasta.cpp**.

### const int IsoSpec::aa\_symbol\_to\_elem\_counts

Definition at line **57** of file **fasta.cpp**.

### ISOSPEC\_C\_API const int IsoSpec::elem\_table\_atomicNo

Definition at line **325** of file **element\_tables.cpp**.

### ISOSPEC\_C\_API const char \* IsoSpec::elem\_table\_element

Definition at line **1509** of file **element\_tables.cpp**.

### ISOSPEC\_C\_API const int IsoSpec::elem\_table\_extraNeutrons

Definition at line **1213** of file **element\_tables.cpp**.

### ISOSPEC\_C\_API const int IsoSpec::elem\_table\_ID

Definition at line **28** of file **element\_tables.cpp**.

### ISOSPEC\_C\_API const double IsoSpec::elem\_table\_log\_probability

Definition at line **2693** of file **element\_tables.cpp**.

### ISOSPEC\_C\_API const double IsoSpec::elem\_table\_mass

Definition at line **621** of file **element\_tables.cpp**.

### ISOSPEC\_C\_API const double IsoSpec::elem\_table\_massNo

Definition at line **917** of file **element\_tables.cpp**.

### ISOSPEC\_C\_API const double IsoSpec::elem\_table\_probability

Definition at line **2397** of file **element\_tables.cpp**.

### ISOSPEC\_C\_API const bool IsoSpec::elem\_table\_Radioactive

Definition at line **2101** of file **element\_tables.cpp**.

### ISOSPEC\_C\_API const char \* IsoSpec::elem\_table\_symbol

Definition at line **1805** of file **element\_tables.cpp**.

### double \* IsoSpec::g\_lfact\_table = alloc\_lfact\_table()

Definition at line **44** of file **isoMath.cpp**.

### ISOSPEC\_C\_API const size\_t IsoSpec::isospec\_number\_of\_isotopic\_entries = ISOSPEC\_NUMBER\_OF\_ISOTOPIC\_ENTRIES

Definition at line **26** of file **element\_tables.cpp**.

### const double IsoSpec::logpi = 1.144729885849400174143427351353058711647294812915311571513623071472137769884826079783623270275489708

Definition at line **54** of file **isoMath.h**.

### const double IsoSpec::pi = 3.14159265358979323846264338328

Definition at line **53** of file **isoMath.h**.

### std::random\_device IsoSpec::random\_dev

Definition at line **149** of file **isoMath.cpp**.

### const double IsoSpec::sqrt\_pi = 1.772453850905516027298167483341145182798

Definition at line **102** of file **isoMath.cpp**.

## Author

Generated automatically by Doxygen for IsoSpec from the source code.
