OpenMS
Loading...
Searching...
No Matches
ResidueModification Class Reference

Representation of a modification on an amino acid residue. More...

#include <OpenMS/CHEMISTRY/ResidueModification.h>

Collaboration diagram for ResidueModification:
[legend]

Public Types

enum  TermSpecificity {
  ANYWHERE = 0 , C_TERM = 1 , N_TERM = 2 , PROTEIN_C_TERM = 3 ,
  PROTEIN_N_TERM = 4 , NUMBER_OF_TERM_SPECIFICITY
}
 Position where the modification is allowed to occur. More...
 
enum  SourceClassification {
  ARTIFACT = 0 , HYPOTHETICAL , NATURAL , POSTTRANSLATIONAL ,
  MULTIPLE , CHEMICAL_DERIVATIVE , ISOTOPIC_LABEL , PRETRANSLATIONAL ,
  OTHER_GLYCOSYLATION , NLINKED_GLYCOSYLATION , AA_SUBSTITUTION , OTHER ,
  NONSTANDARD_RESIDUE , COTRANSLATIONAL , OLINKED_GLYCOSYLATION , UNKNOWN ,
  NUMBER_OF_SOURCE_CLASSIFICATIONS
}
 Classification of the modification. More...
 

Public Member Functions

Constructors and Destructors
 ResidueModification ()
 Default constructor.
 
 ResidueModification (const ResidueModification &)=default
 Copy constructor.
 
 ResidueModification (ResidueModification &&)=default
 Move constructor.
 
virtual ~ResidueModification ()
 Destructor.
 
Assignment operator
ResidueModificationoperator= (const ResidueModification &)=default
 Assignment operator.
 
ResidueModificationoperator= (ResidueModification &&) &=default
 Move assignment operator.
 
Accessors
void setId (const std::string &id)
 set the identifier of the modification
 
const std::string & getId () const
 returns the identifier of the modification
 
void setFullId (const std::string &full_id="")
 Sets the full identifier (Unimod Accession + origin, if available)
 
const std::string & getFullId () const
 returns the full identifier of the mod (Unimod accession + origin, if available)
 
void setUniModRecordId (const Int &id)
 sets the unimod record id
 
const IntgetUniModRecordId () const
 gets the unimod record id
 
const std::string getUniModAccession () const
 returns the unimod accession if available
 
void setPSIMODAccession (const std::string &id)
 set the MOD:XXXXX accession of PSI-MOD
 
const std::string & getPSIMODAccession () const
 returns the PSI-MOD accession if available
 
void setFullName (const std::string &full_name)
 sets the full name of the modification; must NOT contain the origin (or . for terminals!)
 
const std::string & getFullName () const
 returns the full name of the modification
 
void setName (const std::string &name)
 sets the name of modification
 
const std::string & getName () const
 returns the PSI-MS-label if available; e.g. Mascot uses this name
 
void setTermSpecificity (TermSpecificity term_spec)
 Sets the term specificity.
 
void setTermSpecificity (const std::string &name)
 Sets the terminal specificity using a name.
 
TermSpecificity getTermSpecificity () const
 returns terminal specificity
 
std::string getTermSpecificityName (TermSpecificity term_spec=NUMBER_OF_TERM_SPECIFICITY) const
 Returns the name of the terminal specificity.
 
void setOrigin (char origin)
 Sets the origin (i.e. modified amino acid)
 
char getOrigin () const
 Returns the origin (i.e. modified amino acid)
 
void setSourceClassification (const std::string &classification)
 classification as defined by the PSI-MOD
 
void setSourceClassification (SourceClassification classification)
 sets the source classification
 
SourceClassification getSourceClassification () const
 returns the source classification, if none was set, it is unspecific
 
std::string getSourceClassificationName (SourceClassification classification=NUMBER_OF_SOURCE_CLASSIFICATIONS) const
 returns the classification
 
void setAverageMass (double mass)
 sets the average mass
 
double getAverageMass () const
 returns the average mass if set
 
void setMonoMass (double mass)
 sets the monoisotopic mass (this must include the weight of the residue itself!)
 
double getMonoMass () const
 return the monoisotopic mass, or 0.0 if not set
 
void setDiffAverageMass (double mass)
 set the difference average mass
 
double getDiffAverageMass () const
 returns the difference average mass, or 0.0 if not set
 
void setDiffMonoMass (double mass)
 sets the difference monoisotopic mass
 
double getDiffMonoMass () const
 returns the diff monoisotopic mass, or 0.0 if not set
 
