OpenMS  2.7.0
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-2021.
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 
118  double getSignificanceThreshold() const;
120  void setSignificanceThreshold(double value);
121 
123  const String& getScoreType() const;
125  void setScoreType(const String& type);
126 
128  bool isHigherScoreBetter() const;
130  void setHigherScoreBetter(bool value);
131 
133  const String& getIdentifier() const;
135  void setIdentifier(const String& id);
136 
138  const String& getBaseName() const;
140  void setBaseName(const String& base_name);
141 
143  const String getExperimentLabel() const;
145  void setExperimentLabel(const String& type);
146 
148  void assignRanks();
149 
155  void sort();
156 
162  void sortByRank();
163 
165  bool empty() const;
166 
168  static std::vector<PeptideHit> getReferencingHits(const std::vector<PeptideHit>&, const std::set<String>& accession);
169 
178  static std::multimap<String, std::pair<Size, Size>> buildUIDsFromAllPepIDs(const ConsensusMap &cmap);
179 
198  static String buildUIDFromPepID(const PeptideIdentification& pep_id,
199  const std::map<String, StringList>& fidentifier_to_msrunpath);
200 
201 protected:
202 
203  String id_;
204  std::vector<PeptideHit> hits_;
205  double significance_threshold_;
206  String score_type_;
207  bool higher_score_better_;
208  // hint: here is an alignment gap of 7 bytes <-- here --> use it when introducing new members with sizeof(m)<=4
209  String base_name_;
210  double mz_;
211  double rt_;
212 
213  };
214 
215 } //namespace OpenMS
A container for consensus elements.
Definition: ConsensusMap.h:88
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:61
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:47