Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef OPENMS_ANALYSIS_TARGETED_TARGETEDEXPERIMENTHELPER_H
00036 #define OPENMS_ANALYSIS_TARGETED_TARGETEDEXPERIMENTHELPER_H
00037
00038 #include <OpenMS/KERNEL/StandardTypes.h>
00039 #include <OpenMS/METADATA/CVTerm.h>
00040 #include <OpenMS/METADATA/CVTermList.h>
00041
00042 #include <boost/numeric/conversion/cast.hpp>
00043
00044 namespace OpenMS
00045 {
00052 namespace TargetedExperimentHelper
00053 {
00054
00055 struct Configuration :
00056 public CVTermList
00057 {
00058 String contact_ref;
00059 String instrument_ref;
00060 std::vector<CVTermList> validations;
00061
00062 Configuration & operator=(const Configuration & rhs)
00063 {
00064 if (this != &rhs)
00065 {
00066 CVTermList::operator=(rhs);
00067 contact_ref = rhs.contact_ref;
00068 instrument_ref = rhs.instrument_ref;
00069 validations = rhs.validations;
00070 }
00071 return *this;
00072 }
00073
00074 };
00075
00076 struct CV
00077 {
00078 CV(const String & new_id, const String & new_fullname, const String & new_version, const String & new_URI) :
00079 id(new_id),
00080 fullname(new_fullname),
00081 version(new_version),
00082 URI(new_URI)
00083 {
00084
00085 }
00086
00087 String id;
00088 String fullname;
00089 String version;
00090 String URI;
00091
00092 bool operator==(const CV & cv) const
00093 {
00094 return id == cv.id &&
00095 fullname == cv.fullname &&
00096 version == cv.version &&
00097 URI == cv.URI;
00098 }
00099
00100 };
00101
00102 struct Protein :
00103 public CVTermList
00104 {
00105 Protein() :
00106 CVTermList()
00107 {
00108 }
00109
00110 String id;
00111 String sequence;
00112
00113 bool operator==(const Protein & rhs) const
00114 {
00115 return CVTermList::operator==(rhs) &&
00116 id == rhs.id &&
00117 sequence == rhs.sequence;
00118 }
00119
00120 Protein & operator=(const Protein & rhs)
00121 {
00122 if (&rhs != this)
00123 {
00124 CVTermList::operator=(rhs);
00125 id = rhs.id;
00126 sequence = rhs.sequence;
00127 }
00128 return *this;
00129 }
00130
00131 };
00132
00133 class OPENMS_DLLAPI RetentionTime :
00134 public CVTermList
00135 {
00136 public:
00137
00138 RetentionTime() :
00139 CVTermList()
00140 {
00141 }
00142
00143 RetentionTime(const RetentionTime & rhs) :
00144 CVTermList(rhs),
00145 software_ref(rhs.software_ref)
00146 {
00147 }
00148
00149 virtual ~RetentionTime()
00150 {
00151 }
00152
00153 RetentionTime & operator=(const RetentionTime & rhs)
00154 {
00155 if (&rhs != this)
00156 {
00157 CVTermList::operator=(rhs);
00158 software_ref = rhs.software_ref;
00159 }
00160 return *this;
00161 }
00162
00163 bool operator==(const RetentionTime & rhs) const
00164 {
00165 return CVTermList::operator==(rhs) &&
00166 software_ref == rhs.software_ref;
00167 }
00168
00169 String software_ref;
00170 };
00171
00172 class OPENMS_DLLAPI Compound :
00173 public CVTermList
00174 {
00175 public:
00176
00177 Compound() :
00178 CVTermList()
00179 {
00180 }
00181
00182 Compound(const Compound & rhs) :
00183 CVTermList(rhs),
00184 id(rhs.id),
00185 rts(rhs.rts)
00186 {
00187 }
00188
00189 Compound & operator=(const Compound & rhs)
00190 {
00191 if (this != &rhs)
00192 {
00193 CVTermList::operator=(rhs);
00194 id = rhs.id;
00195 rts = rhs.rts;
00196 }
00197 return *this;
00198 }
00199
00200 bool operator==(const Compound & rhs) const
00201 {
00202 return CVTermList::operator==(rhs) &&
00203 id == rhs.id &&
00204 rts == rhs.rts;
00205 }
00206
00207 String id;
00208 std::vector<RetentionTime> rts;
00209 };
00210
00211 class OPENMS_DLLAPI Peptide :
00212 public CVTermList
00213 {
00214 public:
00215
00216 struct Modification :
00217 public CVTermList
00218 {
00219 DoubleReal avg_mass_delta;
00220 int location;
00221 DoubleReal mono_mass_delta;
00222 };
00223
00224 Peptide() :
00225 CVTermList()
00226 {
00227 charge_ = -1;
00228 peptide_group_label_ = -1;
00229
00230
00231
00232 static std::vector<String> * init_peptide_group_labels_ = 0;
00233 if (init_peptide_group_labels_ == 0)
00234 {
00235 init_peptide_group_labels_ = new std::vector<String>;
00236 }
00237 peptide_group_labels_ = init_peptide_group_labels_;
00238 }
00239
00240 Peptide(const Peptide & rhs) :
00241 CVTermList(rhs),
00242 rts(rhs.rts),
00243 id(rhs.id),
00244 protein_refs(rhs.protein_refs),
00245 evidence(rhs.evidence),
00246 sequence(rhs.sequence),
00247 mods(rhs.mods),
00248 charge_(rhs.charge_),
00249 peptide_group_label_(rhs.peptide_group_label_),
00250 peptide_group_labels_(rhs.peptide_group_labels_)
00251 {
00252 }
00253
00254 Peptide & operator=(const Peptide & rhs)
00255 {
00256 if (this != &rhs)
00257 {
00258 CVTermList::operator=(rhs);
00259 rts = rhs.rts;
00260 id = rhs.id;
00261 protein_refs = rhs.protein_refs;
00262 evidence = rhs.evidence;
00263 sequence = rhs.sequence;
00264 mods = rhs.mods;
00265 charge_ = rhs.charge_;
00266 peptide_group_label_ = rhs.peptide_group_label_;
00267 peptide_group_labels_ = rhs.peptide_group_labels_;
00268 }
00269 return *this;
00270 }
00271
00272 bool operator==(const Peptide & rhs) const
00273 {
00274 return CVTermList::operator==(rhs) &&
00275 rts == rhs.rts &&
00276 id == rhs.id &&
00277 protein_refs == rhs.protein_refs &&
00278 evidence == rhs.evidence &&
00279 sequence == rhs.sequence &&
00280 mods == rhs.mods &&
00281 charge_ == rhs.charge_ &&
00282 peptide_group_label_ == rhs.peptide_group_label_ &&
00283 peptide_group_labels_ == rhs.peptide_group_labels_;
00284 }
00285
00286 void setChargeState(int charge)
00287 {
00288 charge_ = charge;
00289 }
00290
00291 int getChargeState() const
00292 {
00293 return charge_;
00294 }
00295
00296 void setPeptideGroupLabel(const String & label)
00297 {
00298 for (Size i = 0; i < peptide_group_labels_->size(); i++)
00299 {
00300 if ((*peptide_group_labels_)[i] == label)
00301 {
00302 peptide_group_label_ = (Int)i;
00303 return;
00304 }
00305 }
00306
00307
00308 peptide_group_label_ = (Int)peptide_group_labels_->size();
00309 peptide_group_labels_->push_back(label);
00310 }
00311
00312 String getPeptideGroupLabel() const
00313 {
00314 if (peptide_group_label_ == -1)
00315 {
00316 return "";
00317 }
00318 return (*peptide_group_labels_)[peptide_group_label_];
00319 }
00320
00321 std::vector<RetentionTime> rts;
00322 String id;
00323 std::vector<String> protein_refs;
00324 CVTermList evidence;
00325 String sequence;
00326 std::vector<Modification> mods;
00327
00328 protected:
00329 int charge_;
00330 Int peptide_group_label_;
00331 std::vector<String> * peptide_group_labels_;
00332 };
00333
00334 struct OPENMS_DLLAPI Contact :
00335 public CVTermList
00336 {
00337 Contact() :
00338 CVTermList()
00339 {
00340 }
00341
00342 String id;
00343
00344 bool operator==(const Contact & rhs) const
00345 {
00346 return CVTermList::operator==(rhs) &&
00347 id == rhs.id;
00348 }
00349
00350 Contact & operator=(const Contact & rhs)
00351 {
00352 if (&rhs != this)
00353 {
00354 CVTermList::operator=(rhs);
00355 id = rhs.id;
00356 }
00357 return *this;
00358 }
00359
00360 };
00361
00362 struct OPENMS_DLLAPI Publication :
00363 public CVTermList
00364 {
00365 Publication() :
00366 CVTermList()
00367 {
00368 }
00369
00370 String id;
00371
00372 bool operator==(const Publication & rhs) const
00373 {
00374 return CVTermList::operator==(rhs) &&
00375 id == rhs.id;
00376 }
00377
00378 Publication & operator=(const Publication & rhs)
00379 {
00380 if (&rhs != this)
00381 {
00382 CVTermList::operator=(rhs);
00383 id = rhs.id;
00384 }
00385 return *this;
00386 }
00387
00388 };
00389
00390 struct OPENMS_DLLAPI Instrument :
00391 public CVTermList
00392 {
00393 Instrument() :
00394 CVTermList()
00395 {
00396 }
00397
00398 String id;
00399
00400 bool operator==(const Instrument & rhs) const
00401 {
00402 return CVTermList::operator==(rhs) &&
00403 id == rhs.id;
00404 }
00405
00406 Instrument & operator=(const Instrument & rhs)
00407 {
00408 if (&rhs != this)
00409 {
00410 CVTermList::operator=(rhs);
00411 id = rhs.id;
00412 }
00413 return *this;
00414 }
00415
00416 };
00417
00418 struct OPENMS_DLLAPI Prediction :
00419 public CVTermList
00420 {
00421 Prediction() :
00422 CVTermList()
00423 {
00424 }
00425
00426 String software_ref;
00427 String contact_ref;
00428
00429 bool operator==(const Prediction & rhs) const
00430 {
00431 return CVTermList::operator==(rhs) &&
00432 contact_ref == rhs.contact_ref &&
00433 software_ref == rhs.software_ref;
00434 }
00435
00436 Prediction & operator=(const Prediction & rhs)
00437 {
00438 if (&rhs != this)
00439 {
00440 CVTermList::operator=(rhs);
00441 software_ref = rhs.software_ref;
00442 contact_ref = rhs.contact_ref;
00443 }
00444 return *this;
00445 }
00446
00447 };
00448
00449 struct OPENMS_DLLAPI TraMLProduct :
00450 public CVTermList
00451 {
00452 TraMLProduct() :
00453 CVTermList()
00454 {
00455 charge_ = -1;
00456 }
00457
00458 bool operator==(const TraMLProduct & rhs) const
00459 {
00460 return CVTermList::operator==(rhs) &&
00461 charge_ == rhs.charge_ &&
00462 configuration_list_ == rhs.configuration_list_ &&
00463 interpretation_list_ == rhs.interpretation_list_;
00464 }
00465
00466 TraMLProduct & operator=(const TraMLProduct & rhs)
00467 {
00468 if (&rhs != this)
00469 {
00470 CVTermList::operator=(rhs);
00471 charge_ = rhs.charge_;
00472 configuration_list_ = rhs.configuration_list_;
00473 interpretation_list_ = rhs.interpretation_list_;
00474 }
00475 return *this;
00476 }
00477
00478 void setChargeState(int charge)
00479 {
00480 charge_ = charge;
00481 }
00482
00483 int getChargeState() const
00484 {
00485 return charge_;
00486 }
00487
00488 const std::vector<Configuration> & getConfigurationList() const
00489 {
00490 return configuration_list_;
00491 }
00492
00493 void addConfiguration(const Configuration configuration)
00494 {
00495 return configuration_list_.push_back(configuration);
00496 }
00497
00498 void replaceCVTerms(Map<String, std::vector<CVTerm> > & cv_terms)
00499 {
00500 cv_terms_ = cv_terms;
00501 }
00502
00503 const std::vector<CVTermList> & getInterpretationList() const
00504 {
00505 return interpretation_list_;
00506 }
00507
00508 void addInterpretation(const CVTermList interpretation)
00509 {
00510 return interpretation_list_.push_back(interpretation);
00511 }
00512
00513 private:
00514 int charge_;
00515 std::vector<Configuration> configuration_list_;
00516 std::vector<CVTermList> interpretation_list_;
00517
00518 };
00519
00521 OPENMS_DLLAPI OpenMS::AASequence getAASequence(const Peptide& peptide);
00522
00524 OPENMS_DLLAPI void setModification(int location, int max_size, String modification, OpenMS::AASequence & aas);
00525
00526 }
00527 }
00528
00529 #endif // OPENMS_ANALYSIS_TARGETED_TARGETEDEXPERIMENTHELPER_H