void setFormula (const std::string &composition)
 set the formula (no masses will be changed)
 
const std::string & getFormula () const
 returns the chemical formula if set
 
void setDiffFormula (const EmpiricalFormula &diff_formula)
 sets diff formula (no masses will be changed)
 
const EmpiricalFormulagetDiffFormula () const
 returns the diff formula if one was set
 
void setSynonyms (const std::set< std::string > &synonyms)
 sets the synonyms of that modification
 
void addSynonym (const std::string &synonym)
 adds a synonym to the unique list
 
const std::set< std::string > & getSynonyms () const
 returns the set of synonyms
 
void setNeutralLossDiffFormulas (const std::vector< EmpiricalFormula > &diff_formulas)
 sets the neutral loss formula
 
const std::vector< EmpiricalFormula > & getNeutralLossDiffFormulas () const
 returns the neutral loss diff formula (if available)
 
void setNeutralLossMonoMasses (std::vector< double > mono_masses)
 set the neutral loss mono weight
 
std::vector< double > getNeutralLossMonoMasses () const
 returns the neutral loss mono weight
 
void setNeutralLossAverageMasses (std::vector< double > average_masses)
 set the neutral loss average weight
 
std::vector< double > getNeutralLossAverageMasses () const
 returns the neutral loss average weight
 

Predicates

std::string id_
 
std::string full_id_
 
std::string psi_mod_accession_
 
Int unimod_record_id_
 
std::string full_name_
 
std::string name_
 
TermSpecificity term_spec_
 
char origin_
 
SourceClassification classification_
 
double average_mass_
 
double mono_mass_
 
double diff_average_mass_
 
double diff_mono_mass_
 
std::string formula_
 
EmpiricalFormula diff_formula_
 
std::set< std::string > synonyms_
 
std::vector< EmpiricalFormulaneutral_loss_diff_formulas_
 
std::vector< double > neutral_loss_mono_masses_
 
std::vector< double > neutral_loss_average_masses_
 
bool hasNeutralLoss () const
 returns true if a neutral loss formula is set
 
bool isUserDefined () const
 returns true if it is a user-defined modification (empty id)
 
bool operator== (const ResidueModification &modification) const
 equality operator
 
bool operator!= (const ResidueModification &modification) const
 inequality operator
 
bool operator< (const ResidueModification &modification) const
 less operator
 
std::string toString () const
 
static const ResidueModificationcreateUnknownFromMassString (const std::string &mod, const double mass, const bool delta_mass, const TermSpecificity specificity, const Residue *residue=nullptr)
 
static const ResidueModificationcombineMods (const ResidueModification *base, const std::set< const ResidueModification * > &addons, bool allow_unknown_masses=false, const Residue *residue=nullptr)
 Merge a set of mods to a given modification (usually the one which is already present, but can be null)
 
static std::string getDiffMonoMassString (const double diff_mono_mass)
 
static std::string getDiffMonoMassWithBracket (const double diff_mono_mass)
 return a string of the form '[+>mass<] (the '+' might be a '-', if mass is negative).
 
static std::string getMonoMassWithBracket (const double mono_mass)
 return a string of the form '[>mass<]
 

Detailed Description

Representation of a modification on an amino acid residue.

This class represents a modification of a Residue. A residue modification has several attributes like the diff formula, a terminal specificity, a mass and maybe an origin which means a specific residue which it can be applied to. A residue modification can be represented by its Unimod name identifier (Id), e.g. "Oxidation (M)" or "Oxidation". This is a unique key which only occurs once in an OpenMS instance stored in the ModificationsDB.

Example: methionine sulfoxide formation by oxidation of methionine

Function | Result
----------------------------------------------------
getFullId() | "Oxidation (M)"
getId() | "Oxidation"
getFullName() | "Oxidation or Hydroxylation"
getUniModAccession() | "UniMod:312"
const std::string getUniModAccession() const
returns the unimod accession if available
const std::string & getId() const
returns the identifier of the modification
const std::string & getFullName() const
returns the full name of the modification
const std::string & getFullId() const
returns the full identifier of the mod (Unimod accession + origin, if available)

Note that some modifications are not explicitly defined from an input file but get added on the fly when reading amino acid sequences with bracket notation, e.g. "PEPTX[999]IDE". If there is no known modification corresponding to the indicated mass, then a new ResidueModification will be created which will return the initial string through "getFullId()" – which will either be "[999]" for internal modifications or ".[999]" for N/C-terminal modifications. Please use "isUserDefined" to check for user-defined modifications (those without 'Id' but with a 'FullId').

