| OpenMS 2.5.0

Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
ElementDB Class Reference
Chemistry

Stores elements. More...

`#include <OpenMS/CHEMISTRY/ElementDB.h>`

## Public Member Functions

Predicates
bool | hasElement (const String &name) const
| returns true if the db contains an element with the given name More...
bool | hasElement (UInt atomic_number) const
| returns true if the db contains an element with the given atomic_number More...

## Protected Member Functions

IsotopeDistribution | parseIsotopeDistribution_ (const Map< UInt, double > &Z_to_abundance, const Map< UInt, double > &Z_to_mass)
double | calculateAvgWeight_ (const Map< UInt, double > &Z_to_abundance, const Map< UInt, double > &Z_to_mass)
double | calculateMonoWeight_ (const Map< UInt, double > &Z_to_mass)
void | readFromFile_ (const String &file_name)
void | storeElement_ (const UInt an, const String &name, const String &symbol, const Map< UInt, double > &Z_to_abundancy, const Map< UInt, double > &Z_to_mass)
| store element after parsing it More...
void | clear_ ()

## Protected Attributes

Map< String, const Element * > | names_
Map< String, const Element * > | symbols_
Map< UInt, const Element * > | atomic_numbers_

## Private Member Functions

| ElementDB ()
| ~ElementDB ()
| ElementDB (const ElementDB &db)=delete
| ElementDB (const ElementDB &&db)=delete
ElementDB & | operator= (const ElementDB &db)=delete

## Accessors

static const ElementDB * | getInstance ()
const Map< String, const Element * > & | getNames () const
| returns a hashmap that contains names mapped to pointers to the elements More...
const Map< String, const Element * > & | getSymbols () const
| returns a hashmap that contains symbols mapped to pointers to the elements More...
const Map< UInt, const Element * > & | getAtomicNumbers () const
| returns a hashmap that contains atomic numbers mapped to pointers of the elements More...
const Element * | getElement (const String &name) const
const Element * | getElement (UInt atomic_number) const
| returns a pointer to the element of atomic number; if no element is found 0 is returned More...

## Detailed Description

Stores elements.

