OpenMS
PeptideIdentification.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
14 
15 
16 #include <string>
17 #include <map>
18 
19 namespace OpenMS
20 {
21  class ConsensusMap;
22  class PeptideIdentification;
23 
24  using SpectrumIdentification = PeptideIdentification; // better name that might become the default in future version
25 
61  class OPENMS_DLLAPI PeptideIdentification :
62  public MetaInfoInterface
63  {
64 public:
65 
68 
70 
74  virtual ~PeptideIdentification() noexcept;
79 
81  PeptideIdentification& operator=(const PeptideIdentification&) = default;
83  PeptideIdentification& operator=(PeptideIdentification&&) = default; // TODO: add noexcept (gcc 4.8 bug)
85  bool operator==(const PeptideIdentification& rhs) const;
87  bool operator!=(const PeptideIdentification& rhs) const;
89 
91  double getRT() const;
93  void setRT(double rt);
95  bool hasRT() const;
96 
98  double getMZ() const;
100  void setMZ(double mz);
102  bool hasMZ() const;
103 
105  const std::vector<PeptideHit>& getHits() const;
107  std::vector<PeptideHit>& getHits();
109  void insertHit(const PeptideHit& hit);
111  void insertHit(PeptideHit&& hit);
113  void setHits(const std::vector<PeptideHit>& hits);
114  void setHits(std::vector<PeptideHit>&& hits);
115 
117  double getSignificanceThreshold() const;
119  void setSignificanceThreshold(double value);
120 
122  const String& getScoreType() const;
124  void setScoreType(const String& type);
125 
127  bool isHigherScoreBetter() const;
129  void setHigherScoreBetter(bool value);
130 
132  const String& getIdentifier() const;
134  void setIdentifier(const String& id);
135 
137  String getBaseName() const;
139  void setBaseName(const String& base_name);
140 
142  const String getExperimentLabel() const;
144  void setExperimentLabel(const String& type);
145 
148  // TODO make a mandatory data member, add to idXML schema, think about storing the
149  // extracted spectrum "number" only!
150  String getSpectrumReference() const;
153  void setSpectrumReference(const String& ref);
154 
156  void assignRanks();
157 
158  // Returns a higher or lower comparator based on @p higher_score_better_
159  static std::function<bool(const PeptideHit&, const PeptideHit&)> getScoreComparator(bool higher_score_better);
160 
166  void sort();
167 
173  void sortByRank();
174 
176  bool empty() const;
177 
179  static std::vector<PeptideHit> getReferencingHits(const std::vector<PeptideHit>&, const std::set<String>& accession);
180 
189  static std::multimap<String, std::pair<Size, Size>> buildUIDsFromAllPepIDs(const ConsensusMap &cmap);
190 
209  static String buildUIDFromPepID(const PeptideIdentification& pep_id,
210  const std::map<String, StringList>& identifier_to_msrunpath);
211 
212 protected:
213  String id_;
214  std::vector<PeptideHit> hits_;
215  String score_type_;
216  bool higher_score_better_;
217  double mz_;
218  double rt_;
219  };
220 
221 } //namespace OpenMS
A container for consensus elements.
Definition: ConsensusMap.h:66
Definition: MzIdentMLHandler.h:134
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:35
Represents a single spectrum match (candidate) for a specific tandem mass spectrum (MS/MS).
Definition: PeptideHit.h:49
Represents the set of candidates (SpectrumMatches) identified for a single precursor spectrum.
Definition: PeptideIdentification.h:63
PeptideHit HitType
Hit type definition.
Definition: PeptideIdentification.h:67
virtual ~PeptideIdentification() noexcept
destructor
A more convenient string class.
Definition: String.h:34
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:44
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19