Member Enumeration Documentation

◆ SourceClassification

Classification of the modification.

Enumerator
ARTIFACT 

A technical or chemical artefact.

HYPOTHETICAL 

A hypothetical modification.

NATURAL 

A natural modification.

POSTTRANSLATIONAL 

A post-translational modification.

MULTIPLE 

A combination of multiple modifications.

CHEMICAL_DERIVATIVE 

A chemical derivative.

ISOTOPIC_LABEL 

A chemical label (artificial)

PRETRANSLATIONAL 

A pre-translational modification.

OTHER_GLYCOSYLATION 

Other glycosylation (i.e. neither N nor O-linked)

NLINKED_GLYCOSYLATION 

N-linked glycosylation.

AA_SUBSTITUTION 

An amino acid substitution that presents like a modification.

OTHER 

Other modification.

NONSTANDARD_RESIDUE 

A non-standard amino acid.

COTRANSLATIONAL 

A co-translational modification.

OLINKED_GLYCOSYLATION 

A O-linked glycosylation.

UNKNOWN 

An unknown modification.

NUMBER_OF_SOURCE_CLASSIFICATIONS 

◆ TermSpecificity

Position where the modification is allowed to occur.

Enums

The allowed sites are
Anywhere
Any C-term
Any N-term
Protein C-term
Protein N-term

This does not describe which modifications are valid for a
specific amino acid!
Enumerator
ANYWHERE 

The modification can go anywhere.

C_TERM 

The modification can only be C-terminal on the peptide.

N_TERM 

The modification can only be N-terminal on the peptide.

PROTEIN_C_TERM 

The modification can only be protein C-terminal (on a C-terminal peptide)

PROTEIN_N_TERM 

The modification can only be protein N-terminal (on a N-terminal peptide)

NUMBER_OF_TERM_SPECIFICITY 

Constructor & Destructor Documentation

◆ ResidueModification() [1/3]

Default constructor.

◆ ResidueModification() [2/3]

Copy constructor.

◆ ResidueModification() [3/3]

Move constructor.

◆ ~ResidueModification()

virtual ~ResidueModification ( )
virtual

Destructor.

Member Function Documentation

◆ addSynonym()

void addSynonym ( const std::string &  synonym)

adds a synonym to the unique list

◆ combineMods()

static const ResidueModification * combineMods ( const ResidueModification base,
const std::set< const ResidueModification * > &  addons,
bool  allow_unknown_masses = false,
const Residue residue = nullptr 
)
static

Merge a set of mods to a given modification (usually the one which is already present, but can be null)

If only one mod is combined in total, it is not changed to an unknown mod but remains a 'known' mod. If base is already contained in addons, it is not added again.

All mods given here must have the same term specificity and origin (which might be 'X', i.e. no restriction), otherwise a Precondition exception is thrown.

If base and addons is empty, a null_ptr is returned.

Parameters
[in]baseAn already present mod, can be a nullptr
[in]addonsA set of mods to add on top of the mod.
[in]allow_unknown_massesIf any input (incl. base) is already an unknown mass, nothing is done
[in]residue[only required for ANYWHERE term spec] Residue with further information (e.g. residue weights) for the new mod
Returns
A (new custom) mod, which is registered in ModificationsDB if needed.
Exceptions
Exception::Preconditionif term spec or origins to not match between all given mods

◆ createUnknownFromMassString()

static const ResidueModification * createUnknownFromMassString ( const std::string &  mod,
const double  mass,
const bool  delta_mass,
const TermSpecificity  specificity,
const Residue residue = nullptr 
)
static

Creates a new modification from a mass and adds it to ModificationsDB. If not terminal, needs a Residue to be put on.

