OpenMS
ResidueModification.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: Andreas Bertsch $
7 // --------------------------------------------------------------------------
8 //
9 
10 #pragma once
11 
14 
15 #include <set>
16 
17 namespace OpenMS
18 {
19  // forward declaration
20  class Residue;
21 
52  class OPENMS_DLLAPI ResidueModification
53  {
54 public:
55 
72  {
73  ANYWHERE = 0,
74  C_TERM = 1,
75  N_TERM = 2,
76  PROTEIN_C_TERM = 3,
77  PROTEIN_N_TERM = 4,
78  NUMBER_OF_TERM_SPECIFICITY
79  };
80 
84  {
85  ARTIFACT = 0,
101  NUMBER_OF_SOURCE_CLASSIFICATIONS
102  };
104 
108 
111 
114 
117 
121 
125 
128 
132 
137  void setId(const String& id);
138 
140  const String& getId() const;
141 
149  void setFullId(const String& full_id = "");
150 
152 
161  const String& getFullId() const;
162 
164  void setUniModRecordId(const Int& id);
165 
167  const Int& getUniModRecordId() const;
168 
170  const String getUniModAccession() const;
171 
173  void setPSIMODAccession(const String& id);
174 
176  const String& getPSIMODAccession() const;
177 
179  void setFullName(const String& full_name);
180 
182  const String& getFullName() const;
183 
185  void setName(const String& name);
186 
188  const String& getName() const;
189 
196 
204  void setTermSpecificity(const String& name);
205 
208 
215  String getTermSpecificityName(TermSpecificity term_spec = NUMBER_OF_TERM_SPECIFICITY) const;
216 
225  void setOrigin(char origin);
226 
228  char getOrigin() const;
229 
231  void setSourceClassification(const String& classification);
232 
235 
238 
240  String getSourceClassificationName(SourceClassification classification = NUMBER_OF_SOURCE_CLASSIFICATIONS) const;
241 
243  void setAverageMass(double mass);
244 
246  double getAverageMass() const;
247 
249  void setMonoMass(double mass);
250 
252  double getMonoMass() const;
253 
255  void setDiffAverageMass(double mass);
256 
258  double getDiffAverageMass() const;
259 
261  void setDiffMonoMass(double mass);
262 
264  double getDiffMonoMass() const;
265 
267  void setFormula(const String& composition);
268 
270  const String& getFormula() const;
271 
273  void setDiffFormula(const EmpiricalFormula& diff_formula);
274 
277 
279  void setSynonyms(const std::set<String>& synonyms);
280 
282  void addSynonym(const String& synonym);
283 
285  const std::set<String>& getSynonyms() const;
286 
288  void setNeutralLossDiffFormulas(const std::vector<EmpiricalFormula>& diff_formulas);
289 
291  const std::vector<EmpiricalFormula>& getNeutralLossDiffFormulas() const;
292 
294  void setNeutralLossMonoMasses(std::vector<double> mono_masses);
295 
297  std::vector<double> getNeutralLossMonoMasses() const;
298 
300  void setNeutralLossAverageMasses(std::vector<double> average_masses);
301 
303  std::vector<double> getNeutralLossAverageMasses() const;
305 
310  bool hasNeutralLoss() const;
311 
313  bool isUserDefined() const;
314 
316  bool operator==(const ResidueModification& modification) const;
317 
319  bool operator!=(const ResidueModification& modification) const;
320 
322  bool operator<(const ResidueModification& modification) const;
323 
325 
328 
336  const double mass,
337  const bool delta_mass,
338  const TermSpecificity specificity,
339  const Residue* residue = nullptr);
340 
358  const std::set<const ResidueModification*>& addons,
359  bool allow_unknown_masses = false,
360  const Residue* residue = nullptr);
361 
369  String toString() const;
370 
373  static String getDiffMonoMassString(const double diff_mono_mass);
374 
376  static String getDiffMonoMassWithBracket(const double diff_mono_mass);
377 
379  static String getMonoMassWithBracket(const double mono_mass);
380 
381 protected:
383 
385 
387 
388  // The UniMod record id (an integer)
390 
392 
394 
396 
397  char origin_;
398 
400 
402 
403  double mono_mass_;
404 
406 
408 
410 
412 
413  std::set<String> synonyms_;
414 
415  std::vector<EmpiricalFormula> neutral_loss_diff_formulas_;
416 
417  std::vector<double> neutral_loss_mono_masses_;
418 
419  std::vector<double> neutral_loss_average_masses_;
420  };
421 }
Representation of an empirical formula.
Definition: EmpiricalFormula.h:59
Representation of a modification on an amino acid residue.
Definition: ResidueModification.h:53
std::vector< double > getNeutralLossAverageMasses() const
returns the neutral loss average weight
static String getDiffMonoMassString(const double diff_mono_mass)
double average_mass_
Definition: ResidueModification.h:401
void setDiffFormula(const EmpiricalFormula &diff_formula)
sets diff formula (no masses will be changed)
ResidueModification(ResidueModification &&)=default
Move constructor.
const String & getFullName() const
returns the full name of the modification
std::vector< EmpiricalFormula > neutral_loss_diff_formulas_
Definition: ResidueModification.h:415
static const ResidueModification * combineMods(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,...
SourceClassification getSourceClassification() const
returns the source classification, if none was set, it is unspecific
ResidueModification & operator=(const ResidueModification &)=default
Assignment operator.
bool hasNeutralLoss() const
returns true if a neutral loss formula is set
void setSourceClassification(SourceClassification classification)
sets the source classification
void setDiffAverageMass(double mass)
set the difference average mass
Int unimod_record_id_
Definition: ResidueModification.h:389
String name_
Definition: ResidueModification.h:393
static String getDiffMonoMassWithBracket(const double diff_mono_mass)
return a string of the form '[+>mass<] (the '+' might be a '-', if mass is negative).
String formula_
Definition: ResidueModification.h:409
const EmpiricalFormula & getDiffFormula() const
returns the diff formula if one was set
void setNeutralLossMonoMasses(std::vector< double > mono_masses)
set the neutral loss mono weight
const std::vector< EmpiricalFormula > & getNeutralLossDiffFormulas() const
returns the neutral loss diff formula (if available)
std::vector< double > neutral_loss_average_masses_
Definition: ResidueModification.h:419
std::vector< double > neutral_loss_mono_masses_
Definition: ResidueModification.h:417
double mono_mass_
Definition: ResidueModification.h:403
ResidueModification & operator=(ResidueModification &&) &=default
Move assignment operator.
void setPSIMODAccession(const String &id)
set the MOD:XXXXX accession of PSI-MOD
String psi_mod_accession_
Definition: ResidueModification.h:386
double diff_average_mass_
Definition: ResidueModification.h:405
void setSynonyms(const std::set< String > &synonyms)
sets the synonyms of that modification
TermSpecificity
Position where the modification is allowed to occur.
Definition: ResidueModification.h:72
static const ResidueModification * createUnknownFromMassString(const String &mod, const double mass, const bool delta_mass, const TermSpecificity specificity, const Residue *residue=nullptr)
const String & getId() const
returns the identifier of the modification
const String & getPSIMODAccession() const
returns the PSI-MOD accession if available
void setDiffMonoMass(double mass)
sets the difference monoisotopic mass
TermSpecificity term_spec_
Definition: ResidueModification.h:395
void setNeutralLossDiffFormulas(const std::vector< EmpiricalFormula > &diff_formulas)
sets the neutral loss formula
ResidueModification()
Default constructor.
bool operator<(const ResidueModification &modification) const
less operator
void setName(const String &name)
sets the name of modification
String full_name_
Definition: ResidueModification.h:391
void setAverageMass(double mass)
sets the average mass
ResidueModification(const ResidueModification &)=default
Copy constructor.
bool operator!=(const ResidueModification &modification) const
inequality operator
const std::set< String > & getSynonyms() const
returns the set of synonyms
double getDiffMonoMass() const
returns the diff monoisotopic mass, or 0.0 if not set
SourceClassification
Classification of the modification.
Definition: ResidueModification.h:84
@ NATURAL
A natural modification.
Definition: ResidueModification.h:87
@ POSTTRANSLATIONAL
A post-translational modification.
Definition: ResidueModification.h:88
@ COTRANSLATIONAL
A co-translational modification.
Definition: ResidueModification.h:98
@ OTHER_GLYCOSYLATION
Other glycosylation (i.e. neither N nor O-linked)
Definition: ResidueModification.h:93
@ NLINKED_GLYCOSYLATION
N-linked glycosylation.
Definition: ResidueModification.h:94
@ UNKNOWN
An unknown modification.
Definition: ResidueModification.h:100
@ HYPOTHETICAL
A hypothetical modification.
Definition: ResidueModification.h:86
@ PRETRANSLATIONAL
A pre-translational modification.
Definition: ResidueModification.h:92
@ CHEMICAL_DERIVATIVE
A chemical derivative.
Definition: ResidueModification.h:90
@ AA_SUBSTITUTION
An amino acid substitution that presents like a modification.
Definition: ResidueModification.h:95
@ MULTIPLE
A combination of multiple modifications.
Definition: ResidueModification.h:89
@ ISOTOPIC_LABEL
A chemical label (artificial)
Definition: ResidueModification.h:91
@ OLINKED_GLYCOSYLATION
A O-linked glycosylation.
Definition: ResidueModification.h:99
@ OTHER
Other modification.
Definition: ResidueModification.h:96
@ NONSTANDARD_RESIDUE
A non-standard amino acid.
Definition: ResidueModification.h:97
TermSpecificity getTermSpecificity() const
returns terminal specificity
String full_id_
Definition: ResidueModification.h:384
SourceClassification classification_
Definition: ResidueModification.h:399
char origin_
Definition: ResidueModification.h:397
void setTermSpecificity(const String &name)
Sets the terminal specificity using a name.
void setFullId(const String &full_id="")
Sets the full identifier (Unimod Accession + origin, if available)
double diff_mono_mass_
Definition: ResidueModification.h:407
void setUniModRecordId(const Int &id)
sets the unimod record id
static String getMonoMassWithBracket(const double mono_mass)
return a string of the form '[>mass<]
void setFormula(const String &composition)
set the formula (no masses will be changed)
bool isUserDefined() const
returns true if it is a user-defined modification (empty id)
const String & getName() const
returns the PSI-MS-label if available; e.g. Mascot uses this name
virtual ~ResidueModification()
Destructor.
char getOrigin() const
Returns the origin (i.e. modified amino acid)
std::set< String > synonyms_
Definition: ResidueModification.h:413
void setSourceClassification(const String &classification)
classification as defined by the PSI-MOD
const String getUniModAccession() const
returns the unimod accession if available
double getMonoMass() const
return the monoisotopic mass, or 0.0 if not set
const Int & getUniModRecordId() const
gets the unimod record id
const String & getFormula() const
returns the chemical formula if set
void setOrigin(char origin)
Sets the origin (i.e. modified amino acid)
bool operator==(const ResidueModification &modification) const
equality operator
String getTermSpecificityName(TermSpecificity term_spec=NUMBER_OF_TERM_SPECIFICITY) const
Returns the name of the terminal specificity.
double getAverageMass() const
returns the average mass if set
void addSynonym(const String &synonym)
adds a synonym to the unique list
void setFullName(const String &full_name)
sets the full name of the modification; must NOT contain the origin (or . for terminals!...
String id_
Definition: ResidueModification.h:382
void setTermSpecificity(TermSpecificity term_spec)
Sets the term specificity.
void setId(const String &id)
set the identifier of the modification
std::vector< double > getNeutralLossMonoMasses() const
returns the neutral loss mono weight
EmpiricalFormula diff_formula_
Definition: ResidueModification.h:411
String getSourceClassificationName(SourceClassification classification=NUMBER_OF_SOURCE_CLASSIFICATIONS) const
returns the classification
double getDiffAverageMass() const
returns the difference average mass, or 0.0 if not set
const String & getFullId() const
returns the full identifier of the mod (Unimod accession + origin, if available)
void setNeutralLossAverageMasses(std::vector< double > average_masses)
set the neutral loss average weight
void setMonoMass(double mass)
sets the monoisotopic mass (this must include the weight of the residue itself!)
Representation of an amino acid residue.
Definition: Residue.h:37
A more convenient string class.
Definition: String.h:34
int Int
Signed integer type.
Definition: Types.h:76
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22