The elements weights (in the default file) are taken from "Isotopic Compositions of the Elements 1997", Pure Appl. Chem., 70(1), 217-235, 1998. (http://www.iupac.org/reports/1998/7001rosman/)

The isotope distributions (in the default file) are taken from "Atomic weights of the elements. Review 2000" (IUPAC Technical Report) Pure Appl. Chem., 2003, Vol. 75, No. 6, pp. 683-799 doi:10.1351/pac200375060683

This singleton stores all elements. The elements are taken from the publications given above and are stored in share/OpenMS/CHEMISTRY/Elements.xml.

Specific isotopes of elements can be accessed by writing the atomic number of the isotope in brackets followed by the element name, e.g. "(2)H" for deuterium.

Improvement:

  include exact mass values for the isotopes (done) and update IsotopeDistribution (Andreas)

  add exact isotope distribution based on exact isotope values (Andreas)

## Constructor & Destructor Documentation

## ◆ ElementDB() [1/3]

ElementDB | ( |  | ) |

private

## ◆ ~ElementDB()

~ElementDB | ( |  | ) |

private

## ◆ ElementDB() [2/3]

ElementDB | ( | const ElementDB & | db | ) |

private delete

## ◆ ElementDB() [3/3]

ElementDB | ( | const ElementDB && | db | ) |

private delete

## Member Function Documentation

## ◆ calculateAvgWeight_()

double calculateAvgWeight_ | ( | const Map< UInt, double > & | Z_to_abundance,
|  | const Map< UInt, double > & | Z_to_mass
| ) |  |

protected

## ◆ calculateMonoWeight_()

double calculateMonoWeight_ | ( | const Map< UInt, double > & | Z_to_mass | ) |

protected

## ◆ clear_()

void clear_ | ( |  | ) |

protected

## ◆ getAtomicNumbers()

const Map<UInt, const Element *>& getAtomicNumbers | ( |  | ) | const

returns a hashmap that contains atomic numbers mapped to pointers of the elements

## ◆ getElement() [1/2]

const Element* getElement | ( | const String & | name | ) | const

returns a pointer to the element with name or symbol given in parameter name; if no element exists with that name or symbol 0 is returned

Parameters

  name | name or symbol of the element

Referenced by MetaProSIPDecomposition::calculateIsotopePatternsFor13CRange(), MetaProSIPDecomposition::calculateIsotopePatternsFor13CRangeOfAveraginePeptide(), MetaProSIPDecomposition::calculateIsotopePatternsFor15NRange(), MetaProSIPDecomposition::calculateIsotopePatternsFor15NRangeOfAveraginePeptide(), MetaProSIPDecomposition::calculateIsotopePatternsFor18ORange(), MetaProSIPDecomposition::calculateIsotopePatternsFor18ORangeOfAveraginePeptide(), MetaProSIPDecomposition::calculateIsotopePatternsFor2HRange(), MetaProSIPDecomposition::calculateIsotopePatternsFor2HRangeOfAveraginePeptide(), and MetaProSIPDecomposition::getNumberOfLabelingElements().

## ◆ getElement() [2/2]

const Element* getElement | ( | UInt | atomic_number | ) | const

returns a pointer to the element of atomic number; if no element is found 0 is returned

## ◆ getInstance()

static const ElementDB* getInstance | ( |  | ) |

static

returns a pointer to the singleton instance of the element db Upon first call, the Elements.xml file is parsed This is thread safe upon first and subsequent calls.

Referenced by MetaProSIPDecomposition::calculateIsotopePatternsFor13CRange(), MetaProSIPDecomposition::calculateIsotopePatternsFor13CRangeOfAveraginePeptide(), MetaProSIPDecomposition::calculateIsotopePatternsFor15NRange(), MetaProSIPDecomposition::calculateIsotopePatternsFor15NRangeOfAveraginePeptide(), MetaProSIPDecomposition::calculateIsotopePatternsFor18ORange(), MetaProSIPDecomposition::calculateIsotopePatternsFor18ORangeOfAveraginePeptide(), MetaProSIPDecomposition::calculateIsotopePatternsFor2HRange(), MetaProSIPDecomposition::calculateIsotopePatternsFor2HRangeOfAveraginePeptide(), and MetaProSIPDecomposition::getNumberOfLabelingElements().

## ◆ getNames()

const Map<String, const Element *>& getNames | ( |  | ) | const

returns a hashmap that contains names mapped to pointers to the elements

## ◆ getSymbols()

const Map<String, const Element *>& getSymbols | ( |  | ) | const

returns a hashmap that contains symbols mapped to pointers to the elements

## ◆ hasElement() [1/2]

bool hasElement | ( | const String & | name | ) | const

returns true if the db contains an element with the given name

## ◆ hasElement() [2/2]

bool hasElement | ( | UInt | atomic_number | ) | const

returns true if the db contains an element with the given atomic_number

## ◆ operator=()

ElementDB& operator= | ( | const ElementDB & | db | ) |

private delete

## ◆ parseIsotopeDistribution_()

IsotopeDistribution parseIsotopeDistribution_ | ( | const Map< UInt, double > & | Z_to_abundance,
|  | const Map< UInt, double > & | Z_to_mass
| ) |  |

protected

## ◆ readFromFile_()

void readFromFile_ | ( | const String & | file_name | ) |

protected

## ◆ storeElement_()

void storeElement_ | ( | const UInt | an,
|  | const String & | name,
|  | const String & | symbol,
|  | const Map< UInt, double > & | Z_to_abundancy,
|  | const Map< UInt, double > & | Z_to_mass
| ) |  |

protected

store element after parsing it

## Member Data Documentation

## ◆ atomic_numbers_

Map<UInt, const Element *> atomic_numbers_

protected

## ◆ names_

Map<String, const Element *> names_

protected

## ◆ symbols_

Map<String, const Element *> symbols_

protected