Parameters
[in]modThe mass to put between the brackets (might contain +/- at the front)
[in]massBasically, the same as mod, just as double (since usually both representations are present when calling this function and to avoid overhead??)
[in]delta_massIs the given mass a delta mass (i.e. does mod contain a = or -)?
[in]specificityTo which site can this mod be applied?
[in]residue[only required for ANYWHERE term spec] Residue with further information (e.g. residue weights) for the new mod
Returns
a new or existing mod; registered to ModDB in both cases, so the pointer is non-owning (FullId is e.g. M[+1234.1] and FullName [+1234.1]. Id and Name are empty as defined for a "user-defined" mod.

◆ getAverageMass()

double getAverageMass ( ) const

returns the average mass if set

◆ getDiffAverageMass()

double getDiffAverageMass ( ) const

returns the difference average mass, or 0.0 if not set

◆ getDiffFormula()

const EmpiricalFormula & getDiffFormula ( ) const

returns the diff formula if one was set

◆ getDiffMonoMass()

double getDiffMonoMass ( ) const

returns the diff monoisotopic mass, or 0.0 if not set

◆ getDiffMonoMassString()

static std::string getDiffMonoMassString ( const double  diff_mono_mass)
static

converts the mass to a string with preceding '+' or '-' sign e.g. '-19.34' or '+1.003'

◆ getDiffMonoMassWithBracket()

static std::string getDiffMonoMassWithBracket ( const double  diff_mono_mass)
static

return a string of the form '[+>mass<] (the '+' might be a '-', if mass is negative).

◆ getFormula()

const std::string & getFormula ( ) const

returns the chemical formula if set

◆ getFullId()

const std::string & getFullId ( ) const

returns the full identifier of the mod (Unimod accession + origin, if available)

Returns the full identifier (Unimod Accession + origin, if available)

Note
This field is used for user-defined modifications as well and will be set to a string such as "[999]" for internal modifications or ".[999]" for N/C-terminal modifications. Please use "isUserDefined" to check for user-defined modifications.

Referenced by hash< OpenMS::AASequence >::operator()().

◆ getFullName()

const std::string & getFullName ( ) const

returns the full name of the modification

◆ getId()

const std::string & getId ( ) const

returns the identifier of the modification

◆ getMonoMass()

double getMonoMass ( ) const

return the monoisotopic mass, or 0.0 if not set

◆ getMonoMassWithBracket()

static std::string getMonoMassWithBracket ( const double  mono_mass)
static

return a string of the form '[>mass<]

◆ getName()

const std::string & getName ( ) const

returns the PSI-MS-label if available; e.g. Mascot uses this name

◆ getNeutralLossAverageMasses()

std::vector< double > getNeutralLossAverageMasses ( ) const

returns the neutral loss average weight

◆ getNeutralLossDiffFormulas()

const std::vector< EmpiricalFormula > & getNeutralLossDiffFormulas ( ) const

returns the neutral loss diff formula (if available)

◆ getNeutralLossMonoMasses()

std::vector< double > getNeutralLossMonoMasses ( ) const

returns the neutral loss mono weight

◆ getOrigin()

char getOrigin ( ) const

Returns the origin (i.e. modified amino acid)

◆ getPSIMODAccession()

const std::string & getPSIMODAccession ( ) const

returns the PSI-MOD accession if available

◆ getSourceClassification()

SourceClassification getSourceClassification ( ) const

returns the source classification, if none was set, it is unspecific

◆ getSourceClassificationName()

std::string getSourceClassificationName ( SourceClassification  classification = NUMBER_OF_SOURCE_CLASSIFICATIONS) const

returns the classification

◆ getSynonyms()

const std::set< std::string > & getSynonyms ( ) const

returns the set of synonyms

◆ getTermSpecificity()

TermSpecificity getTermSpecificity ( ) const

returns terminal specificity

◆ getTermSpecificityName()

std::string getTermSpecificityName ( TermSpecificity  term_spec = NUMBER_OF_TERM_SPECIFICITY) const

Returns the name of the terminal specificity.

By default, returns the name of the specificity set in member term_spec_. Alternatively, returns the name corresponding to argument term_spec.

◆ getUniModAccession()

const std::string getUniModAccession ( ) const

returns the unimod accession if available

◆ getUniModRecordId()

const Int & getUniModRecordId ( ) const

gets the unimod record id

◆ hasNeutralLoss()

bool hasNeutralLoss ( ) const

returns true if a neutral loss formula is set

◆ isUserDefined()

bool isUserDefined ( ) const

returns true if it is a user-defined modification (empty id)

◆ operator!=()

bool operator!= ( const ResidueModification modification) const

inequality operator

◆ operator<()

bool operator< ( const ResidueModification modification) const

less operator

◆ operator=() [1/2]

ResidueModification & operator= ( const ResidueModification )
default

Assignment operator.

◆ operator=() [2/2]

ResidueModification & operator= ( ResidueModification &&  ) &
default

Move assignment operator.

◆ operator==()

bool operator== ( const ResidueModification modification) const

equality operator

◆ setAverageMass()

void setAverageMass ( double  mass)

sets the average mass

◆ setDiffAverageMass()

void setDiffAverageMass ( double  mass)

set the difference average mass

◆ setDiffFormula()

void setDiffFormula ( const EmpiricalFormula diff_formula)

sets diff formula (no masses will be changed)

◆ setDiffMonoMass()

void setDiffMonoMass ( double  mass)

sets the difference monoisotopic mass

◆ setFormula()

void setFormula ( const std::string &  composition)

set the formula (no masses will be changed)

◆ setFullId()

void setFullId ( const std::string &  full_id = "")

Sets the full identifier (Unimod Accession + origin, if available)

With empty argument, create a full ID based on (short) ID, terminal specificity and residue of origin.

Exceptions
Exception::MissingInformationif both argument full_id and member id_ are empty.

◆ setFullName()

void setFullName ( const std::string &  full_name)

sets the full name of the modification; must NOT contain the origin (or . for terminals!)

◆ setId()

void setId ( const std::string &  id)

set the identifier of the modification

◆ setMonoMass()

void setMonoMass ( double  mass)

sets the monoisotopic mass (this must include the weight of the residue itself!)

◆ setName()

void setName ( const std::string &  name)

sets the name of modification

◆ setNeutralLossAverageMasses()

void setNeutralLossAverageMasses ( std::vector< double >  average_masses)

set the neutral loss average weight

◆ setNeutralLossDiffFormulas()

void setNeutralLossDiffFormulas ( const std::vector< EmpiricalFormula > &  diff_formulas)

sets the neutral loss formula

◆ setNeutralLossMonoMasses()

void setNeutralLossMonoMasses ( std::vector< double >  mono_masses)

set the neutral loss mono weight

◆ setOrigin()

void setOrigin ( char  origin)

Sets the origin (i.e. modified amino acid)

origin must be a valid amino acid one-letter code or X, i.e. a letter from A to Y, excluding B and J. X represents any amino acid (for modifications with terminal specificity).

Exceptions
Exception::InvalidValueif origin is not in the valid range

◆ setPSIMODAccession()

void setPSIMODAccession ( const std::string &  id)

set the MOD:XXXXX accession of PSI-MOD

◆ setSourceClassification() [1/2]

void setSourceClassification ( const std::string &  classification)

classification as defined by the PSI-MOD

◆ setSourceClassification() [2/2]

void setSourceClassification ( SourceClassification  classification)

sets the source classification

◆ setSynonyms()

void setSynonyms ( const std::set< std::string > &  synonyms)

sets the synonyms of that modification

◆ setTermSpecificity() [1/2]

void setTermSpecificity ( const std::string &  name)

Sets the terminal specificity using a name.

Valid names: "C-term", "N-term", "none"

Exceptions
Exception::InvalidValueif no valid specificity was given

◆ setTermSpecificity() [2/2]

void setTermSpecificity ( TermSpecificity  term_spec)

Sets the term specificity.

Exceptions
Exception::InvalidValueif no valid specificity was given

◆ setUniModRecordId()

void setUniModRecordId ( const Int id)

sets the unimod record id

◆ toString()

std::string toString ( ) const

Convert to string (incl. origin/terminal), in order of preference:

  • using the ID, as X(ID), e.g. 'M(Oxidation)' or '.(Acetyl)'
  • using the FullName
  • using the delta_mono_mass, e.g. 'M[+15.65]'
  • using the mono_mass, e.g. 'M[56.23]'

The mono_mass must not be negative (undistinguishable to delta_mono_mass when parsing)

Member Data Documentation

◆ average_mass_

double average_mass_
protected

◆ classification_

SourceClassification classification_
protected

◆ diff_average_mass_

double diff_average_mass_
protected

◆ diff_formula_

EmpiricalFormula diff_formula_
protected

◆ diff_mono_mass_

double diff_mono_mass_
protected

◆ formula_

std::string formula_
protected

◆ full_id_

std::string full_id_
protected

◆ full_name_

std::string full_name_
protected

◆ id_

std::string id_
protected

◆ mono_mass_

double mono_mass_
protected

◆ name_

std::string name_
protected

◆ neutral_loss_average_masses_

std::vector<double> neutral_loss_average_masses_
protected

◆ neutral_loss_diff_formulas_

std::vector<EmpiricalFormula> neutral_loss_diff_formulas_
protected

◆ neutral_loss_mono_masses_

std::vector<double> neutral_loss_mono_masses_
protected

◆ origin_

char origin_
protected

◆ psi_mod_accession_

std::string psi_mod_accession_
protected

◆ synonyms_

std::set<std::string> synonyms_
protected

◆ term_spec_

TermSpecificity term_spec_
protected

◆ unimod_record_id_

Int unimod_record_id_
protected