OpenMS  3.0.0
FeatureMap.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-2022.
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: Chris Bielow $
32 // $Authors: Marc Sturm, Chris Bielow, Clemens Groepl $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 #include <OpenMS/KERNEL/Feature.h>
40 
45 
46 #include <OpenMS/CONCEPT/Types.h>
51 
53 #include <OpenMS/OpenMSConfig.h>
54 
55 #include <exception>
56 
57 namespace OpenMS
58 {
59  class ProteinIdentification;
60  class PeptideIdentification;
61  class DataProcessing;
62 
65  struct OPENMS_DLLAPI AnnotationStatistics
66  {
67  std::vector<Size> states;
68 
70 
72 
73  AnnotationStatistics& operator=(const AnnotationStatistics& rhs);
74 
75  bool operator==(const AnnotationStatistics& rhs) const;
76 
78  };
79 
80 
82  OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const AnnotationStatistics& ann);
83 
98  class OPENMS_DLLAPI FeatureMap :
99  public MetaInfoInterface,
100  public RangeManagerContainer<RangeRT, RangeMZ, RangeIntensity>,
101  public DocumentIdentifier,
102  public ExposedVector<Feature>,
103  public UniqueIdInterface,
104  public UniqueIdIndexer<FeatureMap>,
105  public MapUtilities<FeatureMap>
106  {
107  public:
109 
110  //@{
118 
123 
125  FeatureMap();
126 
128  FeatureMap(const FeatureMap& source);
129 
131  FeatureMap(FeatureMap&& source);
132 
134  FeatureMap& operator=(const FeatureMap& rhs);
135 
137  //FeatureMap& FeatureMap::operator=(FeatureMap&&);
138 
140  ~FeatureMap() override;
142 
144  bool operator==(const FeatureMap& rhs) const;
145 
147  bool operator!=(const FeatureMap& rhs) const;
148 
154  FeatureMap operator+(const FeatureMap& rhs) const;
155 
168  FeatureMap& operator+=(const FeatureMap& rhs);
169 
176  void sortByIntensity(bool reverse = false);
178 
180  void sortByPosition();
181 
183  void sortByRT();
184 
186  void sortByMZ();
187 
189  void sortByOverallQuality(bool reverse = false);
190 
192 
193  // Docu in base class
194  void updateRanges() override;
195 
197  void swapFeaturesOnly(FeatureMap& from);
198 
199  void swap(FeatureMap& from);
200 
204  const std::vector<ProteinIdentification>& getProteinIdentifications() const;
205 
207  std::vector<ProteinIdentification>& getProteinIdentifications();
208 
210  void setProteinIdentifications(const std::vector<ProteinIdentification>& protein_identifications);
211 
213  const std::vector<PeptideIdentification>& getUnassignedPeptideIdentifications() const;
214 
216  std::vector<PeptideIdentification>& getUnassignedPeptideIdentifications();
217 
219  void setUnassignedPeptideIdentifications(const std::vector<PeptideIdentification>& unassigned_peptide_identifications);
221 
223  const std::vector<DataProcessing>& getDataProcessing() const;
224 
226  std::vector<DataProcessing>& getDataProcessing();
227 
229  void setDataProcessing(const std::vector<DataProcessing>& processing_method);
230 
232  void setPrimaryMSRunPath(const StringList& s);
233 
236  void setPrimaryMSRunPath(const StringList& s, MSExperiment & e);
237 
239  void getPrimaryMSRunPath(StringList& toFill) const;
240 
246  void clear(bool clear_meta_data = true);
247 
260  template <typename Type>
261  Size applyMemberFunction(Size (Type::* member_function)())
262  {
263  Size assignments = 0;
264  assignments += ((*this).*member_function)();
265  for (Iterator iter = this->begin(); iter != this->end(); ++iter)
266  {
267  assignments += iter->applyMemberFunction(member_function);
268  }
269  return assignments;
270  }
271 
273  template <typename Type>
274  Size applyMemberFunction(Size (Type::* member_function)() const) const
275  {
276  Size assignments = 0;
277  assignments += ((*this).*member_function)();
278  for (ConstIterator iter = this->begin(); iter != this->end(); ++iter)
279  {
280  assignments += iter->applyMemberFunction(member_function);
281  }
282  return assignments;
283  }
284 
285  AnnotationStatistics getAnnotationStatistics() const;
286 
289 
296  std::set<IdentificationData::ObservationMatchRef> getUnassignedIDMatches() const;
297 
299  const IdentificationData& getIdentificationData() const;
300 
302  IdentificationData& getIdentificationData();
304 
305 protected:
307  std::vector<ProteinIdentification> protein_identifications_;
308 
310  std::vector<PeptideIdentification> unassigned_peptide_identifications_;
311 
313  std::vector<DataProcessing> data_processing_;
314 
317  };
318 
319  OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const FeatureMap& map);
320 
321 } // namespace OpenMS
Representation of a protein identification run.
Definition: ProteinIdentification.h:74
Description of the applied preprocessing steps.
Definition: DataProcessing.h:51
std::vector< Size > states
count each state, indexing by BaseFeature::AnnotationState
Definition: FeatureMap.h:67
typename VecMember::const_reverse_iterator const_reverse_iterator
Definition: ExposedVector.h:90
Size applyMemberFunction(Size(Type::*member_function)() const) const
The "const" variant.
Definition: FeatureMap.h:274
const_iterator ConstIterator
Definition: FeatureMap.h:114
A container for features.
Definition: FeatureMap.h:98
Definition: RangeManager.h:424
Definition: IdentificationData.h:112
STL namespace.
bool operator==(const IDBoostGraph::ProteinGroup &lhs, const IDBoostGraph::ProteinGroup &rhs)
Definition: RangeManager.h:365
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
#define EXPOSED_VECTOR_INTERFACE(InnerElement)
Macro to expose common dependent types, such as iterator in the derived class.
Definition: ExposedVector.h:45
Utilities for Feature and ConsensusMap.
Definition: MapUtilities.h:49
typename VecMember::const_iterator const_iterator
Definition: ExposedVector.h:88
const_reverse_iterator ConstReverseIterator
Definition: FeatureMap.h:116
std::vector< ProteinIdentification > protein_identifications_
protein identifications
Definition: FeatureMap.h:307
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
A base class for containers with elements derived from UniqueIdInterface. This adds functionality to ...
Definition: UniqueIdIndexer.h:66
iterator Iterator
Definition: FeatureMap.h:113
static String & reverse(String &this_s)
Definition: StringUtilsSimple.h:355
IdentificationData id_data_
general identification results (peptides/proteins, RNA, compounds)
Definition: FeatureMap.h:316
An LC-MS feature.
Definition: Feature.h:70
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:60
typename VecMember::iterator iterator
Definition: ExposedVector.h:87
std::vector< PeptideIdentification > unassigned_peptide_identifications_
peptide identifications not matched to a specific feature
Definition: FeatureMap.h:310
A base class defining a common interface for all classes having a unique id.
Definition: UniqueIdInterface.h:50
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:70
std::vector< DataProcessing > data_processing_
applied data processing
Definition: FeatureMap.h:313
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
AnnotationState
state of identification, use getAnnotationState() to query it
Definition: BaseFeature.h:71
typename VecMember::reverse_iterator reverse_iterator
Definition: ExposedVector.h:89
Definition: FeatureMap.h:65
Handles the management of a multidimensional range, e.g. RangeMZ and RangeIntensity for spectra...
Definition: RangeManager.h:565
Definition: RangeManager.h:896
Makes a vector<VectorElement> available in the derived class and exposed commonly used vector member ...
Definition: ExposedVector.h:80
reverse_iterator ReverseIterator
Definition: FeatureMap.h:115
Definition: RangeManager.h:306
Manage source document information.
Definition: DocumentIdentifier.h:55
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:63