OpenMS  2.4.0
Residue.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-2018.
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 #include <OpenMS/CONCEPT/Types.h>
42 
43 #include <iosfwd>
44 #include <set>
45 #include <vector>
46 
47 namespace OpenMS
48 {
61  class OPENMS_DLLAPI Residue
62  {
63  friend class ResidueDB;
64 
65 public:
66 
80 
81  inline static const EmpiricalFormula& getInternalToFull()
82  {
83  static const EmpiricalFormula to_full = EmpiricalFormula("H2O");
84  return to_full;
85  }
86 
87  inline static const EmpiricalFormula& getInternalToNTerm()
88  {
89  static const EmpiricalFormula to_full = EmpiricalFormula("H");
90  return to_full;
91  }
92 
93  inline static const EmpiricalFormula& getInternalToCTerm()
94  {
95  static const EmpiricalFormula to_full = EmpiricalFormula("OH");
96  return to_full;
97  }
98 
99  inline static const EmpiricalFormula& getInternalToAIon()
100  {
101  // Mind the "-"
102  static const EmpiricalFormula to_full =
103  getInternalToNTerm() - EmpiricalFormula("CHO");
104  return to_full;
105  }
106 
107  inline static const EmpiricalFormula& getInternalToBIon()
108  {
109  // Mind the "-"
110  static const EmpiricalFormula to_full =
111  getInternalToNTerm() - EmpiricalFormula("H");
112  return to_full;
113  }
114 
115  inline static const EmpiricalFormula& getInternalToCIon()
116  {
117  static const EmpiricalFormula to_full =
118  getInternalToNTerm() + EmpiricalFormula("NH2");
119  return to_full;
120  }
121 
122  inline static const EmpiricalFormula& getInternalToXIon()
123  {
124  // Mind the "-"
125  static const EmpiricalFormula to_full =
126  getInternalToCTerm() + EmpiricalFormula("CO") - EmpiricalFormula("H");
127  return to_full;
128  }
129 
130  inline static const EmpiricalFormula& getInternalToYIon()
131  {
132  static const EmpiricalFormula to_full =
133  getInternalToCTerm() + EmpiricalFormula("H");
134  return to_full;
135  }
136 
137  inline static const EmpiricalFormula& getInternalToZIon()
138  {
139  // Mind the "-"
140  static const EmpiricalFormula to_full =
141  getInternalToCTerm() - EmpiricalFormula("NH2");
142  return to_full;
143  }
144 
146 
151  {
152  Full = 0,
169  SizeOfResidueType
170  };
172 
174  static String getResidueTypeName(const ResidueType res_type);
175 
176 
180  Residue();
182 
184  Residue(const Residue& residue);
185 
187  Residue(const String& name,
188  const String& three_letter_code,
189  const String& one_letter_code,
190  const EmpiricalFormula& formula);
191 
193  virtual ~Residue();
195 
199  Residue& operator=(const Residue& residue);
202 
206  void setName(const String& name);
208 
210  const String& getName() const;
211 
213  void setShortName(const String& short_name);
214 
216  const String& getShortName() const;
217 
219  void setSynonyms(const std::set<String>& synonyms);
220 
222  void addSynonym(const String& synonym);
223 
225  const std::set<String>& getSynonyms() const;
226 
228  void setThreeLetterCode(const String& three_letter_code);
229 
231  const String& getThreeLetterCode() const;
232 
234  void setOneLetterCode(const String& one_letter_code);
235 
237  const String& getOneLetterCode() const;
238 
240  void addLossFormula(const EmpiricalFormula&);
241 
243  void setLossFormulas(const std::vector<EmpiricalFormula>&);
244 
246  void addNTermLossFormula(const EmpiricalFormula&);
247 
249  void setNTermLossFormulas(const std::vector<EmpiricalFormula>&);
250 
252  const std::vector<EmpiricalFormula>& getLossFormulas() const;
253 
255  const std::vector<EmpiricalFormula>& getNTermLossFormulas() const;
256 
258  void setLossNames(const std::vector<String>& name);
259 
261  void setNTermLossNames(const std::vector<String>& name);
262 
264  void addLossName(const String& name);
265 
267  void addNTermLossName(const String& name);
268 
270  const std::vector<String>& getLossNames() const;
271 
273  const std::vector<String>& getNTermLossNames() const;
274 
276  void setFormula(const EmpiricalFormula& formula);
277 
279  EmpiricalFormula getFormula(ResidueType res_type = Full) const;
280 
282  void setAverageWeight(double weight);
283 
285  double getAverageWeight(ResidueType res_type = Full) const;
286 
288  void setMonoWeight(double weight);
289 
291  double getMonoWeight(ResidueType res_type = Full) const;
292 
294  const ResidueModification* getModification() const;
295 
297  void setModification(const String& name);
298 
300  const String& getModificationName() const;
301 
303  void setLowMassIons(const std::vector<EmpiricalFormula>& low_mass_ions);
304 
306  const std::vector<EmpiricalFormula>& getLowMassIons() const;
307 
309  void setResidueSets(const std::set<String>& residues_sets);
310 
312  void addResidueSet(const String& residue_sets);
313 
315  const std::set<String>& getResidueSets() const;
316 
318  double getPka() const;
319 
321  double getPkb() const;
322 
324  double getPkc() const;
325 
327  double getPiValue() const;
328 
330  void setPka(double value);
331 
333  void setPkb(double value);
334 
336  void setPkc(double value);
337 
339  double getSideChainBasicity() const;
340 
342  void setSideChainBasicity(double gb_sc);
343 
345  double getBackboneBasicityLeft() const;
346 
348  void setBackboneBasicityLeft(double gb_bb_l);
349 
351  double getBackboneBasicityRight() const;
352 
354  void setBackboneBasicityRight(double gb_bb_r);
356 
360  bool hasNeutralLoss() const;
362 
364  bool hasNTermNeutralLosses() const;
365 
367  bool operator==(const Residue& residue) const;
368 
370  bool operator!=(const Residue& residue) const;
371 
373  bool operator==(char one_letter_code) const;
374 
376  bool operator!=(char one_letter_code) const;
377 
379  bool isModified() const;
380 
382  bool isInResidueSet(const String& residue_set);
384 
386  friend OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const Residue& residue);
387 
388 protected:
389 
390  // basic
392 
394 
395  std::set<String> synonyms_;
396 
398 
400 
402 
404 
406 
407  double mono_weight_;
408 
409  // modification
411 
412  // loss
413  std::vector<String> loss_names_;
414 
415  std::vector<EmpiricalFormula> loss_formulas_;
416 
417  std::vector<String> NTerm_loss_names_;
418 
419  std::vector<EmpiricalFormula> NTerm_loss_formulas_;
420 
422 
424 
425  // low mass markers like immonium ions
426  std::vector<EmpiricalFormula> low_mass_ions_;
427 
428  // pka values
429  double pka_;
430 
431  // pkb values
432  double pkb_;
433 
434  // pkc values
435  double pkc_;
436 
437  double gb_sc_;
438 
439  double gb_bb_l_;
440 
441  double gb_bb_r_;
442 
443  // residue sets this amino acid is contained in
444  std::set<String> residue_sets_;
445 
447  void setModification_(const ResidueModification& mod);
448 
449  };
450 
451  OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const Residue& residue);
452 
453 }
454 
MS:1001229 N-terminus up to the C-alpha/carbonyl carbon bond.
Definition: Residue.h:156
MS:1001220 peptide bond up to the C-terminus.
Definition: Residue.h:160
std::vector< String > loss_names_
Definition: Residue.h:413
A more convenient string class.
Definition: String.h:57
std::vector< String > NTerm_loss_names_
Definition: Residue.h:417
double pkc_
Definition: Residue.h:435
static const EmpiricalFormula & getInternalToNTerm()
Definition: Residue.h:87
internal, without any termini
Definition: Residue.h:153
only N-terminus
Definition: Residue.h:154
double gb_bb_r_
Definition: Residue.h:441
static const EmpiricalFormula & getInternalToFull()
Definition: Residue.h:81
Representation of a modification.
Definition: ResidueModification.h:76
only C-terminus
Definition: Residue.h:155
static const EmpiricalFormula & getInternalToAIon()
Definition: Residue.h:99
static const EmpiricalFormula & getInternalToBIon()
Definition: Residue.h:107
bool operator==(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:806
double pka_
Definition: Residue.h:429
static const EmpiricalFormula & getInternalToXIon()
Definition: Residue.h:122
double gb_sc_
Definition: Residue.h:437
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
MS:1001223 y ion without water.
Definition: Residue.h:164
Representation of a residue.
Definition: Residue.h:61
std::vector< EmpiricalFormula > loss_formulas_
Definition: Residue.h:415
double gb_bb_l_
Definition: Residue.h:439
double loss_mono_weight_
Definition: Residue.h:423
std::vector< EmpiricalFormula > low_mass_ions_
Definition: Residue.h:426
static const EmpiricalFormula & getInternalToCTerm()
Definition: Residue.h:93
Representation of an empirical formula.
Definition: EmpiricalFormula.h:81
static const EmpiricalFormula & getInternalToYIon()
Definition: Residue.h:130
MS:1001230 C-alpha/carbonyl carbon bond.
Definition: Residue.h:161
void setModification(int location, int max_size, String modification, OpenMS::AASequence &aas)
helper function that sets a modification on a AASequence object
const ResidueModification * modification_
Definition: Residue.h:410
static const EmpiricalFormula & getInternalToZIon()
Definition: Residue.h:137
MS:1001232 b ion without ammonia.
Definition: Residue.h:165
MS:1001233 y ion without ammonia.
Definition: Residue.h:166
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
double average_weight_
Definition: Residue.h:405
String short_name_
Definition: Residue.h:393
MS:1001228 amide/C-alpha bond up to the C-terminus.
Definition: Residue.h:159
no stored annotation
Definition: Residue.h:168
EmpiricalFormula internal_formula_
Definition: Residue.h:403
double mono_weight_
Definition: Residue.h:407
MS:1001523 Precursor ion.
Definition: Residue.h:162
String name_
Definition: Residue.h:391
String three_letter_code_
Definition: Residue.h:397
MS:1001222 b ion without water.
Definition: Residue.h:163
bool operator!=(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:824
residue data base which holds residues
Definition: ResidueDB.h:60
ResidueType
Definition: Residue.h:150
MS:1001240 Non-identified ion.
Definition: Residue.h:167
double pkb_
Definition: Residue.h:432
MS:1001224 N-terminus up to the peptide bond.
Definition: Residue.h:157
std::set< String > synonyms_
Definition: Residue.h:395
EmpiricalFormula formula_
Definition: Residue.h:401
double loss_average_weight_
Definition: Residue.h:421
std::set< String > residue_sets_
Definition: Residue.h:444
std::vector< EmpiricalFormula > NTerm_loss_formulas_
Definition: Residue.h:419
String one_letter_code_
Definition: Residue.h:399
MS:1001231 N-terminus up to the amide/C-alpha bond.
Definition: Residue.h:158
static const EmpiricalFormula & getInternalToCIon()
Definition: Residue.h:115