Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
ModificationsDB Class Reference

database which holds all residue modifications from UniMod More...

#include <OpenMS/CHEMISTRY/ModificationsDB.h>

Inheritance diagram for ModificationsDB:
CrossLinksDB

Public Member Functions

Size getNumberOfModifications () const
 Returns the number of modifications read from the unimod.xml file. More...
 
const ResidueModificationgetModification (Size index) const
 Returns the modification with the given index. More...
 
void searchModifications (std::set< const ResidueModification *> &mods, const String &mod_name, const String &residue="", ResidueModification::TermSpecificity term_spec=ResidueModification::NUMBER_OF_TERM_SPECIFICITY) const
 Collects all modifications which have the given name as synonym. More...
 
const ResidueModificationgetModification (const String &mod_name, const String &residue="", ResidueModification::TermSpecificity term_spec=ResidueModification::NUMBER_OF_TERM_SPECIFICITY) const
 Returns the modification with the given name. More...
 
bool has (String modification) const
 Returns true if the modification exists. More...
 
void addModification (ResidueModification *new_mod)
 Add a new modification to ModificationsDB. More...
 
Size findModificationIndex (const String &mod_name) const
 Returns the index of the modification in the mods_ vector; a unique name must be given. More...
 
void searchModificationsByDiffMonoMass (std::vector< String > &mods, double mass, double max_error, const String &residue="", ResidueModification::TermSpecificity term_spec=ResidueModification::NUMBER_OF_TERM_SPECIFICITY)
 Collects all modifications with matching delta mass. More...
 
const ResidueModificationgetBestModificationByMonoMass (double mass, double max_error, const String &residue="", ResidueModification::TermSpecificity term_spec=ResidueModification::NUMBER_OF_TERM_SPECIFICITY)
 Returns the best matching modification for the given mass and residue. More...
 
const ResidueModificationgetBestModificationByDiffMonoMass (double mass, double max_error, const String &residue="", ResidueModification::TermSpecificity term_spec=ResidueModification::NUMBER_OF_TERM_SPECIFICITY)
 Returns the best matching modification for the given delta mass and residue. More...
 
void readFromOBOFile (const String &filename)
 Adds modifications from a given file in OBO format. More...
 
void readFromUnimodXMLFile (const String &filename)
 Adds modifications from a given file in Unimod XML format. More...
 
void getAllSearchModifications (std::vector< String > &modifications) const
 Collects all modifications that can be used for identification searches. More...
 

Static Public Member Functions

static ModificationsDBgetInstance ()
 Returns a pointer to the modifications DB (singleton) More...
 

Protected Member Functions

bool residuesMatch_ (const String &residue, char origin) const
 Helper function to check if a residue matches the origin for a modification. More...
 

Protected Attributes

std::vector< ResidueModification * > mods_
 Stores the modifications. More...
 
Map< String, std::set< const ResidueModification * > > modification_names_
 Stores the mappings of (unique) names to the modifications. More...
 

Private Member Functions

Constructors and Destructors
 ModificationsDB ()
 Default constructor. More...
 
 ModificationsDB (const ModificationsDB &residue_db)
 Copy constructor. More...
 
virtual ~ModificationsDB ()
 Destructor. More...
 
Assignment
ModificationsDBoperator= (const ModificationsDB &aa)
 Assignment operator. More...
 

Friends

class CrossLinksDB
 

Detailed Description

database which holds all residue modifications from UniMod

This singleton class serves as a storage of the available modifications represented by UniMod (www.unimod.org). The modifications are identified by their name and possibly other IDs from UniMod or the PSI-MOD ontology. Modifications can have different specificities, e.g. they can occur only at the termini, anywhere or only at specific amino acids.

The modifications are defined in share/OpenMS/CHEMISTRY/unimod.xml and in share/OpenMS/CHEMISTRY/PSI-MOD.obo. The unimod file can be directly downloaded from unimod.org and replaced if the modifications change.

To add a new modification, not contained in UniMod, one should follow the way described at the unimod.org website and download the file then from unimod.org. The same can be done to add support for the modifications to search engines, e.g. Mascot.

Constructor & Destructor Documentation

◆ ModificationsDB() [1/2]

ModificationsDB ( )
private

Default constructor.

◆ ModificationsDB() [2/2]

ModificationsDB ( const ModificationsDB residue_db)
private

Copy constructor.

◆ ~ModificationsDB()

virtual ~ModificationsDB ( )
privatevirtual

Destructor.

Member Function Documentation

◆ addModification()

void addModification ( ResidueModification new_mod)

Add a new modification to ModificationsDB.

Exceptions
Exception::InvalidValueif modification already exists (based on its fullID)

Referenced by RNPxlSearch::getPrecursorToFragmentAdducts_().

◆ findModificationIndex()

Size findModificationIndex ( const String mod_name) const

Returns the index of the modification in the mods_ vector; a unique name must be given.

Exceptions
Exception::ElementNotFoundif not exactly one matching modification was found
Exception::InvalidValueif no matching residue or modification were found

◆ getAllSearchModifications()

void getAllSearchModifications ( std::vector< String > &  modifications) const

Collects all modifications that can be used for identification searches.

