Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
TargetedExperimentHelper.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-2015.
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: Andreas Bertsch $
32 // $Authors: Andreas Bertsch $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_ANALYSIS_TARGETED_TARGETEDEXPERIMENTHELPER_H
36 #define OPENMS_ANALYSIS_TARGETED_TARGETEDEXPERIMENTHELPER_H
37 
39 #include <OpenMS/METADATA/CVTerm.h>
41 
42 #include <boost/numeric/conversion/cast.hpp>
43 
44 namespace OpenMS
45 {
52  namespace TargetedExperimentHelper
53  {
54 
55  struct Configuration :
56  public CVTermList
57  {
60  std::vector<CVTermList> validations;
61 
63  {
64  if (this != &rhs)
65  {
67  contact_ref = rhs.contact_ref;
68  instrument_ref = rhs.instrument_ref;
69  validations = rhs.validations;
70  }
71  return *this;
72  }
73 
74  };
75 
76  struct CV
77  {
78  CV(const String & new_id, const String & new_fullname, const String & new_version, const String & new_URI) :
79  id(new_id),
80  fullname(new_fullname),
81  version(new_version),
82  URI(new_URI)
83  {
84 
85  }
86 
91 
92  bool operator==(const CV & cv) const
93  {
94  return id == cv.id &&
95  fullname == cv.fullname &&
96  version == cv.version &&
97  URI == cv.URI;
98  }
99 
100  };
101 
102  struct Protein :
103  public CVTermList
104  {
106  CVTermList()
107  {
108  }
109 
112 
113  bool operator==(const Protein & rhs) const
114  {
115  return CVTermList::operator==(rhs) &&
116  id == rhs.id &&
117  sequence == rhs.sequence;
118  }
119 
120  Protein & operator=(const Protein & rhs)
121  {
122  if (&rhs != this)
123  {
125  id = rhs.id;
126  sequence = rhs.sequence;
127  }
128  return *this;
129  }
130 
131  };
132 
133  class OPENMS_DLLAPI RetentionTime :
134  public CVTermList
135  {
136 public:
137 
139  CVTermList()
140  {
141  }
142 
144  CVTermList(rhs),
145  software_ref(rhs.software_ref)
146  {
147  }
148 
149  virtual ~RetentionTime()
150  {
151  }
152 
154  {
155  if (&rhs != this)
156  {
158  software_ref = rhs.software_ref;
159  }
160  return *this;
161  }
162 
163  bool operator==(const RetentionTime & rhs) const
164  {
165  return CVTermList::operator==(rhs) &&
166  software_ref == rhs.software_ref;
167  }
168 
170  };
171 
172  class OPENMS_DLLAPI Compound :
173  public CVTermList
174  {
175 public:
176 
178  CVTermList()
179  {
180  }
181 
182  Compound(const Compound & rhs) :
183  CVTermList(rhs),
184  id(rhs.id),
185  rts(rhs.rts)
186  {
187  }
188 
189  Compound & operator=(const Compound & rhs)
190  {
191  if (this != &rhs)
192  {
194  id = rhs.id;
195  rts = rhs.rts;
196  }
197  return *this;
198  }
199 
200  bool operator==(const Compound & rhs) const
201  {
202  return CVTermList::operator==(rhs) &&
203  id == rhs.id &&
204  rts == rhs.rts;
205  }
206 
208  std::vector<RetentionTime> rts;
209  };
210 
211  class OPENMS_DLLAPI Peptide :
212  public CVTermList
213  {
214 public:
215 
216  struct Modification :
217  public CVTermList
218  {
220  int location;
222  };
223 
225  CVTermList()
226  {
227  charge_ = -1;
228  }
229 
230  Peptide(const Peptide & rhs) :
231  CVTermList(rhs),
232  rts(rhs.rts),
233  id(rhs.id),
234  protein_refs(rhs.protein_refs),
235  evidence(rhs.evidence),
236  sequence(rhs.sequence),
237  mods(rhs.mods),
238  charge_(rhs.charge_),
239  peptide_group_label_(rhs.peptide_group_label_)
240  {
241  }
242 
243  Peptide & operator=(const Peptide & rhs)
244  {
245  if (this != &rhs)
246  {
248  rts = rhs.rts;
249  id = rhs.id;
250  protein_refs = rhs.protein_refs;
251  evidence = rhs.evidence;
252  sequence = rhs.sequence;
253  mods = rhs.mods;
254  charge_ = rhs.charge_;
255  peptide_group_label_ = rhs.peptide_group_label_;
256  }
257  return *this;
258  }
259 
260  bool operator==(const Peptide & rhs) const
261  {
262  return CVTermList::operator==(rhs) &&
263  rts == rhs.rts &&
264  id == rhs.id &&
265  protein_refs == rhs.protein_refs &&
266  evidence == rhs.evidence &&
267  sequence == rhs.sequence &&
268  mods == rhs.mods &&
269  charge_ == rhs.charge_ &&
270  peptide_group_label_ == rhs.peptide_group_label_;
271  }
272 
274  void setChargeState(int charge)
275  {
276  charge_ = charge;
277  }
278 
280  int getChargeState() const
281  {
282  return charge_;
283  }
284 
295  void setPeptideGroupLabel(const String & label)
297  {
298  peptide_group_label_ = label;
299  }
300 
303  {
304  return peptide_group_label_;
305  }
307 
308  double getRetentionTime() const
309  {
310  // some guesstimate which would be the retention time that the user
311  // would like to have...
312  if (rts.empty() || rts[0].getCVTerms()["MS:1000896"].empty())
313  {
314  throw Exception::IllegalArgument(__FILE__, __LINE__, __PRETTY_FUNCTION__,
315  "No retention time information (CV term 1000896) available");
316  }
317  return rts[0].getCVTerms()["MS:1000896"][0].getValue().toString().toDouble();
318  }
319 
320  std::vector<RetentionTime> rts;
322  std::vector<String> protein_refs;
325  std::vector<Modification> mods;
326 
327 protected:
328  int charge_;
330  };
331 
332  struct OPENMS_DLLAPI Contact :
333  public CVTermList
334  {
336  CVTermList()
337  {
338  }
339 
341 
342  bool operator==(const Contact & rhs) const
343  {
344  return CVTermList::operator==(rhs) &&
345  id == rhs.id;
346  }
347 
348  Contact & operator=(const Contact & rhs)
349  {
350  if (&rhs != this)
351  {
353  id = rhs.id;
354  }
355  return *this;
356  }
357 
358  };
359 
360  struct OPENMS_DLLAPI Publication :
361  public CVTermList
362  {
364  CVTermList()
365  {
366  }
367 
369 
370  bool operator==(const Publication & rhs) const
371  {
372  return CVTermList::operator==(rhs) &&
373  id == rhs.id;
374  }
375 
377  {
378  if (&rhs != this)
379  {
381  id = rhs.id;
382  }
383  return *this;
384  }
385 
386  };
387 
388  struct OPENMS_DLLAPI Instrument :
389  public CVTermList
390  {
392  CVTermList()
393  {
394  }
395 
397 
398  bool operator==(const Instrument & rhs) const
399  {
400  return CVTermList::operator==(rhs) &&
401  id == rhs.id;
402  }
403 
405  {
406  if (&rhs != this)
407  {
409  id = rhs.id;
410  }
411  return *this;
412  }
413 
414  };
415 
416  struct OPENMS_DLLAPI Prediction :
417  public CVTermList
418  {
420  CVTermList()
421  {
422  }
423 
426 
427  bool operator==(const Prediction & rhs) const
428  {
429  return CVTermList::operator==(rhs) &&
430  contact_ref == rhs.contact_ref &&
431  software_ref == rhs.software_ref;
432  }
433 
435  {
436  if (&rhs != this)
437  {
439  software_ref = rhs.software_ref;
440  contact_ref = rhs.contact_ref;
441  }
442  return *this;
443  }
444 
445  };
446 
447  struct OPENMS_DLLAPI TraMLProduct :
448  public CVTermList
449  {
451  CVTermList()
452  {
453  charge_ = -1;
454  }
455 
456  bool operator==(const TraMLProduct & rhs) const
457  {
458  return CVTermList::operator==(rhs) &&
459  charge_ == rhs.charge_ &&
460  configuration_list_ == rhs.configuration_list_ &&
461  interpretation_list_ == rhs.interpretation_list_;
462  }
463 
465  {
466  if (&rhs != this)
467  {
469  charge_ = rhs.charge_;
470  configuration_list_ = rhs.configuration_list_;
471  interpretation_list_ = rhs.interpretation_list_;
472  }
473  return *this;
474  }
475 
476  void setChargeState(int charge)
477  {
478  charge_ = charge;
479  }
480 
481  int getChargeState() const
482  {
483  return charge_;
484  }
485 
486  const std::vector<Configuration> & getConfigurationList() const
487  {
488  return configuration_list_;
489  }
490 
491  void addConfiguration(const Configuration configuration)
492  {
493  return configuration_list_.push_back(configuration);
494  }
495 
496  void replaceCVTerms(Map<String, std::vector<CVTerm> > & cv_terms)
497  {
498  cv_terms_ = cv_terms;
499  }
500 
501  const std::vector<CVTermList> & getInterpretationList() const
502  {
503  return interpretation_list_;
504  }
505 
506  void addInterpretation(const CVTermList interpretation)
507  {
508  return interpretation_list_.push_back(interpretation);
509  }
510 
511 private:
512  int charge_;
513  std::vector<Configuration> configuration_list_;
514  std::vector<CVTermList> interpretation_list_;
515 
516  };
517 
519  OPENMS_DLLAPI OpenMS::AASequence getAASequence(const Peptide& peptide);
520 
522  OPENMS_DLLAPI void setModification(int location, int max_size, String modification, OpenMS::AASequence & aas);
523 
524  }
525 } // namespace OpenMS
526 
527 #endif // OPENMS_ANALYSIS_TARGETED_TARGETEDEXPERIMENTHELPER_H
void addConfiguration(const Configuration configuration)
Definition: TargetedExperimentHelper.h:491
Peptide(const Peptide &rhs)
Definition: TargetedExperimentHelper.h:230
String peptide_group_label_
Definition: TargetedExperimentHelper.h:329
bool operator==(const Contact &rhs) const
Definition: TargetedExperimentHelper.h:342
virtual ~RetentionTime()
Definition: TargetedExperimentHelper.h:149
CVTermList evidence
Definition: TargetedExperimentHelper.h:323
A more convenient string class.
Definition: String.h:57
double avg_mass_delta
Definition: TargetedExperimentHelper.h:219
Protein & operator=(const Protein &rhs)
Definition: TargetedExperimentHelper.h:120
Representation of controlled vocabulary term list.
Definition: CVTermList.h:54
void setChargeState(int charge)
Definition: TargetedExperimentHelper.h:476
Compound & operator=(const Compound &rhs)
Definition: TargetedExperimentHelper.h:189
Configuration & operator=(const Configuration &rhs)
Definition: TargetedExperimentHelper.h:62
int location
Definition: TargetedExperimentHelper.h:220
String id
Definition: TargetedExperimentHelper.h:340
String URI
Definition: TargetedExperimentHelper.h:90
const std::vector< Configuration > & getConfigurationList() const
Definition: TargetedExperimentHelper.h:486
Definition: TargetedExperimentHelper.h:360
Compound()
Definition: TargetedExperimentHelper.h:177
String instrument_ref
Definition: TargetedExperimentHelper.h:59
String software_ref
Definition: TargetedExperimentHelper.h:424
TraMLProduct & operator=(const TraMLProduct &rhs)
Definition: TargetedExperimentHelper.h:464
std::vector< CVTermList > interpretation_list_
Definition: TargetedExperimentHelper.h:514
Prediction & operator=(const Prediction &rhs)
Definition: TargetedExperimentHelper.h:434
OpenMS::AASequence getAASequence(const Peptide &peptide)
helper function that converts a Peptide object to a AASequence object
String getPeptideGroupLabel() const
Get the peptide group label.
Definition: TargetedExperimentHelper.h:302
Representation of a peptide/protein sequence.
Definition: AASequence.h:70
String fullname
Definition: TargetedExperimentHelper.h:88
Peptide & operator=(const Peptide &rhs)
Definition: TargetedExperimentHelper.h:243
CVTermList & operator=(const CVTermList &rhs)
Assignment operator.
bool operator==(const Instrument &rhs) const
Definition: TargetedExperimentHelper.h:398
Definition: TargetedExperimentHelper.h:332
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Contact & operator=(const Contact &rhs)
Definition: TargetedExperimentHelper.h:348
void addInterpretation(const CVTermList interpretation)
Definition: TargetedExperimentHelper.h:506
TraMLProduct()
Definition: TargetedExperimentHelper.h:450
double mono_mass_delta
Definition: TargetedExperimentHelper.h:221
CV(const String &new_id, const String &new_fullname, const String &new_version, const String &new_URI)
Definition: TargetedExperimentHelper.h:78
int getChargeState() const
Return the peptide charge state.
Definition: TargetedExperimentHelper.h:280
std::vector< Configuration > configuration_list_
Definition: TargetedExperimentHelper.h:513
RetentionTime & operator=(const RetentionTime &rhs)
Definition: TargetedExperimentHelper.h:153
std::vector< RetentionTime > rts
Definition: TargetedExperimentHelper.h:320
std::vector< RetentionTime > rts
Definition: TargetedExperimentHelper.h:208
Peptide()
Definition: TargetedExperimentHelper.h:224
void setModification(int location, int max_size, String modification, OpenMS::AASequence &aas)
helper function that sets a modification on a AASequence object
Protein()
Definition: TargetedExperimentHelper.h:105
A method or algorithm argument contains illegal values.
Definition: Exception.h:634
int charge_
Definition: TargetedExperimentHelper.h:328
bool operator==(const Protein &rhs) const
Definition: TargetedExperimentHelper.h:113
Definition: TargetedExperimentHelper.h:55
std::vector< CVTermList > validations
Definition: TargetedExperimentHelper.h:60
String id
Definition: TargetedExperimentHelper.h:321
Definition: TargetedExperimentHelper.h:447
Instrument()
Definition: TargetedExperimentHelper.h:391
void replaceCVTerms(Map< String, std::vector< CVTerm > > &cv_terms)
Definition: TargetedExperimentHelper.h:496
bool operator==(const CVTermList &cv_term_list) const
equality operator
Instrument & operator=(const Instrument &rhs)
Definition: TargetedExperimentHelper.h:404
String id
Definition: TargetedExperimentHelper.h:87
String contact_ref
Definition: TargetedExperimentHelper.h:425
Publication & operator=(const Publication &rhs)
Definition: TargetedExperimentHelper.h:376
String sequence
Definition: TargetedExperimentHelper.h:111
RetentionTime()
Definition: TargetedExperimentHelper.h:138
bool operator==(const RetentionTime &rhs) const
Definition: TargetedExperimentHelper.h:163
Definition: TargetedExperimentHelper.h:172
std::vector< Modification > mods
Definition: TargetedExperimentHelper.h:325
std::vector< String > protein_refs
Definition: TargetedExperimentHelper.h:322
void setChargeState(int charge)
Set the peptide charge state.
Definition: TargetedExperimentHelper.h:274
String id
Definition: TargetedExperimentHelper.h:368
Prediction()
Definition: TargetedExperimentHelper.h:419
Definition: TargetedExperimentHelper.h:76
String sequence
Definition: TargetedExperimentHelper.h:324
Definition: TargetedExperimentHelper.h:216
bool operator==(const CV &cv) const
Definition: TargetedExperimentHelper.h:92
String id
Definition: TargetedExperimentHelper.h:110
int getChargeState() const
Definition: TargetedExperimentHelper.h:481
bool operator==(const Publication &rhs) const
Definition: TargetedExperimentHelper.h:370
RetentionTime(const RetentionTime &rhs)
Definition: TargetedExperimentHelper.h:143
Definition: TargetedExperimentHelper.h:388
String id
Definition: TargetedExperimentHelper.h:207
Definition: TargetedExperimentHelper.h:133
String id
Definition: TargetedExperimentHelper.h:396
Definition: TargetedExperimentHelper.h:416
Definition: TargetedExperimentHelper.h:102
String contact_ref
Definition: TargetedExperimentHelper.h:58
bool operator==(const Compound &rhs) const
Definition: TargetedExperimentHelper.h:200
String software_ref
Definition: TargetedExperimentHelper.h:169
bool operator==(const Prediction &rhs) const
Definition: TargetedExperimentHelper.h:427
double getRetentionTime() const
Definition: TargetedExperimentHelper.h:308
Compound(const Compound &rhs)
Definition: TargetedExperimentHelper.h:182
Map class based on the STL map (containing several convenience functions)
Definition: Map.h:51
Publication()
Definition: TargetedExperimentHelper.h:363
String version
Definition: TargetedExperimentHelper.h:89
bool operator==(const TraMLProduct &rhs) const
Definition: TargetedExperimentHelper.h:456
bool operator==(const Peptide &rhs) const
Definition: TargetedExperimentHelper.h:260
int charge_
Definition: TargetedExperimentHelper.h:512
Definition: TargetedExperimentHelper.h:211
Contact()
Definition: TargetedExperimentHelper.h:335
const std::vector< CVTermList > & getInterpretationList() const
Definition: TargetedExperimentHelper.h:501

OpenMS / TOPP release 2.0.0 Documentation generated on Fri May 29 2015 17:20:31 using doxygen 1.8.9.1