| OpenMS 2.5.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-2020.
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
38 #include <OpenMS/CHEMISTRY/EmpiricalFormula.h>
39 #include <OpenMS/CHEMISTRY/ResidueModification.h>
40 #include <OpenMS/CONCEPT/Types.h>
41 #include <OpenMS/DATASTRUCTURES/String.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
150 enum ResidueType
151 {
152 Full = 0,
153 Internal,
154 NTerminal,
155 CTerminal,
156 AIon,
157 BIon,
158 CIon,
159 XIon,
160 YIon,
161 ZIon,
162 Precursor,
163 BIonMinusH20,
164 YIonMinusH20,
165 BIonMinusNH3,
166 YIonMinusNH3,
167 NonIdentified,
168 Unannotated,
169 SizeOfResidueType
170 };
172
174 static String getResidueTypeName(const ResidueType res_type);
175
176
180
182 Residue();
183
185 Residue(const Residue&) = default;
186
188 Residue(Residue&&) = default;
189
191 Residue(const String& name,
192 const String& three_letter_code,
193 const String& one_letter_code,
194 const EmpiricalFormula& formula);
195
197 virtual ~Residue();
199
203
205 Residue& operator=(const Residue&) = default;
206
208 Residue& operator=(Residue&&) & = default;
210
214 void setName(const String& name);
216
218 const String& getName() const;
219
221 void setShortName(const String& short_name);
222
224 const String& getShortName() const;
225
227 void setSynonyms(const std::set<String>& synonyms);
228
230 void addSynonym(const String& synonym);
231
233 const std::set<String>& getSynonyms() const;
234
236 void setThreeLetterCode(const String& three_letter_code);
237
239 const String& getThreeLetterCode() const;
240
242 void setOneLetterCode(const String& one_letter_code);
243
245 const String& getOneLetterCode() const;
246
248 void addLossFormula(const EmpiricalFormula&);
249
251 void setLossFormulas(const std::vector<EmpiricalFormula>&);
252
254 void addNTermLossFormula(const EmpiricalFormula&);
255
257 void setNTermLossFormulas(const std::vector<EmpiricalFormula>&);
258
260 const std::vector<EmpiricalFormula>& getLossFormulas() const;
261
263 const std::vector<EmpiricalFormula>& getNTermLossFormulas() const;
264
266 void setLossNames(const std::vector<String>& name);
267
269 void setNTermLossNames(const std::vector<String>& name);
270
272 void addLossName(const String& name);
273
275 void addNTermLossName(const String& name);
276
278 const std::vector<String>& getLossNames() const;
279
281 const std::vector<String>& getNTermLossNames() const;
282
284 void setFormula(const EmpiricalFormula& formula);
285
287 EmpiricalFormula getFormula(ResidueType res_type = Full) const;
288
290 void setAverageWeight(double weight);
291
293 double getAverageWeight(ResidueType res_type = Full) const;
294
296 void setMonoWeight(double weight);
297
299 double getMonoWeight(ResidueType res_type = Full) const;
300
302 const ResidueModification* getModification() const;
303
305 void setModification(const String& name);
306
308 const String& getModificationName() const;
309
311 void setLowMassIons(const std::vector<EmpiricalFormula>& low_mass_ions);
312
314 const std::vector<EmpiricalFormula>& getLowMassIons() const;
315
317 void setResidueSets(const std::set<String>& residues_sets);
318
320 void addResidueSet(const String& residue_sets);
321
323 const std::set<String>& getResidueSets() const;
324
326 double getPka() const;
327
329 double getPkb() const;
330
332 double getPkc() const;
333
335 double getPiValue() const;
336
338 void setPka(double value);
339
341 void setPkb(double value);
342
344 void setPkc(double value);
345
347 double getSideChainBasicity() const;
348
350 void setSideChainBasicity(double gb_sc);
351
353 double getBackboneBasicityLeft() const;
354
356 void setBackboneBasicityLeft(double gb_bb_l);
357
359 double getBackboneBasicityRight() const;
360
362 void setBackboneBasicityRight(double gb_bb_r);
364
368 bool hasNeutralLoss() const;
370
372 bool hasNTermNeutralLosses() const;
373
375 bool operator==(const Residue& residue) const;
376
378 bool operator!=(const Residue& residue) const;
379
381 bool operator==(char one_letter_code) const;
382
384 bool operator!=(char one_letter_code) const;
385
387 bool isModified() const;
388
390 bool isInResidueSet(const String& residue_set);
392
394 static char residueTypeToIonLetter(const ResidueType& res_type);
395
397 friend OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const Residue& residue);
398
399 protected:
400
401 // basic
402 String name_;
403
404 String short_name_;
405
406 std::set<String> synonyms_;
407
408 String three_letter_code_;
409
410 String one_letter_code_;
411
412 EmpiricalFormula formula_;
413
414 EmpiricalFormula internal_formula_;
415
416 double average_weight_;
417
418 double mono_weight_;
419
420 // modification
421 const ResidueModification* modification_;
422
423 // loss
424 std::vector<String> loss_names_;
425
426 std::vector<EmpiricalFormula> loss_formulas_;
427
428 std::vector<String> NTerm_loss_names_;
429
430 std::vector<EmpiricalFormula> NTerm_loss_formulas_;
431
432 double loss_average_weight_;
433
434 double loss_mono_weight_;
435
436 // low mass markers like immonium ions
437 std::vector<EmpiricalFormula> low_mass_ions_;
438
439 // pka values
440 double pka_;
441
442 // pkb values
443 double pkb_;
444
445 // pkc values
446 double pkc_;
447
448 double gb_sc_;
449
450 double gb_bb_l_;
451
452 double gb_bb_r_;
453
454 // residue sets this amino acid is contained in
455 std::set<String> residue_sets_;
456
457 // precalculated residue type delta weights for more efficient weight calculation
458 double internal_to_full_monoweight_ = getInternalToFull().getMonoWeight();
459 double internal_to_nterm_monoweight_ = getInternalToNTerm().getMonoWeight();
460 double internal_to_cterm_monoweight_ = getInternalToCTerm().getMonoWeight();
461 double internal_to_a_monoweight_ = getInternalToAIon().getMonoWeight();
462 double internal_to_b_monoweight_ = getInternalToBIon().getMonoWeight();
463 double internal_to_c_monoweight_ = getInternalToCIon().getMonoWeight();
464 double internal_to_x_monoweight_ = getInternalToXIon().getMonoWeight();
465 double internal_to_y_monoweight_ = getInternalToYIon().getMonoWeight();
466 double internal_to_z_monoweight_ = getInternalToZIon().getMonoWeight();
467
469 void setModification_(const ResidueModification& mod);
470
471 };
472
473 OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const Residue& residue);
474
475 }
OpenMS::Residue::AIon
MS:1001229 N-terminus up to the C-alpha/carbonyl carbon bond.
Definition: Residue.h:156
OpenMS::Residue::loss_average_weight_
double loss_average_weight_
Definition: Residue.h:432
OpenMS::Residue::Unannotated
no stored annotation
Definition: Residue.h:168
OpenMS::Residue::getInternalToZIon
static const EmpiricalFormula & getInternalToZIon()
Definition: Residue.h:137
OpenMS::Residue::BIonMinusNH3
MS:1001232 b ion without ammonia.
Definition: Residue.h:165
OpenMS::Residue::loss_names_
std::vector< String > loss_names_
Definition: Residue.h:424
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::Residue::getInternalToBIon
static const EmpiricalFormula & getInternalToBIon()
Definition: Residue.h:107
OpenMS::Residue::YIonMinusNH3
MS:1001233 y ion without ammonia.
Definition: Residue.h:166
OpenMS::Residue::three_letter_code_
String three_letter_code_
Definition: Residue.h:408
OpenMS::Residue::average_weight_
double average_weight_
Definition: Residue.h:416
OpenMS::Residue::pkc_
double pkc_
Definition: Residue.h:446
OpenMS::Residue::NTerm_loss_formulas_
std::vector< EmpiricalFormula > NTerm_loss_formulas_
Definition: Residue.h:430
OpenMS::Residue::loss_mono_weight_
double loss_mono_weight_
Definition: Residue.h:434
OpenMS::Residue
Representation of a residue.
Definition: Residue.h:61
OpenMS::Residue::modification_
const ResidueModification * modification_
Definition: Residue.h:421
OpenMS::Residue::getInternalToFull
static const EmpiricalFormula & getInternalToFull()
Definition: Residue.h:81
OpenMS::Residue::internal_formula_
EmpiricalFormula internal_formula_
Definition: Residue.h:414
KDTree::operator!=
bool operator!=(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:824
OpenMS::Residue::short_name_
String short_name_
Definition: Residue.h:404
OpenMS::ResidueModification
Representation of a modification.
Definition: ResidueModification.h:76
Types.h
OpenMS::Residue::mono_weight_
double mono_weight_
Definition: Residue.h:418
OpenMS::Residue::gb_sc_
double gb_sc_
Definition: Residue.h:448
OpenMS::Residue::Internal
internal, without any termini
Definition: Residue.h:153
OpenMS::Residue::getInternalToCTerm
static const EmpiricalFormula & getInternalToCTerm()
Definition: Residue.h:93
OpenMS::Residue::getInternalToXIon
static const EmpiricalFormula & getInternalToXIon()
Definition: Residue.h:122
OpenMS::Residue::XIon
MS:1001228 amide/C-alpha bond up to the C-terminus.
Definition: Residue.h:159
OpenMS::Residue::ZIon
MS:1001230 C-alpha/carbonyl carbon bond.
Definition: Residue.h:161
OpenMS::Residue::NonIdentified
MS:1001240 Non-identified ion.
Definition: Residue.h:167
OpenMS::Residue::pka_
double pka_
Definition: Residue.h:440
OpenMS::ResidueDB
residue data base which holds residues
Definition: ResidueDB.h:60
OpenMS::Residue::BIonMinusH20
MS:1001222 b ion without water.
Definition: Residue.h:163
OpenMS::Residue::residue_sets_
std::set< String > residue_sets_
Definition: Residue.h:455
String.h
OpenMS::operator<<
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::Residue::getInternalToAIon
static const EmpiricalFormula & getInternalToAIon()
Definition: Residue.h:99
OpenMS::Residue::synonyms_
std::set< String > synonyms_
Definition: Residue.h:406
OpenMS::Residue::getInternalToNTerm
static const EmpiricalFormula & getInternalToNTerm()
Definition: Residue.h:87
OpenMS::Residue::gb_bb_r_
double gb_bb_r_
Definition: Residue.h:452
OpenMS::Residue::getInternalToCIon
static const EmpiricalFormula & getInternalToCIon()
Definition: Residue.h:115
OpenMS::Residue::gb_bb_l_
double gb_bb_l_
Definition: Residue.h:450
OpenMS::Residue::formula_
EmpiricalFormula formula_
Definition: Residue.h:412
OpenMS::Residue::Precursor
MS:1001523 Precursor ion.
Definition: Residue.h:162
OpenMS::EmpiricalFormula
Representation of an empirical formula.
Definition: EmpiricalFormula.h:82
OpenMS::Residue::low_mass_ions_
std::vector< EmpiricalFormula > low_mass_ions_
Definition: Residue.h:437
OpenMS::Residue::NTerminal
only N-terminus
Definition: Residue.h:154
OpenMS::Residue::YIon
MS:1001220 peptide bond up to the C-terminus.
Definition: Residue.h:160
EmpiricalFormula.h
OpenMS::Residue::getInternalToYIon
static const EmpiricalFormula & getInternalToYIon()
Definition: Residue.h:130
OpenMS::Residue::pkb_
double pkb_
Definition: Residue.h:443
OpenMS::Residue::NTerm_loss_names_
std::vector< String > NTerm_loss_names_
Definition: Residue.h:428
OpenMS::Residue::loss_formulas_
std::vector< EmpiricalFormula > loss_formulas_
Definition: Residue.h:426
OpenMS::Residue::YIonMinusH20
MS:1001223 y ion without water.
Definition: Residue.h:164
OpenMS::Residue::name_
String name_
Definition: Residue.h:402
OpenMS::TargetedExperimentHelper::setModification
void setModification(int location, int max_size, String modification, OpenMS::AASequence &aas)
helper function that sets a modification on a AASequence object
OpenMS::Residue::CIon
MS:1001231 N-terminus up to the amide/C-alpha bond.
Definition: Residue.h:158
OpenMS::Residue::CTerminal
only C-terminus
Definition: Residue.h:155
OpenMS::Residue::BIon
MS:1001224 N-terminus up to the peptide bond.
Definition: Residue.h:157
OpenMS::Residue::ResidueType
ResidueType
Definition: Residue.h:150
OpenMS::Residue::one_letter_code_
String one_letter_code_
Definition: Residue.h:410
ResidueModification.h
KDTree::operator==
bool operator==(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:806