OpenMS
PeptideIdentification.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-2023.
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 #pragma once
36 
40 
41 
42 #include <string>
43 #include <map>
44 
45 namespace OpenMS
46 {
47  class ConsensusMap;
63  class OPENMS_DLLAPI PeptideIdentification :
64  public MetaInfoInterface
65  {
66 public:
67 
70 
72 
76  virtual ~PeptideIdentification() noexcept;
81 
83  PeptideIdentification& operator=(const PeptideIdentification&) = default;
85  PeptideIdentification& operator=(PeptideIdentification&&) = default; // TODO: add noexcept (gcc 4.8 bug)
87  bool operator==(const PeptideIdentification& rhs) const;
89  bool operator!=(const PeptideIdentification& rhs) const;
91 
93  double getRT() const;
95  void setRT(double rt);
97  bool hasRT() const;
98 
100  double getMZ() const;
102  void setMZ(double mz);
104  bool hasMZ() const;
105 
107  const std::vector<PeptideHit>& getHits() const;
109  std::vector<PeptideHit>& getHits();
111  void insertHit(const PeptideHit& hit);
113  void insertHit(PeptideHit&& hit);
115  void setHits(const std::vector<PeptideHit>& hits);
116  void setHits(std::vector<PeptideHit>&& hits);
117 
119  double getSignificanceThreshold() const;
121  void setSignificanceThreshold(double value);
122 
124  const String& getScoreType() const;
126  void setScoreType(const String& type);
127 
129  bool isHigherScoreBetter() const;
131  void setHigherScoreBetter(bool value);
132 
134  const String& getIdentifier() const;
136  void setIdentifier(const String& id);
137 
139  const String& getBaseName() const;
141  void setBaseName(const String& base_name);
142 
144  const String getExperimentLabel() const;
146  void setExperimentLabel(const String& type);
147 
149  void assignRanks();
150 
156  void sort();
157 
163  void sortByRank();
164 
166  bool empty() const;
167 
169  static std::vector<PeptideHit> getReferencingHits(const std::vector<PeptideHit>&, const std::set<String>& accession);
170 
179  static std::multimap<String, std::pair<Size, Size>> buildUIDsFromAllPepIDs(const ConsensusMap &cmap);
180 
199  static String buildUIDFromPepID(const PeptideIdentification& pep_id,
200  const std::map<String, StringList>& fidentifier_to_msrunpath);
201 
202 protected:
203 
204  String id_;
205  std::vector<PeptideHit> hits_;
206  double significance_threshold_;
207  String score_type_;
208  bool higher_score_better_;
209  // hint: here is an alignment gap of 7 bytes <-- here --> use it when introducing new members with sizeof(m)<=4
210  String base_name_;
211  double mz_;
212  double rt_;
213 
214  };
215 
216 } //namespace OpenMS
A container for consensus elements.
Definition: ConsensusMap.h:92
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:61
Representation of a peptide hit.
Definition: PeptideHit.h:57
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:65
PeptideHit HitType
Hit type definition.
Definition: PeptideIdentification.h:69
virtual ~PeptideIdentification() noexcept
destructor
A more convenient string class.
Definition: String.h:60
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48