OpenMS  3.0.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-2022.
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, Jang Jang Jin$
33 // --------------------------------------------------------------------------
34 //
35 
36 #pragma once
37 
39 #include <OpenMS/CONCEPT/Types.h>
41 
42 #include <iosfwd>
43 #include <set>
44 #include <vector>
45 
46 namespace OpenMS
47 {
48  class ResidueModification;
49 
62  class OPENMS_DLLAPI Residue
63  {
64  friend class ResidueDB;
65 
66 public:
67 
81 
82  inline static const EmpiricalFormula& getInternalToFull()
83  {
84  static const EmpiricalFormula to_full = EmpiricalFormula("H2O");
85  return to_full;
86  }
87 
88  inline static const EmpiricalFormula& getInternalToNTerm()
89  {
90  static const EmpiricalFormula to_full = EmpiricalFormula("H");
91  return to_full;
92  }
93 
94  inline static const EmpiricalFormula& getInternalToCTerm()
95  {
96  static const EmpiricalFormula to_full = EmpiricalFormula("OH");
97  return to_full;
98  }
99 
100  inline static const EmpiricalFormula& getInternalToAIon()
101  {
102  // Mind the "-"
103  static const EmpiricalFormula to_full =
104  getInternalToNTerm() - EmpiricalFormula("CHO");
105  return to_full;
106  }
107 
108  inline static const EmpiricalFormula& getInternalToBIon()
109  {
110  // Mind the "-"
111  static const EmpiricalFormula to_full =
112  getInternalToNTerm() - EmpiricalFormula("H");
113  return to_full;
114  }
115 
116  inline static const EmpiricalFormula& getInternalToCIon()
117  {
118  static const EmpiricalFormula to_full =
119  getInternalToNTerm() + EmpiricalFormula("NH2");
120  return to_full;
121  }
122 
123  inline static const EmpiricalFormula& getInternalToXIon()
124  {
125  // Mind the "-"
126  static const EmpiricalFormula to_full =
127  getInternalToCTerm() + EmpiricalFormula("CO") - EmpiricalFormula("H");
128  return to_full;
129  }
130 
131  inline static const EmpiricalFormula& getInternalToYIon()
132  {
133  static const EmpiricalFormula to_full =
134  getInternalToCTerm() + EmpiricalFormula("H");
135  return to_full;
136  }
137 
138  inline static const EmpiricalFormula& getInternalToZIon()
139  {
140  // Mind the "-"
141  static const EmpiricalFormula to_full =
142  getInternalToCTerm() - EmpiricalFormula("NH2");
143  return to_full;
144  }
145 
147 
152  {
153  Full = 0,
170  SizeOfResidueType
171  };
173 
175  static String getResidueTypeName(const ResidueType res_type);
176 
180 
182  Residue();
183 
185  Residue(const Residue&) = default;
186 
188  Residue(Residue&&) = default;
189 
190  // Detailed constructor
191  Residue(const String& name,
192  const String& three_letter_code,
193  const String& one_letter_code,
194  const EmpiricalFormula& formula,
195  double pka = 0,
196  double pkb = 0,
197  double pkc = -1,
198  double gb_sc = 0,
199  double gb_bb_l = 0,
200  double gb_bb_r = 0,
201  const std::set<String>& synonyms = std::set<String>());
202 
204  virtual ~Residue();
206 
210 
212  Residue& operator=(const Residue&) = default;
213 
215  Residue& operator=(Residue&&) & = default;
217 
221  void setName(const String& name);
223 
225  const String& getName() const;
226 
228  void setSynonyms(const std::set<String>& synonyms);
229 
231  void addSynonym(const String& synonym);
232 
234  const std::set<String>& getSynonyms() const;
235 
237  void setThreeLetterCode(const String& three_letter_code);
238 
240  const String& getThreeLetterCode() const;
241 
243  void setOneLetterCode(const String& one_letter_code);
244 
246  const String& getOneLetterCode() const;
247 
249  void addLossFormula(const EmpiricalFormula&);
250 
252  void setLossFormulas(const std::vector<EmpiricalFormula>&);
253 
255  void addNTermLossFormula(const EmpiricalFormula&);
256 
258  void setNTermLossFormulas(const std::vector<EmpiricalFormula>&);
259 
261  const std::vector<EmpiricalFormula>& getLossFormulas() const;
262 
264  const std::vector<EmpiricalFormula>& getNTermLossFormulas() const;
265 
267  void setLossNames(const std::vector<String>& name);
268 
270  void setNTermLossNames(const std::vector<String>& name);
271 
273  void addLossName(const String& name);
274 
276  void addNTermLossName(const String& name);
277 
279  const std::vector<String>& getLossNames() const;
280 
282  const std::vector<String>& getNTermLossNames() const;
283 
285  void setFormula(const EmpiricalFormula& formula);
286 
288  EmpiricalFormula getFormula(ResidueType res_type = Full) const;
289 
291  void setAverageWeight(double weight);
292 
294  double getAverageWeight(ResidueType res_type = Full) const;
295 
297  void setMonoWeight(double weight);
298 
300  double getMonoWeight(ResidueType res_type = Full) const;
301 
303  const ResidueModification* getModification() const;
304 
306  void setModification(const String& name);
307 
309  void setModification(const ResidueModification* mod);
310 
313  void setModification(const ResidueModification& mod);
314 
317  void setModificationByDiffMonoMass(double diffMonoMass);
318 
320  const String& getModificationName() const;
321 
323  void setLowMassIons(const std::vector<EmpiricalFormula>& low_mass_ions);
324 
326  const std::vector<EmpiricalFormula>& getLowMassIons() const;
327 
329  void setResidueSets(const std::set<String>& residues_sets);
330 
332  void addResidueSet(const String& residue_sets);
333 
335  const std::set<String>& getResidueSets() const;
336 
338  double getPka() const;
339 
341  double getPkb() const;
342 
344  double getPkc() const;
345 
347  double getPiValue() const;
348 
350  void setPka(double value);
351 
353  void setPkb(double value);
354 
356  void setPkc(double value);
357 
359  double getSideChainBasicity() const;
360 
362  void setSideChainBasicity(double gb_sc);
363 
365  double getBackboneBasicityLeft() const;
366 
368  void setBackboneBasicityLeft(double gb_bb_l);
369 
371  double getBackboneBasicityRight() const;
372 
374  void setBackboneBasicityRight(double gb_bb_r);
376 
380  bool hasNeutralLoss() const;
382 
384  bool hasNTermNeutralLosses() const;
385 
387  bool operator==(const Residue& residue) const;
388 
390  bool operator!=(const Residue& residue) const;
391 
393  bool operator==(char one_letter_code) const;
394 
396  bool operator!=(char one_letter_code) const;
397 
399  bool isModified() const;
400 
402  bool isInResidueSet(const String& residue_set);
404 
406  static char residueTypeToIonLetter(const ResidueType& res_type);
407 
410  String toString() const;
411 
413  friend OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const Residue& residue);
414 
415 protected:
416 
419 
420  std::set<String> synonyms_;
421 
423 
425 
427 
429 
431 
432  double mono_weight_;
433 
436 
437  // loss
438  std::vector<String> loss_names_;
439 
440  std::vector<EmpiricalFormula> loss_formulas_;
441 
442  std::vector<String> NTerm_loss_names_;
443 
444  std::vector<EmpiricalFormula> NTerm_loss_formulas_;
445 
447 
449 
451  std::vector<EmpiricalFormula> low_mass_ions_;
452 
453  // pka values
454  double pka_;
455 
456  // pkb values
457  double pkb_;
458 
459  // pkc values
460  double pkc_;
461 
463  double gb_sc_;
464 
466  double gb_bb_l_;
467 
469  double gb_bb_r_;
470 
472  std::set<String> residue_sets_;
473 
474  // pre-calculated residue type delta weights for more efficient weight calculation
475  double internal_to_full_monoweight_ = getInternalToFull().getMonoWeight();
476  double internal_to_nterm_monoweight_ = getInternalToNTerm().getMonoWeight();
477  double internal_to_cterm_monoweight_ = getInternalToCTerm().getMonoWeight();
478  double internal_to_a_monoweight_ = getInternalToAIon().getMonoWeight();
479  double internal_to_b_monoweight_ = getInternalToBIon().getMonoWeight();
480  double internal_to_c_monoweight_ = getInternalToCIon().getMonoWeight();
481  double internal_to_x_monoweight_ = getInternalToXIon().getMonoWeight();
482  double internal_to_y_monoweight_ = getInternalToYIon().getMonoWeight();
483  double internal_to_z_monoweight_ = getInternalToZIon().getMonoWeight();
484  };
485 
486  // write 'name threelettercode onelettercode formula'
487  OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const Residue& residue);
488 
489 }
OpenMS::Residue::Unannotated
no stored annotation
Definition: Residue.h:169
OpenMS::ResidueDB
OpenMS stores a central database of all residues in the ResidueDB. All (unmodified) residues are adde...
Definition: ResidueDB.h:57
OpenMS::TOPPBase
Base class for TOPP applications.
Definition: TOPPBase.h:147
LinearResamplerAlign.h
OpenMS::Residue::gb_sc_
double gb_sc_
SideChainBasicity.
Definition: Residue.h:463
Size
OpenMS::toString
const std::string & toString(const DriftTimeUnit value)
OpenMS::Param::setValue
void setValue(const std::string &key, const ParamValue &value, const std::string &description="", const std::vector< std::string > &tags=std::vector< std::string >())
Sets a value.
OpenMS::Residue::BIon
MS:1001224 N-terminus up to the peptide bond.
Definition: Residue.h:158
OpenMS::ResidueModification
Representation of a modification on an amino acid residue.
Definition: ResidueModification.h:78
OpenMS::Residue::pka_
double pka_
Definition: Residue.h:454
OpenMS::DataProcessing::DATA_PROCESSING
General data processing (if no other term applies)
Definition: DataProcessing.h:60
OpenMS::Residue::loss_mono_weight_
double loss_mono_weight_
Definition: Residue.h:448
Types.h
OpenMS::Residue::loss_average_weight_
double loss_average_weight_
Definition: Residue.h:446
OpenMS::Residue::getInternalToCIon
static const EmpiricalFormula & getInternalToCIon()
Definition: Residue.h:116
OpenMS::MzMLFile::store
void store(const String &filename, const PeakMap &map) const
Stores a map in an MzML file.
OpenMS::Residue::ZIon
MS:1001230 C-alpha/carbonyl carbon bond.
Definition: Residue.h:162
OpenMS::MzMLFile
File adapter for MzML files.
Definition: MzMLFile.h:57
OpenMS::String
A more convenient string class.
Definition: String.h:58
KDTree::operator!=
bool operator!=(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:824
MzMLFile.h
OpenMS::MSExperiment
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:70
ResidueModification
sets the modification of AA at index by providing a pointer to a
OpenMS::Residue::getInternalToCTerm
static const EmpiricalFormula & getInternalToCTerm()
Definition: Residue.h:94
OpenMS::LinearResamplerAlign
Linear Resampling of raw data with alignment.
Definition: LinearResamplerAlign.h:57
OpenMS::Residue::CIon
MS:1001231 N-terminus up to the amide/C-alpha bond.
Definition: Residue.h:159
OpenMS::LinearResamplerAlign::raster_align
void raster_align(SpecT &container, double start_pos, double end_pos)
Applies the resampling algorithm to a container (MSSpectrum or MSChromatogram) with fixed coordinates...
Definition: LinearResamplerAlign.h:116
MultiGradient.h
OpenMS::Residue::modification_
const ResidueModification * modification_
pointer to the modification
Definition: Residue.h:435
OpenMS::Residue::AIon
MS:1001229 N-terminus up to the C-alpha/carbonyl carbon bond.
Definition: Residue.h:157
OpenMS::MSExperiment::clearMetaDataArrays
bool clearMetaDataArrays()
Clears the meta data arrays of all contained spectra (float, integer and string arrays)
OpenMS::MSExperiment::size
Size size() const
Definition: MSExperiment.h:120
OpenMS::Residue::NTerm_loss_names_
std::vector< String > NTerm_loss_names_
Definition: Residue.h:442
OpenMS::Residue::pkc_
double pkc_
Definition: Residue.h:460
OpenMS::Residue::internal_formula_
EmpiricalFormula internal_formula_
Definition: Residue.h:428
OpenMS::LinearResampler
Linear Resampling of raw data.
Definition: LinearResampler.h:61
OpenMS::Residue::Precursor
MS:1001523 Precursor ion.
Definition: Residue.h:163
OpenMS::Residue::getInternalToAIon
static const EmpiricalFormula & getInternalToAIon()
Definition: Residue.h:100
OpenMS::Residue::YIonMinusNH3
MS:1001233 y ion without ammonia.
Definition: Residue.h:167
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
OpenMS::Residue::Internal
internal, without any termini
Definition: Residue.h:154
OpenMS::Residue::gb_bb_r_
double gb_bb_r_
BackboneBasicityRight.
Definition: Residue.h:469
OpenMS::Residue::getInternalToBIon
static const EmpiricalFormula & getInternalToBIon()
Definition: Residue.h:108
OpenMS::Residue::getInternalToFull
static const EmpiricalFormula & getInternalToFull()
Definition: Residue.h:82
OpenMS::Residue
Representation of an amino acid residue.
Definition: Residue.h:62
OpenMS::MzMLFile::load
void load(const String &filename, PeakMap &map)
Loads a map from a MzML file. Spectra and chromatograms are sorted by default (this can be disabled u...
OpenMS::Residue::mono_weight_
double mono_weight_
Definition: Residue.h:432
OpenMS::Residue::gb_bb_l_
double gb_bb_l_
BackboneBasicityLeft.
Definition: Residue.h:466
OpenMS::Residue::NTerminal
only N-terminus
Definition: Residue.h:155
OpenMS::Residue::getInternalToXIon
static const EmpiricalFormula & getInternalToXIon()
Definition: Residue.h:123
OpenMS::Residue::NonIdentified
MS:1001240 Non-identified ion.
Definition: Residue.h:168
OpenMS::Residue::CTerminal
only C-terminus
Definition: Residue.h:156
OpenMS::Residue::pkb_
double pkb_
Definition: Residue.h:457
OpenMS::Residue::low_mass_ions_
std::vector< EmpiricalFormula > low_mass_ions_
low mass markers like immonium ions
Definition: Residue.h:451
OpenMS::Residue::synonyms_
std::set< String > synonyms_
Definition: Residue.h:420
OpenMS::Residue::getInternalToYIon
static const EmpiricalFormula & getInternalToYIon()
Definition: Residue.h:131
OpenMS::Residue::BIonMinusH20
MS:1001222 b ion without water.
Definition: Residue.h:164
OpenMS::MSSpectrum::clear
void clear(bool clear_meta_data)
Clears all data and meta data.
OpenMS::DefaultParamHandler::setParameters
void setParameters(const Param &param)
Sets the parameters.
OpenMS::Residue::loss_formulas_
std::vector< EmpiricalFormula > loss_formulas_
Definition: Residue.h:440
OpenMS::Residue::ResidueType
ResidueType
Definition: Residue.h:151
OpenMS::Residue::formula_
EmpiricalFormula formula_
Definition: Residue.h:426
OpenMS::operator<<
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
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
main
int main(int argc, const char **argv)
Definition: INIFileEditor.cpp:71
OpenMS::LinearResampler::raster
void raster(MSSpectrum &spectrum) const
Applies the resampling algorithm to an MSSpectrum.
Definition: LinearResampler.h:84
LinearResampler.h
OpenMS::Residue::NTerm_loss_formulas_
std::vector< EmpiricalFormula > NTerm_loss_formulas_
Definition: Residue.h:444
EmpiricalFormula.h
OpenMS::Residue::one_letter_code_
String one_letter_code_
Definition: Residue.h:424
OpenMS::Residue::average_weight_
double average_weight_
Definition: Residue.h:430
OpenMS::Internal::operator==
bool operator==(const IDBoostGraph::ProteinGroup &lhs, const IDBoostGraph::ProteinGroup &rhs)
OpenMS::EmpiricalFormula
Representation of an empirical formula.
Definition: EmpiricalFormula.h:84
OpenMS::Residue::getInternalToZIon
static const EmpiricalFormula & getInternalToZIon()
Definition: Residue.h:138
OpenMS::Residue::residue_sets_
std::set< String > residue_sets_
residue sets this amino acid is contained in
Definition: Residue.h:472
String.h
OpenMS::Param
Management and storage of parameters / INI files.
Definition: Param.h:69
OpenMS::Residue::BIonMinusNH3
MS:1001232 b ion without ammonia.
Definition: Residue.h:166
OpenMS::Residue::name_
String name_
the name of the residue
Definition: Residue.h:418
OpenMS::Residue::YIon
MS:1001220 peptide bond up to the C-terminus.
Definition: Residue.h:161
OpenMS::Residue::XIon
MS:1001228 amide/C-alpha bond up to the C-terminus.
Definition: Residue.h:160
OpenMS::MSSpectrum
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
OpenMS::Residue::loss_names_
std::vector< String > loss_names_
Definition: Residue.h:438
OpenMS::Residue::YIonMinusH20
MS:1001223 y ion without water.
Definition: Residue.h:165
OpenMS::Residue::getInternalToNTerm
static const EmpiricalFormula & getInternalToNTerm()
Definition: Residue.h:88
OpenMS::ProgressLogger::setLogType
void setLogType(LogType type) const
Sets the progress log that should be used. The default type is NONE!
TOPPBase.h
OpenMS::Residue::three_letter_code_
String three_letter_code_
Definition: Residue.h:422