ProteoWizard
Unimod.hpp
Go to the documentation of this file.
1 //
2 // $Id: Unimod.hpp 3119 2011-11-11 23:04:08Z chambm $
3 //
4 //
5 // Original author: Matt Chambers <matt.chambers .@. vanderbilt.edu>
6 //
7 // Copyright 2011 Vanderbilt University - Nashville, TN 37232
8 //
9 // Licensed under the Apache License, Version 2.0 (the "License");
10 // you may not use this file except in compliance with the License.
11 // You may obtain a copy of the License at
12 //
13 // http://www.apache.org/licenses/LICENSE-2.0
14 //
15 // Unless required by applicable law or agreed to in writing, software
16 // distributed under the License is distributed on an "AS IS" BASIS,
17 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 // See the License for the specific language governing permissions and
19 // limitations under the License.
20 //
21 
22 
23 #ifndef _UNIMOD_HPP_
24 #define _UNIMOD_HPP_
25 
26 
30 #include "cv.hpp"
31 #include <boost/enum.hpp>
32 #include <boost/logic/tribool.hpp>
33 
34 
35 namespace pwiz {
36 namespace data {
37 namespace unimod {
38 
39 using namespace cv;
40 using namespace chemistry;
41 using namespace boost::logic;
42 
44  (Any)(1<<0)
45  (NTerminus)(1<<1)
46  (CTerminus)(1<<2)
47  (Alanine)(1<<3)
48  (Cysteine)(1<<4)
49  (AsparticAcid)(1<<5)
50  (GlutamicAcid)(1<<6)
51  (Phenylalanine)(1<<7)
52  (Glycine)(1<<8)
53  (Histidine)(1<<9)
54  (Isoleucine)(1<<10)
55  (Lysine)(1<<11)
56  (Leucine)(1<<12)
57  (Methionine)(1<<13)
58  (Asparagine)(1<<14)
59  (Proline)(1<<15)
60  (Glutamine)(1<<16)
61  (Arginine)(1<<17)
62  (Serine)(1<<18)
63  (Threonine)(1<<19)
64  (Selenocysteine)(1<<20)
65  (Valine)(1<<21)
66  (Tryptophan)(1<<22)
67  (Tyrosine)(1<<23)
68 )
69 BOOST_BITFIELD_DOMAIN_OPERATORS(Site)
70 
71 BOOST_ENUM_EX(Position, PWIZ_API_DECL,
72  (Anywhere)
73  (AnyNTerminus)
74  (AnyCTerminus)
76  (ProteinCTerminus)
77 )
78 BOOST_ENUM_DOMAIN_OPERATORS(Position)
79 
80 BOOST_BITFIELD_EX(Classification, PWIZ_API_DECL,
81  (Any)(1<<0)
82  (Artifact)(1<<1)
83  (ChemicalDerivative)(1<<2)
84  (CoTranslational)(1<<3)
85  (IsotopicLabel)(1<<4)
86  (Multiple)(1<<5)
87  (NLinkedGlycosylation)(1<<6)
88  (NonStandardResidue)(1<<7)
89  (OLinkedGlycosylation)(1<<8)
90  (OtherGlycosylation)(1<<9)
91  (Other)(1<<10)
92  (PostTranslational)(1<<11)
93  (PreTranslational)(1<<12)
94  (Substitution)(1<<13)
95 )
96 BOOST_BITFIELD_DOMAIN_OPERATORS(Classification)
97 
98 
99 /// a modification from Unimod
100 struct PWIZ_API_DECL Modification
101 {
102  struct PWIZ_API_DECL Specificity
103  {
104  Site site;
105  Position position;
106  bool hidden;
107  Classification classification;
108  };
109 
110  CVID cvid;
111  std::string name;
112  Formula deltaComposition;
113  double deltaMonoisotopicMass() const;
114  double deltaAverageMass() const;
115  bool approved;
116  std::vector<Specificity> specificities;
117 };
118 
119 
120 /// returns the Site given a one-letter residue code, or:
121 /// 'x' for Site::Any, 'n' for Site::NTerminus, 'c' for Site::CTerminus
122 PWIZ_API_DECL Site site(char symbol);
123 
124 
125 /// returns a Position corresponding to one of the following CVIDs:
126 /// CVID_Unknown: Position::Anywhere
127 /// MS_modification_specificity_N_term: Position::AnyNTerminus
128 /// MS_modification_specificity_C_term: Position::AnyCTerminus
129 /// Else: invalid_argument exception
130 PWIZ_API_DECL Position position(CVID cvid = CVID_Unknown);
131 
132 
133 /// the entire list of Unimod modifications
134 PWIZ_API_DECL const std::vector<Modification>& modifications();
135 
136 /// get a list of modifications by mass and tolerance;
137 /// - mass is treated as monoisotopic if monoisotopic=true; if indeterminate, both average and monoisotopic lookups are done
138 /// - if approved is not indeterminate, only approved/unapproved modifications are considered
139 /// - the site, position, and classification parameters filter the resulting modifications such that
140 /// every modification must have at least one specificity matching all three criteria;
141 /// - if hidden is not indeterminate, matching site/position/classification specificities must be hidden (or not)
142 PWIZ_API_DECL std::vector<Modification> modifications(double mass,
143  double tolerance,
144  tribool monoisotopic = true,
145  tribool approved = true,
146  Site site = Site::Any,
147  Position position = Position::Anywhere,
148  Classification classification = Classification::Any,
149  tribool hidden = indeterminate);
150 
151 /// find a modification by CVID
152 PWIZ_API_DECL const Modification& modification(CVID cvid);
153 
154 /// find a modification by title, e.g. "Phospho" not "Phosphorylation"
155 PWIZ_API_DECL const Modification& modification(const std::string& title);
156 
157 
158 } // namespace unimod
159 } // namespace data
160 } // namespace pwiz
161 
162 
163 #endif // _UNIMOD_HPP_