Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
ConsensusMap.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-2017.
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 #ifndef OPENMS_KERNEL_CONSENSUSMAP_H
36 #define OPENMS_KERNEL_CONSENSUSMAP_H
37 
44 
45 #include <OpenMS/CONCEPT/Types.h>
47 #include <OpenMS/OpenMSConfig.h>
48 
49 #include <map>
50 #include <vector>
51 
52 namespace OpenMS
53 {
54  class ProteinIdentification;
55  class DataProcessing;
56  namespace Logger
57  {
58  class LogStream;
59  }
60 
72  class ConsensusMap : // no OPENMS_DLLAPI here, since the class is derived from an STL class - we do not want parts of the STL lib in OpenMS.lib, since it will cause linker errors
73  private std::vector<ConsensusFeature>,
74  public MetaInfoInterface,
75  public RangeManager<2>,
76  public DocumentIdentifier,
77  public UniqueIdInterface,
78  public UniqueIdIndexer<ConsensusMap>
79  {
80 
81 public:
82  typedef std::vector<ConsensusFeature> privvec;
83 
84  // types
85  using privvec::value_type;
86  using privvec::iterator;
87  using privvec::const_iterator;
88  using privvec::size_type;
89  using privvec::pointer; // ConstRefVector
90  using privvec::reference; // ConstRefVector
91  using privvec::const_reference; // ConstRefVector
92  using privvec::difference_type; // ConstRefVector
93 
94  // functions
95  using privvec::begin;
96  using privvec::end;
97 
98  using privvec::size;
99  using privvec::resize;
100  using privvec::empty;
101  using privvec::reserve;
102  using privvec::operator[];
103  using privvec::at; // UniqueIdIndexer
104  using privvec::back; // source/ANALYSIS/DECHARGING/FeatureDeconvolution.cpp:977:
105 
106  using privvec::push_back;
107 
109  struct OPENMS_DLLAPI FileDescription :
110  public MetaInfoInterface
111  {
113  FileDescription();
114 
116  FileDescription(const FileDescription&);
117 
127  };
128 
130 
131  typedef std::vector<ConsensusFeature> Base;
133  typedef std::map<UInt64, FileDescription> FileDescriptions;
135  typedef std::vector<ConsensusFeature>::iterator Iterator;
137  typedef std::vector<ConsensusFeature>::const_iterator ConstIterator;
139  typedef std::vector<ConsensusFeature>::reverse_iterator ReverseIterator;
141  typedef std::vector<ConsensusFeature>::const_reverse_iterator ConstReverseIterator;
143 
145  OPENMS_DLLAPI ConsensusMap();
146 
148  OPENMS_DLLAPI ConsensusMap(const ConsensusMap& source);
149 
151  OPENMS_DLLAPI ~ConsensusMap();
152 
154  OPENMS_DLLAPI explicit ConsensusMap(Base::size_type n);
155 
157  OPENMS_DLLAPI ConsensusMap& operator=(const ConsensusMap& source);
158 
168  OPENMS_DLLAPI ConsensusMap& operator+=(const ConsensusMap& rhs);
169 
175  OPENMS_DLLAPI void clear(bool clear_meta_data = true);
176 
178  OPENMS_DLLAPI const FileDescriptions& getFileDescriptions() const;
179 
181  OPENMS_DLLAPI FileDescriptions& getFileDescriptions();
182 
184  OPENMS_DLLAPI void setFileDescriptions(const FileDescriptions& file_description);
185 
187  OPENMS_DLLAPI const String& getExperimentType() const;
188 
190  OPENMS_DLLAPI void setExperimentType(const String& experiment_type);
191 
199  OPENMS_DLLAPI void sortByIntensity(bool reverse = false);
201 
203  OPENMS_DLLAPI void sortByRT();
204 
206  OPENMS_DLLAPI void sortByMZ();
207 
209  OPENMS_DLLAPI void sortByPosition();
210 
212  OPENMS_DLLAPI void sortByQuality(bool reverse = false);
213 
215  OPENMS_DLLAPI void sortBySize();
216 
218  OPENMS_DLLAPI void sortByMaps();
219 
221  OPENMS_DLLAPI void sortPeptideIdentificationsByMapIndex();
223 
224  // Docu in base class
225  OPENMS_DLLAPI void updateRanges();
226 
228  OPENMS_DLLAPI void swap(ConsensusMap& from);
229 
231  OPENMS_DLLAPI const std::vector<ProteinIdentification>& getProteinIdentifications() const;
232 
234  OPENMS_DLLAPI std::vector<ProteinIdentification>& getProteinIdentifications();
235 
237  OPENMS_DLLAPI void setProteinIdentifications(const std::vector<ProteinIdentification>& protein_identifications);
238 
240  OPENMS_DLLAPI const std::vector<PeptideIdentification>& getUnassignedPeptideIdentifications() const;
241 
243  OPENMS_DLLAPI std::vector<PeptideIdentification>& getUnassignedPeptideIdentifications();
244 
246  OPENMS_DLLAPI void setUnassignedPeptideIdentifications(const std::vector<PeptideIdentification>& unassigned_peptide_identifications);
247 
249  OPENMS_DLLAPI const std::vector<DataProcessing>& getDataProcessing() const;
250 
252  OPENMS_DLLAPI std::vector<DataProcessing>& getDataProcessing();
253 
255  OPENMS_DLLAPI void setDataProcessing(const std::vector<DataProcessing>& processing_method);
256 
258  OPENMS_DLLAPI void setPrimaryMSRunPath(const StringList& s);
259 
262  OPENMS_DLLAPI void getPrimaryMSRunPath(StringList& toFill) const;
263 
265  OPENMS_DLLAPI bool operator==(const ConsensusMap& rhs) const;
266 
268  OPENMS_DLLAPI bool operator!=(const ConsensusMap& rhs) const;
269 
283  template <typename Type>
284  Size applyMemberFunction(Size (Type::* member_function)())
285  {
286  Size assignments = 0;
287  assignments += ((*this).*member_function)();
288  for (Iterator iter = this->begin(); iter != this->end(); ++iter)
289  {
290  assignments += ((*iter).*member_function)();
291  }
292  return assignments;
293  }
294 
296  template <typename Type>
297  Size applyMemberFunction(Size (Type::* member_function)() const) const
298  {
299  Size assignments = 0;
300  assignments += ((*this).*member_function)();
301  for (ConstIterator iter = this->begin(); iter != this->end(); ++iter)
302  {
303  assignments += ((*iter).*member_function)();
304  }
305  return assignments;
306  }
307 
320  bool isMapConsistent(Logger::LogStream* stream = 0) const;
321 
322 protected:
323 
325  FileDescriptions file_description_;
326 
329 
331  std::vector<ProteinIdentification> protein_identifications_;
332 
334  std::vector<PeptideIdentification> unassigned_peptide_identifications_;
335 
337  std::vector<DataProcessing> data_processing_;
338  };
339 
341  OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const ConsensusMap& cons_map);
342 
343 } // namespace OpenMS
344 
345 #endif // OPENMS_KERNEL_CONSENSUSMAP_H
std::vector< ConsensusFeature >::iterator Iterator
Mutable iterator.
Definition: ConsensusMap.h:135
A more convenient string class.
Definition: String.h:57
String label
Label e.g. &#39;heavy&#39; and &#39;light&#39; for ICAT, or &#39;sample1&#39; and &#39;sample2&#39; for label-free quantitation...
Definition: ConsensusMap.h:121
std::vector< ConsensusFeature >::const_reverse_iterator ConstReverseIterator
Non-mutable reverse iterator.
Definition: ConsensusMap.h:141
Source file description for input files.
Definition: ConsensusMap.h:109
std::vector< PeptideIdentification > unassigned_peptide_identifications_
protein identifications
Definition: ConsensusMap.h:334
UInt64 unique_id
Unique id of the file.
Definition: ConsensusMap.h:126
A container for consensus elements.
Definition: ConsensusMap.h:72
bool operator==(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:806
Size applyMemberFunction(Size(Type::*member_function)())
Applies a member function of Type to the container itself and all consensus features. The returned values are accumulated.
Definition: ConsensusMap.h:284
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
std::vector< DataProcessing > data_processing_
applied data processing
Definition: ConsensusMap.h:337
Log Stream Class.
Definition: LogStream.h:303
FileDescriptions file_description_
Map from index to file description.
Definition: ConsensusMap.h:325
std::vector< ConsensusFeature >::reverse_iterator ReverseIterator
Mutable reverse iterator.
Definition: ConsensusMap.h:139
String experiment_type_
type of experiment (label-free, itraq, ...); see xsd schema
Definition: ConsensusMap.h:328
std::vector< ConsensusFeature > Base
Definition: ConsensusMap.h:131
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
A base class for random access containers for classes derived from UniqueIdInterface that adds functi...
Definition: UniqueIdIndexer.h:64
RangeManager< 2 > RangeManagerType
Definition: ConsensusMap.h:132
OPENMS_UINT64_TYPE UInt64
Unsigned integer type (64bit)
Definition: Types.h:78
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:56
std::map< UInt64, FileDescription > FileDescriptions
Definition: ConsensusMap.h:133
A base class defining a common interface for all classes having a unique id.
Definition: UniqueIdInterface.h:52
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:74
std::vector< ProteinIdentification > protein_identifications_
protein identifications
Definition: ConsensusMap.h:331
bool operator!=(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:824
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
std::vector< ConsensusFeature > privvec
Definition: ConsensusMap.h:82
Size applyMemberFunction(Size(Type::*member_function)() const) const
The "const" variant.
Definition: ConsensusMap.h:297
Handles the management of a position and intensity range.
Definition: RangeManager.h:48
std::vector< ConsensusFeature >::const_iterator ConstIterator
Non-mutable iterator.
Definition: ConsensusMap.h:137
String filename
File name of the file.
Definition: ConsensusMap.h:119
Size size
Number of elements (features, peaks, ...). This is e.g. used to check for correct element indices whe...
Definition: ConsensusMap.h:124
Manage source document information.
Definition: DocumentIdentifier.h:56

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:21:59 using doxygen 1.8.13