![]() |
OpenMS
|
Holds an indexed list of bio-chemical elements used by mass-decomposition algorithms. More...
#include <OpenMS/CHEMISTRY/MASSDECOMPOSITION/IMS/IMSAlphabet.h>
Classes | |
| class | MassSortingCriteria_ |
| Private class-functor to sort out elements in mass ascending order. More... | |
Public Types | |
| typedef IMSElement | element_type |
| typedef element_type::mass_type | mass_type |
| typedef element_type::name_type | name_type |
| typedef std::vector< element_type > | container |
| typedef container::size_type | size_type |
| typedef container::iterator | iterator |
| typedef container::const_iterator | const_iterator |
| typedef std::vector< name_type > | name_container |
| typedef name_container::iterator | name_iterator |
| typedef name_container::const_iterator | const_name_iterator |
| typedef std::vector< mass_type > | mass_container |
| typedef mass_container::iterator | mass_iterator |
| typedef mass_container::const_iterator | const_mass_iterator |
| typedef std::vector< mass_type > | masses_type |
Public Member Functions | |
| IMSAlphabet () | |
| IMSAlphabet (const container &elements) | |
| IMSAlphabet (const IMSAlphabet &alphabet) | |
| size_type | size () const |
| const element_type & | getElement (size_type index) const |
| void | setElement (const name_type &name, mass_type mass, bool forced=false) |
| bool | erase (const name_type &name) |
. If there is | ||||||
Gets the element with the symbol no such element, throws
| ||||||
| container | elements_ | |||||
| const element_type & | getElement (const name_type &name) const | |||||
| const name_type & | getName (size_type index) const | |||||
| mass_type | getMass (const name_type &name) const | |||||
| mass_type | getMass (size_type index) const | |||||
| masses_type | getMasses (size_type isotope_index=0) const | |||||
| masses_type | getAverageMasses () const | |||||
| bool | hasName (const name_type &name) const | |||||
| void | push_back (const name_type &name, mass_type value) | |||||
| void | push_back (const element_type &element) | |||||
| void | clear () | |||||
| virtual void | sortByNames () | |||||
| virtual void | sortByValues () | |||||
| virtual void | load (const std::string &fname) | |||||
| virtual void | load (const std::string &fname, IMSAlphabetParser<> &parser) | |||||
| virtual | ~IMSAlphabet () | |||||
Holds an indexed list of bio-chemical elements used by mass-decomposition algorithms.
Stores IMSElement instances and exposes them in two complementary ways: lookup by index is constant-time, lookup by element name is linear-time. Because IMSAlphabet keeps the full element representation, prefer the lighter ims::Weights when only the mass values are needed in performance-critical code.
An alphabet can be sorted either by element name or by mass; the file loaders always leave the alphabet sorted by mass, so files do not need to be pre-sorted.
To populate an alphabet from a flat text file with the default format, call load(const std::string&). To support a different format, derive a parser from IMSAlphabetParser and pass it to the two-argument load() overload. Both overloads report a missing or unreadable file by throwing Exception::IOException.
| typedef container::const_iterator const_iterator |
| typedef mass_container::const_iterator const_mass_iterator |
| typedef name_container::const_iterator const_name_iterator |
| typedef std::vector<element_type> container |
| typedef IMSElement element_type |
| typedef container::iterator iterator |
| typedef std::vector<mass_type> mass_container |
| typedef mass_container::iterator mass_iterator |
| typedef element_type::mass_type mass_type |
| typedef std::vector<mass_type> masses_type |
| typedef std::vector<name_type> name_container |
| typedef name_container::iterator name_iterator |
| typedef element_type::name_type name_type |
| typedef container::size_type size_type |
|
inline |
Empty constructor.
|
inlineexplicit |
Constructor with elements.
| [in] | elements | Elements to be set |
|
inline |
Copy constructor.
| [in] | alphabet | Alphabet whose elements are copied. |
|
inlinevirtual |
Default destructor.
|
inline |
Clears the alphabet data.
| bool erase | ( | const name_type & | name | ) |
Removes the element with name name from the alphabet.
| [in] | name | The name of the element to be removed from the alphabet. |
true) or not (false). | masses_type getAverageMasses | ( | ) | const |
Gets average masses of elements.
| const element_type & getElement | ( | const name_type & | name | ) | const |
|
inline |
Gets the element with index index.
| [in] | index | of the element |
Gets mono isotopic mass of the element with the symbol name. If there is no such element, throws an Exception::InvalidValue.
| [in] | name | Symbol of the element. |
| Exception::InvalidValue. |
Gets mass of the element with an index index in alphabet.
| [in] | index | Index of the element. |
| masses_type getMasses | ( | size_type | isotope_index = 0 | ) | const |
Gets masses of elements isotopes given by isotope_index.
| [in] | isotope_index | Index of isotope |
Gets the symbol of the element with an index index in alphabet.
| [in] | index | of the element. |
| bool hasName | ( | const name_type & | name | ) | const |
Returns true if there is an element with symbol name in the alphabet, false - otherwise.
name, false - otherwise.
|
virtual |
Replaces the alphabet's contents with the elements read from the text file fname (default OpenMS alphabet text format), sorted by mass.
| [in] | fname | File to read. |
| Exception::IOException | if fname cannot be opened. |
|
virtual |
Replaces the alphabet's contents with the elements read from fname through parser, sorted by mass.
| [in] | fname | File to read. |
| [in,out] | parser | Parser used to read the file. |
| Exception::IOException | if fname cannot be opened by parser. |
|
inline |
Adds a new element element to the alphabet.
| [in] | element | The Element to be added. |
Adds a new element with name name and mass value to the alphabet.
| [in] | name | Name of the element to be added. |
| [in] | value | Mass of the element to be added. |
Overwrites an element in the alphabet with the name with a new element constructed from the given name name and mass mass. If the parameter forced is set to true, a new element will be appended to the alphabet in the case the alphabet contains no element with the name name.
| [in] | name | The name of the element that should be replaced in (or appended to) the alphabet. |
| [in] | mass | The new mass of the element in the alphabet. |
| [in] | forced | Indicates whether a new element should be created (if set to true) if there is no element with the name name or not (if set to false). |
|
inline |
Returns the alphabet size.
|
virtual |
Sorts the alphabet by names.
|
virtual |
Sorts the alphabet by mass values.
|
private |
Elements of the alphabet.