All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
FeatureMap.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: Chris Bielow $
6 // $Authors: Marc Sturm, Chris Bielow, Clemens Groepl $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <OpenMS/KERNEL/Feature.h>
14 
21 
22 #include <OpenMS/CONCEPT/Types.h>
27 
29 #include <OpenMS/OpenMSConfig.h>
30 
31 #include <exception>
32 
33 namespace OpenMS
34 {
35  class ProteinIdentification;
36  class PeptideIdentification;
37  class DataProcessing;
38 
41  struct OPENMS_DLLAPI AnnotationStatistics
42  {
43  std::vector<Size> states;
44 
46 
48 
50 
51  bool operator==(const AnnotationStatistics& rhs) const;
52 
54  };
55 
56 
58  OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const AnnotationStatistics& ann);
59 
74  class OPENMS_DLLAPI FeatureMap :
75  public MetaInfoInterface,
76  public RangeManagerContainer<RangeRT, RangeMZ, RangeIntensity>,
77  public DocumentIdentifier,
78  public ExposedVector<Feature>,
79  public UniqueIdInterface,
80  public UniqueIdIndexer<FeatureMap>,
81  public MapUtilities<FeatureMap>
82  {
83  public:
85 
86  //@{
89  typedef iterator Iterator;
94 
99 
102 
104  FeatureMap(const FeatureMap& source);
105 
108 
110  FeatureMap& operator=(const FeatureMap& rhs);
111 
113  //FeatureMap& FeatureMap::operator=(FeatureMap&&);
114 
116  ~FeatureMap() override;
118 
120  bool operator==(const FeatureMap& rhs) const;
121 
123  bool operator!=(const FeatureMap& rhs) const;
124 
130  FeatureMap operator+(const FeatureMap& rhs) const;
131 
144  FeatureMap& operator+=(const FeatureMap& rhs);
145 
153  void sortByIntensity(bool reverse = false);
154 
156  void sortByPosition();
157 
159  void sortByRT();
160 
162  void sortByMZ();
163 
165  void sortByOverallQuality(bool reverse = false);
166 
168 
169  // Docu in base class
170  void updateRanges() override;
171 
173  void swapFeaturesOnly(FeatureMap& from);
174 
175  void swap(FeatureMap& from);
176 
180  const std::vector<ProteinIdentification>& getProteinIdentifications() const;
181 
183  std::vector<ProteinIdentification>& getProteinIdentifications();
184 
186  void setProteinIdentifications(const std::vector<ProteinIdentification>& protein_identifications);
187 
189  const PeptideIdentificationList& getUnassignedPeptideIdentifications() const;
190 
192  PeptideIdentificationList& getUnassignedPeptideIdentifications();
193 
195  void setUnassignedPeptideIdentifications(const PeptideIdentificationList& unassigned_peptide_identifications);
197 
199  const std::vector<DataProcessing>& getDataProcessing() const;
200 
202  std::vector<DataProcessing>& getDataProcessing();
203 
205  void setDataProcessing(const std::vector<DataProcessing>& processing_method);
206 
208  void setPrimaryMSRunPath(const StringList& s);
209 
212  void setPrimaryMSRunPath(const StringList& s, MSExperiment& e);
213 
215  void getPrimaryMSRunPath(StringList& toFill) const;
216 
222  void clear(bool clear_meta_data = true);
223 
236  template <typename Type>
237  Size applyMemberFunction(Size (Type::* member_function)())
238  {
239  Size assignments = 0;
240  assignments += ((*this).*member_function)();
241  for (Iterator iter = this->begin(); iter != this->end(); ++iter)
242  {
243  assignments += iter->applyMemberFunction(member_function);
244  }
245  return assignments;
246  }
247 
249  template <typename Type>
250  Size applyMemberFunction(Size (Type::* member_function)() const) const
251  {
252  Size assignments = 0;
253  assignments += ((*this).*member_function)();
254  for (ConstIterator iter = this->begin(); iter != this->end(); ++iter)
255  {
256  assignments += iter->applyMemberFunction(member_function);
257  }
258  return assignments;
259  }
260 
262 
265 
272  std::set<IdentificationData::ObservationMatchRef> getUnassignedIDMatches() const;
273 
276 
280 
281 protected:
283  std::vector<ProteinIdentification> protein_identifications_;
284 
287 
289  std::vector<DataProcessing> data_processing_;
290 
293  };
294 
295  OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const FeatureMap& map);
296 
297 } // namespace OpenMS
#define EXPOSED_VECTOR_INTERFACE(InnerElement)
Macro to expose common dependent types, such as iterator in the derived class.
Definition: ExposedVector.h:26
AnnotationState
state of identification, use getAnnotationState() to query it
Definition: BaseFeature.h:47
Description of the applied preprocessing steps.
Definition: DataProcessing.h:27
Manage source document information.
Definition: DocumentIdentifier.h:30
Definition: ExposedVector.h:62
typename VecMember::iterator iterator
Definition: ExposedVector.h:68
typename VecMember::const_iterator const_iterator
Definition: ExposedVector.h:69
typename VecMember::reverse_iterator reverse_iterator
Definition: ExposedVector.h:70
typename VecMember::const_reverse_iterator const_reverse_iterator
Definition: ExposedVector.h:71
A container for features.
Definition: FeatureMap.h:82
const_reverse_iterator ConstReverseIterator
Definition: FeatureMap.h:92
reverse_iterator ReverseIterator
Definition: FeatureMap.h:91
std::vector< DataProcessing > data_processing_
applied data processing
Definition: FeatureMap.h:289
IdentificationData & getIdentificationData()
Mutable access to the contained identification data.
const_iterator ConstIterator
Definition: FeatureMap.h:90
IdentificationData id_data_
general identification results (peptides/proteins, RNA, compounds)
Definition: FeatureMap.h:292
AnnotationStatistics getAnnotationStatistics() const
const IdentificationData & getIdentificationData() const
Immutable access to the contained identification data.
std::vector< ProteinIdentification > protein_identifications_
protein identifications
Definition: FeatureMap.h:283
std::set< IdentificationData::ObservationMatchRef > getUnassignedIDMatches() const
Return observation matches (e.g. PSMs) from the identification data that are not assigned to any feat...
PeptideIdentificationList unassigned_peptide_identifications_
peptide identifications not matched to a specific feature
Definition: FeatureMap.h:286
Size applyMemberFunction(Size(Type::*member_function)() const) const
The "const" variant.
Definition: FeatureMap.h:250
An LC-MS feature.
Definition: Feature.h:46
Definition: IdentificationData.h:87
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:49
Utilities for Feature and ConsensusMap.
Definition: MapUtilities.h:25
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:35
Container for peptide identifications from multiple spectra.
Definition: PeptideIdentificationList.h:66
Representation of a protein identification run.
Definition: ProteinIdentification.h:51
Definition: RangeManager.h:889
Handles the management of a multidimensional range, e.g. RangeMZ and RangeIntensity for spectra.
Definition: RangeManager.h:568
A base class for containers with elements derived from UniqueIdInterface. This adds functionality to ...
Definition: UniqueIdIndexer.h:41
A base class defining a common interface for all classes having a unique id.
Definition: UniqueIdInterface.h:25
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
static String & reverse(String &this_s)
Definition: StringUtilsSimple.h:330
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
Definition: FeatureMap.h:42
AnnotationStatistics(const AnnotationStatistics &rhs)
std::vector< Size > states
count each state, indexing by BaseFeature::AnnotationState
Definition: FeatureMap.h:43
AnnotationStatistics & operator+=(BaseFeature::AnnotationState state)
AnnotationStatistics & operator=(const AnnotationStatistics &rhs)
bool operator==(const AnnotationStatistics &rhs) const
Definition: RangeManager.h:420
Definition: RangeManager.h:358
Definition: RangeManager.h:295