| OpenMS 2.5.0

TransitionExperiment.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: Hannes Roest $
32 // $Authors: Hannes Roest $
33 // --------------------------------------------------------------------------
34
35 #pragma once
36
37 #include <string>
38 #include <vector>
39 #include <map>
40 #include <boost/shared_ptr.hpp>
41
42 #include <OpenMS/OPENSWATHALGO/OpenSwathAlgoConfig.h>
43
44 namespace OpenSwath
45 {
46 struct LightTransition
47 {
48 public:
49
50 LightTransition() :
51 fragment_charge(0)
52 {
53 }
54
55 std::string transition_name;
56 std::string peptide_ref;
57 double library_intensity;
58 double product_mz;
59 double precursor_mz;
60 int fragment_charge;
61 bool decoy;
62 bool detecting_transition;
63 bool quantifying_transition;
64 bool identifying_transition;
65
66 int getProductChargeState() const
67 {
68 return fragment_charge;
69 }
70
71 bool isProductChargeStateSet() const
72 {
73 return !(fragment_charge == 0);
74 }
75
76 std::string getNativeID() const
77 {
78 return transition_name;
79 }
80
81 std::string getPeptideRef() const
82 {
83 return peptide_ref;
84 }
85
86 std::string getCompoundRef() const
87 {
88 return peptide_ref;
89 }
90
91 double getLibraryIntensity() const
92 {
93 return library_intensity;
94 }
95
96 void setLibraryIntensity(double l)
97 {
98 library_intensity = l;
99 }
100
101 double getProductMZ() const
102 {
103 return product_mz;
104 }
105
106 double getPrecursorMZ() const
107 {
108 return precursor_mz;
109 }
110
111 void setDetectingTransition (bool d)
112 {
113 detecting_transition = d;
114 }
115
116 bool isDetectingTransition() const
117 {
118 return detecting_transition;
119 }
120
121 void setQuantifyingTransition (bool q)
122 {
123 quantifying_transition = q;
124 }
125
126 bool isQuantifyingTransition() const
127 {
128 return quantifying_transition;
129 }
130
131 void setIdentifyingTransition (bool i)
132 {
133 identifying_transition = i;
134 }
135
136 bool isIdentifyingTransition() const
137 {
138 return identifying_transition;
139 }
140 };
141
142 struct LightModification
143 {
144 int location;
145 int unimod_id;
146 };
147
148 // A compound is either a peptide or a metabolite
149 struct LightCompound
150 {
151
152 LightCompound() :
153 drift_time(-1),
154 charge(0)
155 {
156 }
157
158 double drift_time;
159 double rt;
160 int charge;
161 std::string sequence;
162 std::vector<std::string> protein_refs;
163 // Peptide group label (corresponds to MS:1000893, all peptides that are isotopic forms of the same peptide should be assigned the same peptide group label)
164 std::string peptide_group_label;
165 std::string gene_name;
166 std::string id;
167
168 // for metabolites
169 std::string sum_formula;
170 std::string compound_name;
171
172 // By convention, if there is no (metabolic) compound name, it is a peptide
173 bool isPeptide() const
174 {
175 return compound_name.empty();
176 }
177
178 void setChargeState(int ch)
179 {
180 charge = ch;
181 }
182
183 int getChargeState() const
184 {
185 return charge;
186 }
187
188 void setDriftTime(double d)
189 {
190 drift_time = d;
191 }
192
193 double getDriftTime() const
194 {
195 return drift_time;
196 }
197
198 std::vector<LightModification> modifications;
199 };
200
201 struct LightProtein
202 {
203 std::string id;
204 std::string sequence;
205 };
206
207 struct LightTargetedExperiment
208 {
209 LightTargetedExperiment() : compound_reference_map_dirty_(true) {}
210
211 typedef LightTransition Transition;
212 typedef LightCompound Peptide;
213 typedef LightCompound Compound;
214 typedef LightProtein Protein;
215
216 std::vector<LightTransition> transitions;
217 std::vector<LightCompound> compounds;
218 std::vector<LightProtein> proteins;
219 std::vector<LightTransition> & getTransitions()
220 {
221 return transitions;
222 }
223
224 const std::vector<LightTransition> & getTransitions() const
225 {
226 return transitions;
227 }
228
229 std::vector<LightCompound> & getCompounds()
230 {
231 return compounds;
232 }
233
234 const std::vector<LightCompound> & getCompounds() const
235 {
236 return compounds;
237 }
238
239 std::vector<LightProtein> & getProteins()
240 {
241 return proteins;
242 }
243
244 const std::vector<LightProtein> & getProteins() const
245 {
246 return proteins;
247 }
248
249 // legacy
250 const LightCompound& getPeptideByRef(const std::string& ref)
251 {
252 return getCompoundByRef(ref);
253 }
254
255 const LightCompound& getCompoundByRef(const std::string& ref)
256 {
257 if (compound_reference_map_dirty_)
258 {
259 createPeptideReferenceMap_();
260 }
261 return *(compound_reference_map_[ref]);
262 }
263
264 private:
265
266 void createPeptideReferenceMap_()
267 {
268 for (size_t i = 0; i < getCompounds().size(); i++)
269 {
270 compound_reference_map_[getCompounds()[i].id] = &getCompounds()[i];
271 }
272 compound_reference_map_dirty_ = false;
273 }
274
275 // Map of compounds (peptides or metabolites)
276 bool compound_reference_map_dirty_;
277 std::map<std::string, LightCompound*> compound_reference_map_;
278
279 };
280
281 } //end Namespace OpenSwath
282
OpenSwath::LightTransition::getProductChargeState
int getProductChargeState() const
Definition: TransitionExperiment.h:66
OpenSwath::LightCompound::protein_refs
std::vector< std::string > protein_refs
Definition: TransitionExperiment.h:162
OpenSwath::LightTargetedExperiment::getCompounds
const std::vector< LightCompound > & getCompounds() const
Definition: TransitionExperiment.h:234
OpenSwath::LightTransition::isProductChargeStateSet
bool isProductChargeStateSet() const
Definition: TransitionExperiment.h:71
OpenSwath::LightCompound::modifications
std::vector< LightModification > modifications
Definition: TransitionExperiment.h:198
OpenSwath::LightProtein::id
std::string id
Definition: TransitionExperiment.h:203
OpenSwath::LightTargetedExperiment::LightTargetedExperiment
LightTargetedExperiment()
Definition: TransitionExperiment.h:209
OpenSwath
Definition: MRMScoring.h:49
OpenSwath::LightTargetedExperiment::Transition
LightTransition Transition
Definition: TransitionExperiment.h:211
OpenSwath::LightTransition::getNativeID
std::string getNativeID() const
Definition: TransitionExperiment.h:76
OpenSwath::LightCompound::sequence
std::string sequence
Definition: TransitionExperiment.h:161
OpenSwath::LightTransition::precursor_mz
double precursor_mz
Definition: TransitionExperiment.h:59
OpenSwath::LightTargetedExperiment::proteins
std::vector< LightProtein > proteins
Definition: TransitionExperiment.h:218
OpenSwath::LightCompound::charge
int charge
Definition: TransitionExperiment.h:160
OpenSwath::LightTransition::setQuantifyingTransition
void setQuantifyingTransition(bool q)
Definition: TransitionExperiment.h:121
OpenSwath::LightTransition::decoy
bool decoy
Definition: TransitionExperiment.h:61
OpenSwath::LightCompound::id
std::string id
Definition: TransitionExperiment.h:166
OpenSwath::LightTransition::isQuantifyingTransition
bool isQuantifyingTransition() const
Definition: TransitionExperiment.h:126
OpenSwath::LightTransition::getLibraryIntensity
double getLibraryIntensity() const
Definition: TransitionExperiment.h:91
OpenSwath::LightCompound::getChargeState
int getChargeState() const
Definition: TransitionExperiment.h:183
OpenSwath::LightTargetedExperiment::compounds
std::vector< LightCompound > compounds
Definition: TransitionExperiment.h:217
OpenSwath::LightCompound::compound_name
std::string compound_name
Definition: TransitionExperiment.h:170
OpenSwath::LightCompound
Definition: TransitionExperiment.h:149
OpenSwath::LightTransition::detecting_transition
bool detecting_transition
Definition: TransitionExperiment.h:62
OpenSwath::LightCompound::setChargeState
void setChargeState(int ch)
Definition: TransitionExperiment.h:178
OpenSwath::LightTargetedExperiment::Compound
LightCompound Compound
Definition: TransitionExperiment.h:213
OpenSwath::LightTransition::setLibraryIntensity
void setLibraryIntensity(double l)
Definition: TransitionExperiment.h:96
OpenSwath::LightTransition::getPrecursorMZ
double getPrecursorMZ() const
Definition: TransitionExperiment.h:106
OpenSwath::LightTargetedExperiment::getPeptideByRef
const LightCompound & getPeptideByRef(const std::string &ref)
Definition: TransitionExperiment.h:250
OpenSwath::LightCompound::peptide_group_label
std::string peptide_group_label
Definition: TransitionExperiment.h:164
OpenSwath::LightTargetedExperiment::Protein
LightProtein Protein
Definition: TransitionExperiment.h:214
OpenSwath::LightTransition::peptide_ref
std::string peptide_ref
Definition: TransitionExperiment.h:56
OpenSwath::LightTransition::setDetectingTransition
void setDetectingTransition(bool d)
Definition: TransitionExperiment.h:111
OpenSwath::LightCompound::setDriftTime
void setDriftTime(double d)
Definition: TransitionExperiment.h:188
OpenSwath::LightTransition::identifying_transition
bool identifying_transition
Definition: TransitionExperiment.h:64
OpenSwath::LightTransition::quantifying_transition
bool quantifying_transition
Definition: TransitionExperiment.h:63
OpenSwath::LightModification::location
int location
Definition: TransitionExperiment.h:144
OpenSwath::LightModification::unimod_id
int unimod_id
Definition: TransitionExperiment.h:145
OpenSwath::LightTargetedExperiment::getProteins
const std::vector< LightProtein > & getProteins() const
Definition: TransitionExperiment.h:244
OpenSwath::LightCompound::isPeptide
bool isPeptide() const
Definition: TransitionExperiment.h:173
OpenSwath::LightTransition::fragment_charge
int fragment_charge
Definition: TransitionExperiment.h:60
OpenSwath::LightCompound::sum_formula
std::string sum_formula
Definition: TransitionExperiment.h:169
OpenSwath::LightCompound::gene_name
std::string gene_name
Definition: TransitionExperiment.h:165
OpenSwath::LightModification
Definition: TransitionExperiment.h:142
OpenSwath::LightProtein
Definition: TransitionExperiment.h:201
OpenSwath::LightTransition::getPeptideRef
std::string getPeptideRef() const
Definition: TransitionExperiment.h:81
OpenSwath::LightTargetedExperiment::getTransitions
const std::vector< LightTransition > & getTransitions() const
Definition: TransitionExperiment.h:224
OpenSwath::LightTargetedExperiment::getTransitions
std::vector< LightTransition > & getTransitions()
Definition: TransitionExperiment.h:219
OpenSwath::LightTransition::library_intensity
double library_intensity
Definition: TransitionExperiment.h:57
OpenSwath::LightTransition::LightTransition
LightTransition()
Definition: TransitionExperiment.h:50
OpenSwath::LightTargetedExperiment
Definition: TransitionExperiment.h:207
OpenSwath::LightTransition::setIdentifyingTransition
void setIdentifyingTransition(bool i)
Definition: TransitionExperiment.h:131
OpenSwath::LightTransition::getProductMZ
double getProductMZ() const
Definition: TransitionExperiment.h:101
OpenSwath::LightTargetedExperiment::createPeptideReferenceMap_
void createPeptideReferenceMap_()
Definition: TransitionExperiment.h:266
OpenSwath::LightTargetedExperiment::compound_reference_map_
std::map< std::string, LightCompound * > compound_reference_map_
Definition: TransitionExperiment.h:277
OpenSwath::LightTransition::product_mz
double product_mz
Definition: TransitionExperiment.h:58
OpenSwath::LightTargetedExperiment::getCompoundByRef
const LightCompound & getCompoundByRef(const std::string &ref)
Definition: TransitionExperiment.h:255
OpenSwath::LightCompound::getDriftTime
double getDriftTime() const
Definition: TransitionExperiment.h:193
OpenSwath::LightTransition
Definition: TransitionExperiment.h:46
OpenSwath::LightTargetedExperiment::transitions
std::vector< LightTransition > transitions
Definition: TransitionExperiment.h:216
OpenSwath::LightTransition::isDetectingTransition
bool isDetectingTransition() const
Definition: TransitionExperiment.h:116
OpenSwath::LightTransition::getCompoundRef
std::string getCompoundRef() const
Definition: TransitionExperiment.h:86
OpenSwath::LightCompound::LightCompound
LightCompound()
Definition: TransitionExperiment.h:152
OpenSwath::LightCompound::rt
double rt
Definition: TransitionExperiment.h:159
OpenSwath::LightProtein::sequence
std::string sequence
Definition: TransitionExperiment.h:204
OpenSwath::LightTargetedExperiment::getProteins
std::vector< LightProtein > & getProteins()
Definition: TransitionExperiment.h:239
OpenSwath::LightCompound::drift_time
double drift_time
Definition: TransitionExperiment.h:158
OpenSwath::LightTransition::isIdentifyingTransition
bool isIdentifyingTransition() const
Definition: TransitionExperiment.h:136
OpenSwath::LightTargetedExperiment::Peptide
LightCompound Peptide
Definition: TransitionExperiment.h:212
OpenSwath::LightTransition::transition_name
std::string transition_name
Definition: TransitionExperiment.h:55
OpenSwath::LightTargetedExperiment::getCompounds
std::vector< LightCompound > & getCompounds()
Definition: TransitionExperiment.h:229
OpenSwath::LightTargetedExperiment::compound_reference_map_dirty_
bool compound_reference_map_dirty_
Definition: TransitionExperiment.h:276