Referenced by SimpleSearchEngine::registerOptionsAndFlags_(), and RNPxlSearch::registerOptionsAndFlags_().

◆ getBestModificationByDiffMonoMass()

const ResidueModification* getBestModificationByDiffMonoMass ( double  mass,
double  max_error,
const String residue = "",
ResidueModification::TermSpecificity  term_spec = ResidueModification::NUMBER_OF_TERM_SPECIFICITY 
)

Returns the best matching modification for the given delta mass and residue.

Query the modifications DB to get the best matching modification with the given delta mass at the given residue (NULL pointer means no result, maybe the maximal error tolerance needs to be increased). Possible input for CAM modification would be a delta mass of 57 and a residue of "C".

Note
If there are multiple possible matches with equal masses, it will choose the _first_ match which defaults to the first matching UniMod entry.
Parameters
residueThe residue at which the modifications occurs
massThe monoisotopic mass of the residue including the mass of the modification
max_errorThe maximal mass error in the modification search
Returns
A pointer to the best matching modification (or NULL if none was found)

◆ getBestModificationByMonoMass()

const ResidueModification* getBestModificationByMonoMass ( double  mass,
double  max_error,
const String residue = "",
ResidueModification::TermSpecificity  term_spec = ResidueModification::NUMBER_OF_TERM_SPECIFICITY 
)

Returns the best matching modification for the given mass and residue.

Query the modifications DB to get the best matching modification with the given mass at the given residue (NULL pointer means no result, maybe the maximal error tolerance needs to be increased). Possible input for CAM modification would be a mass of 160 and a residue of "C".

Note
If there are multiple possible matches with equal masses, it will choose the _first_ match which defaults to the first matching UniMod entry.
Parameters
residueThe residue at which the modifications occurs
massThe monoisotopic mass of the residue including the mass of the modification
max_errorThe maximal mass error in the modification search
Returns
A pointer to the best matching modification (or NULL if none was found)

◆ getInstance()

static ModificationsDB* getInstance ( )
inlinestatic

◆ getModification() [1/2]

const ResidueModification& getModification ( Size  index) const

Returns the modification with the given index.

Exceptions
Exception::IndexOverflowif the index is too large

Referenced by RNPxlSearch::getModifications_(), and RNPxlSearch::postScoreHits_().

◆ getModification() [2/2]

const ResidueModification& getModification ( const String mod_name,
const String residue = "",
ResidueModification::TermSpecificity  term_spec = ResidueModification::NUMBER_OF_TERM_SPECIFICITY 
) const

Returns the modification with the given name.

If residue is set, only modifications with matching residue of origin are considered. If term_spec is set, only modifications with matching term specificity are considered.

If more than one matching modification is found, the first one is returned with a warning.

Exceptions
Exception::ElementNotFoundif no modification named mod_name exists (via searchModifications())
Exception::InvalidValueif no matching modification exists

◆ getNumberOfModifications()

Size getNumberOfModifications ( ) const

Returns the number of modifications read from the unimod.xml file.

◆ has()

bool has ( String  modification) const

Returns true if the modification exists.

◆ operator=()

ModificationsDB& operator= ( const ModificationsDB aa)
private

Assignment operator.

◆ readFromOBOFile()

void readFromOBOFile ( const String filename)

Adds modifications from a given file in OBO format.

Exceptions
Exception::ParseErrorif the file cannot be parsed correctly

◆ readFromUnimodXMLFile()

void readFromUnimodXMLFile ( const String filename)

Adds modifications from a given file in Unimod XML format.

◆ residuesMatch_()

bool residuesMatch_ ( const String residue,
char  origin 
) const
protected

Helper function to check if a residue matches the origin for a modification.

◆ searchModifications()

void searchModifications ( std::set< const ResidueModification *> &  mods,
const String mod_name,
const String residue = "",
ResidueModification::TermSpecificity  term_spec = ResidueModification::NUMBER_OF_TERM_SPECIFICITY 
) const

Collects all modifications which have the given name as synonym.

If residue is set, only modifications with matching residue of origin are considered. If term_spec is set, only modifications with matching term specificity are considered. The resulting set of modifications may be empty if no modification exists that fulfills the criteria.

Exceptions
Exception::ElementNotFoundif no modification named mod_name exists
Exception::InvalidValueif no residue named residue exists

◆ searchModificationsByDiffMonoMass()

void searchModificationsByDiffMonoMass ( std::vector< String > &  mods,
double  mass,
double  max_error,
const String residue = "",
ResidueModification::TermSpecificity  term_spec = ResidueModification::NUMBER_OF_TERM_SPECIFICITY 
)

Collects all modifications with matching delta mass.

If residue is set, only modifications with matching residue of origin are considered. If term_spec is set, only modifications with matching term specificity are considered.

Friends And Related Function Documentation

◆ CrossLinksDB

friend class CrossLinksDB
friend

Member Data Documentation

◆ modification_names_

Map<String, std::set<const ResidueModification*> > modification_names_
protected

Stores the mappings of (unique) names to the modifications.

◆ mods_

std::vector<ResidueModification*> mods_
protected

Stores the modifications.


OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:10 using doxygen 1.8.13