OpenMS  2.7.0
ResidueModification.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2021.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Timo Sachsenberg $
32 // $Authors: Andreas Bertsch $
33 // --------------------------------------------------------------------------
34 //
35 
36 #pragma once
37 
40 
41 #include <set>
42 
43 namespace OpenMS
44 {
45  // forward declaration
46  class Residue;
47 
76  class OPENMS_DLLAPI ResidueModification
77  {
78 public:
79 
96  {
97  ANYWHERE = 0,
98  C_TERM = 1,
99  N_TERM = 2,
100  PROTEIN_C_TERM = 3,
101  PROTEIN_N_TERM = 4,
102  NUMBER_OF_TERM_SPECIFICITY
103  };
104 
108  {
109  ARTIFACT = 0,
125  NUMBER_OF_SOURCE_CLASSIFICATIONS
126  };
128 
132 
135 
138 
141 
145 
149 
152 
156 
161  void setId(const String& id);
162 
164  const String& getId() const;
165 
173  void setFullId(const String& full_id = "");
174 
176 
185  const String& getFullId() const;
186 
188  void setUniModRecordId(const Int& id);
189 
191  const Int& getUniModRecordId() const;
192 
194  const String getUniModAccession() const;
195 
197  void setPSIMODAccession(const String& id);
198 
200  const String& getPSIMODAccession() const;
201 
203  void setFullName(const String& full_name);
204 
206  const String& getFullName() const;
207 
209  void setName(const String& name);
210 
212  const String& getName() const;
213 
220 
228  void setTermSpecificity(const String& name);
229 
232 
239  String getTermSpecificityName(TermSpecificity term_spec = NUMBER_OF_TERM_SPECIFICITY) const;
240 
249  void setOrigin(char origin);
250 
252  char getOrigin() const;
253 
255  void setSourceClassification(const String& classification);
256 
259 
262 
264  String getSourceClassificationName(SourceClassification classification = NUMBER_OF_SOURCE_CLASSIFICATIONS) const;
265 
267  void setAverageMass(double mass);
268 
270  double getAverageMass() const;
271 
273  void setMonoMass(double mass);
274 
276  double getMonoMass() const;
277 
279  void setDiffAverageMass(double mass);
280 
282  double getDiffAverageMass() const;
283 
285  void setDiffMonoMass(double mass);
286 
288  double getDiffMonoMass() const;
289 
291  void setFormula(const String& composition);
292 
294  const String& getFormula() const;
295 
297  void setDiffFormula(const EmpiricalFormula& diff_formula);
298 
301 
303  void setSynonyms(const std::set<String>& synonyms);
304 
306  void addSynonym(const String& synonym);
307 
309  const std::set<String>& getSynonyms() const;
310 
312  void setNeutralLossDiffFormulas(const std::vector<EmpiricalFormula>& diff_formulas);
313 
315  const std::vector<EmpiricalFormula>& getNeutralLossDiffFormulas() const;
316 
318  void setNeutralLossMonoMasses(std::vector<double> mono_masses);
319 
321  std::vector<double> getNeutralLossMonoMasses() const;
322 
324  void setNeutralLossAverageMasses(std::vector<double> average_masses);
325 
327  std::vector<double> getNeutralLossAverageMasses() const;
329 
334  bool hasNeutralLoss() const;
335 
337  bool isUserDefined() const;
338 
340  bool operator==(const ResidueModification& modification) const;
341 
343  bool operator!=(const ResidueModification& modification) const;
344 
346  bool operator<(const ResidueModification& modification) const;
347 
349 
352 
360  const double mass,
361  const bool delta_mass,
362  const TermSpecificity specificity,
363  const Residue* residue = nullptr);
364 
382  const std::set<const ResidueModification*>& addons,
383  bool allow_unknown_masses = false,
384  const Residue* residue = nullptr);
385 
393  String toString() const;
394 
397  static String getDiffMonoMassString(const double diff_mono_mass);
398 
400  static String getDiffMonoMassWithBracket(const double diff_mono_mass);
401 
403  static String getMonoMassWithBracket(const double mono_mass);
404 
405 protected:
407 
409 
411 
412  // The UniMod record id (an integer)
414 
416 
418 
420 
421  char origin_;
422 
424 
426 
427  double mono_mass_;
428 
430 
432 
434 
436 
437  std::set<String> synonyms_;
438 
439  std::vector<EmpiricalFormula> neutral_loss_diff_formulas_;
440 
441  std::vector<double> neutral_loss_mono_masses_;
442 
443  std::vector<double> neutral_loss_average_masses_;
444  };
445 }
Representation of an empirical formula.
Definition: EmpiricalFormula.h:83
Representation of a modification.
Definition: ResidueModification.h:77
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:425
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:439
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:413
String name_
Definition: ResidueModification.h:417
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:433
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:443
std::vector< double > neutral_loss_mono_masses_
Definition: ResidueModification.h:441
double mono_mass_
Definition: ResidueModification.h:427
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:410
double diff_average_mass_
Definition: ResidueModification.h:429
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:96
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:419
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:415
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:108
@ NATURAL
Definition: ResidueModification.h:111
@ POSTTRANSLATIONAL
Definition: ResidueModification.h:112
@ COTRANSLATIONAL
Definition: ResidueModification.h:122
@ OTHER_GLYCOSYLATION
Definition: ResidueModification.h:117
@ NLINKED_GLYCOSYLATION
Definition: ResidueModification.h:118
@ UNKNOWN
Definition: ResidueModification.h:124
@ HYPOTHETICAL
Definition: ResidueModification.h:110
@ PRETRANSLATIONAL
Definition: ResidueModification.h:116
@ CHEMICAL_DERIVATIVE
Definition: ResidueModification.h:114
@ AA_SUBSTITUTION
Definition: ResidueModification.h:119
@ MULTIPLE
Definition: ResidueModification.h:113
@ ISOTOPIC_LABEL
Definition: ResidueModification.h:115
@ OLINKED_GLYCOSYLATION
Definition: ResidueModification.h:123
@ OTHER
Definition: ResidueModification.h:120
@ NONSTANDARD_RESIDUE
Definition: ResidueModification.h:121
TermSpecificity getTermSpecificity() const
returns terminal specificity
String full_id_
Definition: ResidueModification.h:408
SourceClassification classification_
Definition: ResidueModification.h:423
char origin_
Definition: ResidueModification.h:421
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:431
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:437
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:406
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:435
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 a residue.
Definition: Residue.h:63
A more convenient string class.
Definition: String.h:61
int Int
Signed integer type.
Definition: Types.h:102
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47