Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
PeptideHit.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-2017.
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: Timo Sachsenberg $
32 // $Authors: $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_METADATA_PEPTIDEHIT_H
36 #define OPENMS_METADATA_PEPTIDEHIT_H
37 
38 #include <vector>
39 
40 #include <OpenMS/CONCEPT/Types.h>
45 
46 namespace OpenMS
47 {
55  class OPENMS_DLLAPI PeptideHit :
56  public MetaInfoInterface
57  {
58 public:
59 
78  {
79  String annotation; // e.g. [alpha|ci$y3-H2O-NH3]
80  int charge;
81  double mz;
82  double intensity;
83 
84  bool operator<(const PeptideHit::PeakAnnotation& other) const
85  {
86  // sensible to sort first by m/z and charge
87  if (mz < other.mz)
88  {
89  return true;
90  }
91  else if (mz > other.mz)
92  {
93  return false;
94  }
95 
96  if (charge < other.charge)
97  {
98  return true;
99  }
100  else if (charge > other.charge)
101  {
102  return false;
103  }
104 
105  if (annotation < other.annotation)
106  {
107  return true;
108  }
109  else if (annotation > other.annotation)
110  {
111  return false;
112  }
113 
114  if (intensity < other.intensity)
115  {
116  return true;
117  }
118  else if (intensity > other.intensity)
119  {
120  return false;
121  }
122 
123  return false;
124  }
125 
126  bool operator==(const PeptideHit::PeakAnnotation& other) const
127  {
128  if (charge != other.charge || mz != other.mz ||
129  intensity != other.intensity || annotation != other.annotation) return false;
130  return true;
131  }
132 };
133 
134 public:
135 
137 
138  class OPENMS_DLLAPI ScoreMore
140  {
141 public:
142  template <typename Arg>
143  bool operator()(const Arg& a, const Arg& b)
144  {
145  return a.getScore() > b.getScore();
146  }
147 
148  };
149 
151  class OPENMS_DLLAPI ScoreLess
152  {
153 public:
154  template <typename Arg>
155  bool operator()(const Arg& a, const Arg& b)
156  {
157  return a.getScore() < b.getScore();
158  }
159 
160  };
161 
163  class OPENMS_DLLAPI RankLess
164  {
165 public:
166  template <typename Arg>
167  bool operator()(const Arg& a, const Arg& b)
168  {
169  return a.getRank() < b.getRank();
170  }
171 
172  };
174 
175 
177  class OPENMS_DLLAPI SequenceLessComparator
178  {
179  template <typename Arg>
180  bool operator()(const Arg& a, const Arg& b)
181  {
182  if (a.getSequence().toString() < b.getSequence().toString()) return true;
183  return false;
184  }
185  };
187 
189  class OPENMS_DLLAPI PepXMLAnalysisResult
190  {
191 public:
192  String score_type; // e.g. peptideprophet / interprophet
193  bool higher_is_better; // is higher score better ?
194  double main_score; // posterior probability for example
195  std::map<String, double> sub_scores;
196 
197  bool operator==(const PepXMLAnalysisResult& rhs) const
198  {
199  return score_type == rhs.score_type
200  && higher_is_better == rhs.higher_is_better
201  && main_score == rhs.main_score
202  && sub_scores == rhs.sub_scores;
203  }
204 
206  {
207  if (this == &source) return *this;
208  score_type = source.score_type;
209  higher_is_better = source.higher_is_better;
210  main_score = source.main_score;
211  sub_scores = source.sub_scores;
212  return *this;
213  }
214 
215  };
216 
219  PeptideHit();
221 
223  PeptideHit(double score,
224  UInt rank,
225  Int charge,
226  const AASequence& sequence);
227 
229  PeptideHit(const PeptideHit& source);
230 
232  virtual ~PeptideHit();
234 
236  PeptideHit& operator=(const PeptideHit& source);
237 
239  bool operator==(const PeptideHit& rhs) const;
240 
242  bool operator!=(const PeptideHit& rhs) const;
243 
247  const AASequence& getSequence() const;
249 
251  void setSequence(const AASequence& sequence);
252 
254  Int getCharge() const;
255 
257  void setCharge(Int charge);
258 
260  const std::vector<PeptideEvidence>& getPeptideEvidences() const;
261 
263  void setPeptideEvidences(const std::vector<PeptideEvidence>& peptide_evidences);
264 
266  void addPeptideEvidence(const PeptideEvidence& peptide_evidence);
267 
269  double getScore() const;
270 
272  void setScore(double score);
273 
275  void setAnalysisResults(std::vector<PepXMLAnalysisResult> aresult);
276 
278  void addAnalysisResults(PepXMLAnalysisResult aresult);
279 
281  const std::vector<PepXMLAnalysisResult>& getAnalysisResults() const;
282 
284  UInt getRank() const;
285 
287  void setRank(UInt newrank);
288 
290  std::vector<PeptideHit::PeakAnnotation> getPeakAnnotations() const;
291 
293  void setPeakAnnotations(std::vector<PeptideHit::PeakAnnotation> frag_annotations);
294 
296 
298  std::set<String> extractProteinAccessionsSet() const;
299 
300 protected:
302 
304  double score_;
305 
307  std::vector<PepXMLAnalysisResult>* analysis_results_;
308 
311 
314 
316  std::vector<PeptideEvidence> peptide_evidences_;
317 
319  std::vector<PeptideHit::PeakAnnotation> fragment_annotations_;
320  };
321 
322 } // namespace OpenMS
323 
324 #endif // OPENMS_METADATA_PEPTIDEHIT_H
double main_score
Definition: PeptideHit.h:194
A more convenient string class.
Definition: String.h:57
Lesser predicate for scores of hits.
Definition: PeptideHit.h:163
std::vector< PeptideHit::PeakAnnotation > fragment_annotations_
annotations of fragments in the corresponding spectrum
Definition: PeptideHit.h:319
UInt rank_
the position(rank) where the hit appeared in the hit list
Definition: PeptideHit.h:310
unsigned int UInt
Unsigned integer type.
Definition: Types.h:95
bool operator<(const PeptideHit::PeakAnnotation &other) const
Definition: PeptideHit.h:84
bool operator==(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:806
std::map< String, double > sub_scores
Definition: PeptideHit.h:195
Representation of a peptide/protein sequence.
Definition: AASequence.h:108
double mz
Definition: PeptideHit.h:81
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Lesser predicate for (modified) sequence of hits.
Definition: PeptideHit.h:177
std::vector< PepXMLAnalysisResult > * analysis_results_
additional scores attached to the original, aggregated score
Definition: PeptideHit.h:307
bool operator()(const Arg &a, const Arg &b)
Definition: PeptideHit.h:143
bool higher_is_better
Definition: PeptideHit.h:193
bool operator()(const Arg &a, const Arg &b)
Definition: PeptideHit.h:167
String annotation
Definition: PeptideHit.h:79
String score_type
Definition: PeptideHit.h:192
bool operator==(const PeptideHit::PeakAnnotation &other) const
Definition: PeptideHit.h:126
Representation of a peptide hit.
Definition: PeptideHit.h:55
Representation of a peptide evidence.
Definition: PeptideEvidence.h:51
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:56
Int charge_
the charge of the peptide
Definition: PeptideHit.h:313
bool operator==(const PepXMLAnalysisResult &rhs) const
additional scores attached to the original, aggregated score
Definition: PeptideHit.h:197
double intensity
Definition: PeptideHit.h:82
Analysis Result (containing search engine / prophet results)
Definition: PeptideHit.h:189
bool operator!=(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:824
Lesser predicate for scores of hits.
Definition: PeptideHit.h:151
bool operator()(const Arg &a, const Arg &b)
Definition: PeptideHit.h:180
int charge
Definition: PeptideHit.h:80
double score_
the score of the peptide hit
Definition: PeptideHit.h:304
Contains annotations of a peak.
Definition: PeptideHit.h:77
int Int
Signed integer type.
Definition: Types.h:103
bool operator()(const Arg &a, const Arg &b)
Definition: PeptideHit.h:155
AASequence sequence_
Definition: PeptideHit.h:301
PepXMLAnalysisResult & operator=(const PepXMLAnalysisResult &source)
Definition: PeptideHit.h:205
std::vector< PeptideEvidence > peptide_evidences_
information on the potential peptides observed through this PSM.
Definition: PeptideHit.h:316

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:03 using doxygen 1.8.13