Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

Residue.h

Go to the documentation of this file.
00001 // --------------------------------------------------------------------------
00002 //                   OpenMS -- Open-Source Mass Spectrometry
00003 // --------------------------------------------------------------------------
00004 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
00005 // ETH Zurich, and Freie Universitaet Berlin 2002-2012.
00006 //
00007 // This software is released under a three-clause BSD license:
00008 //  * Redistributions of source code must retain the above copyright
00009 //    notice, this list of conditions and the following disclaimer.
00010 //  * Redistributions in binary form must reproduce the above copyright
00011 //    notice, this list of conditions and the following disclaimer in the
00012 //    documentation and/or other materials provided with the distribution.
00013 //  * Neither the name of any author or any participating institution
00014 //    may be used to endorse or promote products derived from this software
00015 //    without specific prior written permission.
00016 // For a full list of authors, refer to the file AUTHORS.
00017 // --------------------------------------------------------------------------
00018 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00019 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
00022 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00023 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00024 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00025 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00026 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00027 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00028 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 //
00030 // --------------------------------------------------------------------------
00031 // $Maintainer: Andreas Bertsch $
00032 // $Authors: Andreas Bertsch $
00033 // --------------------------------------------------------------------------
00034 //
00035 
00036 #ifndef OPENMS_CHEMISTRY_RESIDUE_H
00037 #define OPENMS_CHEMISTRY_RESIDUE_H
00038 
00039 #include <OpenMS/CHEMISTRY/EmpiricalFormula.h>
00040 #include <OpenMS/CONCEPT/Types.h>
00041 #include <OpenMS/DATASTRUCTURES/String.h>
00042 
00043 #include <iostream>
00044 #include <set>
00045 #include <vector>
00046 
00047 namespace OpenMS
00048 {
00049   // forward declarations
00050   class ResidueModification;
00051 
00064   class OPENMS_DLLAPI Residue
00065   {
00066 public:
00067 
00071     // Internal
00072     inline static const EmpiricalFormula & getInternalToFull()
00073     {
00074       static const EmpiricalFormula internal_to_full = EmpiricalFormula("H2O");
00075       return internal_to_full;
00076     }
00077 
00078     inline static DoubleReal getInternalToFullAverageWeight()
00079     {
00080       static const DoubleReal internal_to_full_average_weight = getInternalToFull().getAverageWeight();
00081       return internal_to_full_average_weight;
00082     }
00083 
00084     inline static DoubleReal getInternalToFullMonoWeight()
00085     {
00086       static const DoubleReal internal_to_full_mono_weight = getInternalToFull().getMonoWeight();
00087       return internal_to_full_mono_weight;
00088     }
00089 
00090     // N-terminal
00091     inline static const EmpiricalFormula & getNTerminalToFull()
00092     {
00093       static const EmpiricalFormula Nterminal_to_full = EmpiricalFormula("HO");
00094       return Nterminal_to_full;
00095     }
00096 
00097     inline static DoubleReal getNTerminalToFullAverageWeight()
00098     {
00099       static const DoubleReal Nterminal_to_full_average_weight = getNTerminalToFull().getAverageWeight();
00100       return Nterminal_to_full_average_weight;
00101     }
00102 
00103     inline static DoubleReal getNTerminalToFullMonoWeight()
00104     {
00105       static const DoubleReal Nterminal_to_full_mono_weight = getNTerminalToFull().getMonoWeight();
00106       return Nterminal_to_full_mono_weight;
00107     }
00108 
00109     // C-terminal
00110     inline static const EmpiricalFormula & getCTerminalToFull()
00111     {
00112       static const EmpiricalFormula Cterminal_to_full = EmpiricalFormula("H");
00113       return Cterminal_to_full;
00114     }
00115 
00116     inline static DoubleReal getCTerminalToFullAverageWeight()
00117     {
00118       static const DoubleReal Cterminal_to_full_average_weight = getCTerminalToFull().getAverageWeight();
00119       return Cterminal_to_full_average_weight;
00120     }
00121 
00122     inline static DoubleReal getCTerminalToFullMonoWeight()
00123     {
00124       static const DoubleReal Cterminal_to_full_mono_weight = getCTerminalToFull().getMonoWeight();
00125       return Cterminal_to_full_mono_weight;
00126     }
00127 
00128     // b ion
00129     inline static const EmpiricalFormula & getBIonToFull()
00130     {
00131       static const EmpiricalFormula b_ion_to_full = EmpiricalFormula("HO");
00132       return b_ion_to_full;
00133     }
00134 
00135     inline static DoubleReal getBIonToFullAverageWeight()
00136     {
00137       static const DoubleReal b_ion_to_full_average_weight = getBIonToFull().getAverageWeight();
00138       return b_ion_to_full_average_weight;
00139     }
00140 
00141     inline static DoubleReal getBIonToFullMonoWeight()
00142     {
00143       static const DoubleReal b_ion_to_full_mono_weight = getBIonToFull().getMonoWeight();
00144       return b_ion_to_full_mono_weight;
00145     }
00146 
00147     // a ion
00148     inline static const EmpiricalFormula & getAIonToFull()
00149     {
00150       static const EmpiricalFormula a_ion_to_full = EmpiricalFormula("HCO2");
00151       return a_ion_to_full;
00152     }
00153 
00154     inline static DoubleReal getAIonToFullAverageWeight()
00155     {
00156       static const DoubleReal a_ion_to_full_average_weight = getAIonToFull().getAverageWeight();
00157       return a_ion_to_full_average_weight;
00158     }
00159 
00160     inline static DoubleReal getAIonToFullMonoWeight()
00161     {
00162       static const DoubleReal a_ion_to_full_mono_weight = getAIonToFull().getMonoWeight();
00163       return a_ion_to_full_mono_weight;
00164     }
00165 
00166     // y ion
00167     inline static const EmpiricalFormula & getYIonToFull()
00168     {
00169       static const EmpiricalFormula y_ion_to_full = EmpiricalFormula("");
00170       return y_ion_to_full;
00171     }
00172 
00173     inline static DoubleReal getYIonToFullAverageWeight()
00174     {
00175       static const DoubleReal y_ion_to_full_average_weight = getYIonToFull().getAverageWeight();
00176       return y_ion_to_full_average_weight;
00177     }
00178 
00179     inline static DoubleReal getYIonToFullMonoWeight()
00180     {
00181       static const DoubleReal y_ion_to_full_mono_weight = getYIonToFull().getMonoWeight();
00182       return y_ion_to_full_mono_weight;
00183     }
00184 
00185     // c ion
00186     inline static const EmpiricalFormula & getCIonToFull()
00187     {
00188       static const EmpiricalFormula c_ion_to_full = EmpiricalFormula("H-1");
00189       return c_ion_to_full;
00190     }
00191 
00192     inline static DoubleReal getCIonToFullAverageWeight()
00193     {
00194       static const DoubleReal c_ion_to_full_average_weight = getCIonToFull().getAverageWeight();
00195       return c_ion_to_full_average_weight;
00196     }
00197 
00198     inline static DoubleReal getCIonToFullMonoWeight()
00199     {
00200       static const DoubleReal c_ion_to_full_mono_weight = getCIonToFull().getMonoWeight();
00201       return c_ion_to_full_mono_weight;
00202     }
00203 
00204     // c-1 ion
00205     inline static const EmpiricalFormula & getCIonMinusOneToFull()
00206     {
00207       static const EmpiricalFormula c_ion_to_full = EmpiricalFormula("H-2");
00208       return c_ion_to_full;
00209     }
00210 
00211     inline static DoubleReal getCIonMinusOneToFullAverageWeight()
00212     {
00213       static const DoubleReal c_ion_to_full_average_weight = getCIonMinusOneToFull().getAverageWeight();
00214       return c_ion_to_full_average_weight;
00215     }
00216 
00217     inline static DoubleReal getCIonMinusOneToFullMonoWeight()
00218     {
00219       static const DoubleReal c_ion_to_full_mono_weight = getCIonMinusOneToFull().getMonoWeight();
00220       return c_ion_to_full_mono_weight;
00221     }
00222 
00223     // c+1 ion
00224     inline static const EmpiricalFormula & getCIonPlusOneToFull()
00225     {
00226       static const EmpiricalFormula c_ion_to_full = EmpiricalFormula("");
00227       return c_ion_to_full;
00228     }
00229 
00230     inline static DoubleReal getCIonPlusOneToFullAverageWeight()
00231     {
00232       static const DoubleReal c_ion_to_full_average_weight = getCIonPlusOneToFull().getAverageWeight();
00233       return c_ion_to_full_average_weight;
00234     }
00235 
00236     inline static DoubleReal getCIonPlusOneToFullMonoWeight()
00237     {
00238       static const DoubleReal c_ion_to_full_mono_weight = getCIonPlusOneToFull().getMonoWeight();
00239       return c_ion_to_full_mono_weight;
00240     }
00241 
00242     // c+2 ion
00243     inline static const EmpiricalFormula & getCIonPlusTwoToFull()
00244     {
00245       static const EmpiricalFormula c_ion_to_full = EmpiricalFormula("H2");
00246       return c_ion_to_full;
00247     }
00248 
00249     inline static DoubleReal getCIonPlusTwoToFullAverageWeight()
00250     {
00251       static const DoubleReal c_ion_to_full_average_weight = getCIonPlusTwoToFull().getAverageWeight();
00252       return c_ion_to_full_average_weight;
00253     }
00254 
00255     inline static DoubleReal getCIonPlusTwoToFullMonoWeight()
00256     {
00257       static const DoubleReal c_ion_to_full_mono_weight = getCIonPlusTwoToFull().getMonoWeight();
00258       return c_ion_to_full_mono_weight;
00259     }
00260 
00261     // x ion
00262     inline static const EmpiricalFormula & getXIonToFull()
00263     {
00264       static const EmpiricalFormula x_ion_to_full = EmpiricalFormula("HCO");
00265       return x_ion_to_full;
00266     }
00267 
00268     inline static DoubleReal getXIonToFullAverageWeight()
00269     {
00270       static const DoubleReal x_ion_to_full_average_weight = getXIonToFull().getAverageWeight();
00271       return x_ion_to_full_average_weight;
00272     }
00273 
00274     inline static DoubleReal getXIonToFullMonoWeight()
00275     {
00276       static const DoubleReal x_ion_to_full_mono_weight = getXIonToFull().getMonoWeight();
00277       return x_ion_to_full_mono_weight;
00278     }
00279 
00280     // z ion
00281     inline static const EmpiricalFormula & getZIonToFull()
00282     {
00283       static const EmpiricalFormula z_ion_to_full = EmpiricalFormula("NH2");
00284       return z_ion_to_full;
00285     }
00286 
00287     inline static DoubleReal getZIonToFullAverageWeight()
00288     {
00289       static const DoubleReal z_ion_to_full_average_weight = getZIonToFull().getAverageWeight();
00290       return z_ion_to_full_average_weight;
00291     }
00292 
00293     inline static DoubleReal getZIonToFullMonoWeight()
00294     {
00295       static const DoubleReal z_ion_to_full_mono_weight = getZIonToFull().getMonoWeight();
00296       return z_ion_to_full_mono_weight;
00297     }
00298 
00299     // z-1 ion
00300     inline static const EmpiricalFormula & getZIonMinusOneToFull()
00301     {
00302       static const EmpiricalFormula z_ion_to_full = EmpiricalFormula("N2");
00303       return z_ion_to_full;
00304     }
00305 
00306     inline static DoubleReal getZIonMinusOneToFullAverageWeight()
00307     {
00308       static const DoubleReal z_ion_to_full_average_weight = getZIonMinusOneToFull().getAverageWeight();
00309       return z_ion_to_full_average_weight;
00310     }
00311 
00312     inline static DoubleReal getZIonMinusOneToFullMonoWeight()
00313     {
00314       static const DoubleReal z_ion_to_full_mono_weight = getZIonMinusOneToFull().getMonoWeight();
00315       return z_ion_to_full_mono_weight;
00316     }
00317 
00318     // z+1 ion
00319     inline static const EmpiricalFormula & getZIonPlusOneToFull()
00320     {
00321       static const EmpiricalFormula z_ion_to_full = EmpiricalFormula("NH3");
00322       return z_ion_to_full;
00323     }
00324 
00325     inline static DoubleReal getZIonPlusOneToFullAverageWeight()
00326     {
00327       static const DoubleReal z_ion_to_full_average_weight = getZIonPlusOneToFull().getAverageWeight();
00328       return z_ion_to_full_average_weight;
00329     }
00330 
00331     inline static DoubleReal getZIonPlusOneToFullMonoWeight()
00332     {
00333       static const DoubleReal z_ion_to_full_mono_weight = getZIonPlusOneToFull().getMonoWeight();
00334       return z_ion_to_full_mono_weight;
00335     }
00336 
00337     // z+2 ion
00338     inline static const EmpiricalFormula & getZIonPlusTwoToFull()
00339     {
00340       static const EmpiricalFormula z_ion_to_full = EmpiricalFormula("NH4");
00341       return z_ion_to_full;
00342     }
00343 
00344     inline static DoubleReal getZIonPlusTwoToFullAverageWeight()
00345     {
00346       static const DoubleReal z_ion_to_full_average_weight = getZIonPlusTwoToFull().getAverageWeight();
00347       return z_ion_to_full_average_weight;
00348     }
00349 
00350     inline static DoubleReal getZIonPlusTwoToFullMonoWeight()
00351     {
00352       static const DoubleReal z_ion_to_full_mono_weight = getZIonPlusTwoToFull().getMonoWeight();
00353       return z_ion_to_full_mono_weight;
00354     }
00355 
00357 
00361     enum ResidueType
00362     {
00363       Full = 0,           // with N-terminus and C-terminus
00364       Internal,           // internal, without any termini
00365       NTerminal,           // only N-terminus
00366       CTerminal,           // only C-terminus
00367       AIon,           // N-terminus up to the C-alpha/carbonyl carbon bond
00368       BIon,           // N-terminus up to the peptide bond
00369       CIonMinusOne,           // N-terminus up to the amide/C-alpha bond
00370       CIon,           // N-terminus up to the amide/C-alpha bond
00371       CIonPlusOne,           // N-terminus up to the amide/C-alpha bond
00372       CIonPlusTwo,           // N-terminus up to the amide/C-alpha bond
00373       XIon,           // amide/C-alpha bond up to the C-terminus
00374       YIon,           // peptide bond up to the C-terminus
00375       ZIonMinusOne,           // C-alpha/carbonyl carbon bond
00376       ZIon,            // C-alpha/carbonyl carbon bond
00377       ZIonPlusOne,            // C-alpha/carbonyl carbon bond
00378       ZIonPlusTwo,            // C-alpha/carbonyl carbon bond
00379       SizeOfResidueType
00380 
00382     };
00384 
00386     static String getResidueTypeName(const ResidueType res_type);
00387 
00388 
00392 
00393     Residue();
00394 
00396     Residue(const Residue & residue);
00397 
00399     Residue(const String & name,
00400             const String & three_letter_code,
00401             const String & one_letter_code,
00402             const EmpiricalFormula & formula);
00403 
00405     virtual ~Residue();
00407 
00411 
00412     Residue & operator=(const Residue & residue);
00414 
00418 
00419     void setName(const String & name);
00420 
00422     const String & getName() const;
00423 
00425     void setShortName(const String & short_name);
00426 
00428     const String & getShortName() const;
00429 
00431     void setSynonyms(const std::set<String> & synonyms);
00432 
00434     void addSynonym(const String & synonym);
00435 
00437     const std::set<String> & getSynonyms() const;
00438 
00440     void setThreeLetterCode(const String & three_letter_code);
00441 
00443     const String & getThreeLetterCode() const;
00444 
00446     void setOneLetterCode(const String & one_letter_code);
00447 
00449     const String & getOneLetterCode() const;
00450 
00452     void addLossFormula(const EmpiricalFormula &);
00453 
00455     void setLossFormulas(const std::vector<EmpiricalFormula> &);
00456 
00458     void addNTermLossFormula(const EmpiricalFormula &);
00459 
00461     void setNTermLossFormulas(const std::vector<EmpiricalFormula> &);
00462 
00464     const std::vector<EmpiricalFormula> & getLossFormulas() const;
00465 
00467     const std::vector<EmpiricalFormula> & getNTermLossFormulas() const;
00468 
00470     void setLossNames(const std::vector<String> & name);
00471 
00473     void setNTermLossNames(const std::vector<String> & name);
00474 
00476     void addLossName(const String & name);
00477 
00479     void addNTermLossName(const String & name);
00480 
00482     const std::vector<String> & getLossNames() const;
00483 
00485     const std::vector<String> & getNTermLossNames() const;
00486 
00488     void setFormula(const EmpiricalFormula & formula);
00489 
00491     EmpiricalFormula getFormula(ResidueType res_type = Full) const;
00492 
00494     void setAverageWeight(DoubleReal weight);
00495 
00497     DoubleReal getAverageWeight(ResidueType res_type = Full) const;
00498 
00500     void setMonoWeight(DoubleReal weight);
00501 
00503     DoubleReal getMonoWeight(ResidueType res_type = Full) const;
00504 
00506     void setModification(const String & name);
00507 
00509     const String & getModification() const;
00510 
00512     void setLowMassIons(const std::vector<EmpiricalFormula> & low_mass_ions);
00513 
00515     const std::vector<EmpiricalFormula> & getLowMassIons() const;
00516 
00518     void setResidueSets(const std::set<String> & residues_sets);
00519 
00521     void addResidueSet(const String & residue_sets);
00522 
00524     const std::set<String> & getResidueSets() const;
00526 
00530 
00531     bool hasNeutralLoss() const;
00532 
00534     bool hasNTermNeutralLosses() const;
00535 
00537     bool operator==(const Residue & residue) const;
00538 
00540     bool operator!=(const Residue & residue) const;
00541 
00543     bool operator==(char one_letter_code) const;
00544 
00546     bool operator!=(char one_letter_code) const;
00547 
00549     DoubleReal getPka() const;
00550 
00552     DoubleReal getPkb() const;
00553 
00555     DoubleReal getPkc() const;
00556 
00558     DoubleReal getPiValue() const;
00559 
00561     void setPka(DoubleReal value);
00562 
00564     void setPkb(DoubleReal value);
00565 
00567     void setPkc(DoubleReal value);
00568 
00570     DoubleReal getSideChainBasicity() const;
00571 
00573     void setSideChainBasicity(DoubleReal gb_sc);
00574 
00576     DoubleReal getBackboneBasicityLeft() const;
00577 
00579     void setBackboneBasicityLeft(DoubleReal gb_bb_l);
00580 
00582     DoubleReal getBackboneBasicityRight() const;
00583 
00585     void setBackboneBasicityRight(DoubleReal gb_bb_r);
00586 
00588     bool isModified() const;
00589 
00591     bool isInResidueSet(const String & residue_set);
00593 
00595     friend OPENMS_DLLAPI std::ostream & operator<<(std::ostream & os, const Residue & residue);
00596 
00597 protected:
00598 
00599     // basic
00600     String name_;
00601 
00602     String short_name_;
00603 
00604     std::set<String> synonyms_;
00605 
00606     String three_letter_code_;
00607 
00608     String one_letter_code_;
00609 
00610     EmpiricalFormula formula_;
00611 
00612     EmpiricalFormula internal_formula_;
00613 
00614     DoubleReal average_weight_;
00615 
00616     DoubleReal mono_weight_;
00617 
00618     // modification
00619     bool is_modified_;
00620 
00621     String pre_mod_name_;
00622 
00623     String modification_;
00624 
00625     // loss
00626     std::vector<String> loss_names_;
00627 
00628     std::vector<EmpiricalFormula> loss_formulas_;
00629 
00630     std::vector<String> NTerm_loss_names_;
00631 
00632     std::vector<EmpiricalFormula> NTerm_loss_formulas_;
00633 
00634     DoubleReal loss_average_weight_;
00635 
00636     DoubleReal loss_mono_weight_;
00637 
00638     // low mass markers like immonium ions
00639     std::vector<EmpiricalFormula> low_mass_ions_;
00640 
00641     // pka values
00642     DoubleReal pka_;
00643 
00644     // pkb values
00645     DoubleReal pkb_;
00646 
00647     // pkc values
00648     DoubleReal pkc_;
00649 
00650     DoubleReal gb_sc_;
00651 
00652     DoubleReal gb_bb_l_;
00653 
00654     DoubleReal gb_bb_r_;
00655 
00656     // residue sets this amino acid is contained in
00657     std::set<String> residue_sets_;
00658 
00659   };
00660 
00661   OPENMS_DLLAPI std::ostream & operator<<(std::ostream & os, const Residue & residue);
00662 
00663 }
00664 
00665 #endif

OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:44 using doxygen 1.7.1