| OpenMS 2.5.0

MSChromatogram.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-2020.
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: Andreas Bertsch $
33 // --------------------------------------------------------------------------
34
35 #pragma once
36
37 #include <OpenMS/KERNEL/StandardDeclarations.h>
38 #include <OpenMS/METADATA/ChromatogramSettings.h>
39 #include <OpenMS/METADATA/MetaInfoDescription.h>
40 #include <OpenMS/KERNEL/RangeManager.h>
41 #include <OpenMS/KERNEL/ComparatorUtils.h>
42 #include <OpenMS/KERNEL/ChromatogramPeak.h>
43 #include <OpenMS/METADATA/DataArrays.h>
44
45 namespace OpenMS
46 {
47 class ChromatogramPeak;
48
54 class OPENMS_DLLAPI MSChromatogram :
55 private std::vector<ChromatogramPeak>,
56 public RangeManager<1>,
57 public ChromatogramSettings
58 {
59
60 public:
61
63 struct OPENMS_DLLAPI MZLess :
64 public std::binary_function<MSChromatogram, MSChromatogram, bool>
65 {
66 bool operator()(const MSChromatogram& a, const MSChromatogram& b) const;
67 };
68
72 typedef ChromatogramPeak PeakType;
74 typedef typename PeakType::CoordinateType CoordinateType;
76 typedef std::vector<PeakType> ContainerType;
78 typedef OpenMS::DataArrays::FloatDataArray FloatDataArray ;
79 typedef std::vector<FloatDataArray> FloatDataArrays;
81 typedef OpenMS::DataArrays::StringDataArray StringDataArray ;
82 typedef std::vector<StringDataArray> StringDataArrays;
84 typedef OpenMS::DataArrays::IntegerDataArray IntegerDataArray ;
85 typedef std::vector<IntegerDataArray> IntegerDataArrays;
87
89
90 typedef typename ContainerType::iterator Iterator;
93 typedef typename ContainerType::const_iterator ConstIterator;
95 typedef typename ContainerType::reverse_iterator ReverseIterator;
97 typedef typename ContainerType::const_reverse_iterator ConstReverseIterator;
99
101
102 using ContainerType::operator[];
103 using ContainerType::begin;
104 using ContainerType::rbegin;
105 using ContainerType::end;
106 using ContainerType::rend;
107 using ContainerType::resize;
108 using ContainerType::size;
109 using ContainerType::push_back;
110 using ContainerType::pop_back;
111 using ContainerType::empty;
112 using ContainerType::front;
113 using ContainerType::back;
114 using ContainerType::reserve;
115 using ContainerType::insert;
116 using ContainerType::erase;
117 using ContainerType::swap;
118
119 using typename ContainerType::iterator;
120 using typename ContainerType::const_iterator;
121 using typename ContainerType::size_type;
122 using typename ContainerType::value_type;
123 using typename ContainerType::reference;
124 using typename ContainerType::const_reference;
125 using typename ContainerType::pointer;
126 using typename ContainerType::difference_type;
128
130 MSChromatogram() = default;
131
133 MSChromatogram(const MSChromatogram&) = default;
134
136 MSChromatogram(MSChromatogram&&) = default;
137
139 ~MSChromatogram() override
140 {}
141
143 MSChromatogram& operator=(const MSChromatogram& source);
144
146 MSChromatogram& operator=(MSChromatogram&&) & = default;
147
149 bool operator==(const MSChromatogram& rhs) const;
150
152 bool operator!=(const MSChromatogram& rhs) const
153 {
154 return !(operator==(rhs));
155 }
156
157 // Docu in base class (RangeManager)
158 void updateRanges() override
159 {
160 this->clearRanges();
161 updateRanges_(ContainerType::begin(), ContainerType::end());
162 }
163
167 const String& getName() const;
168
170 void setName(const String& name);
171
173
175 double getMZ() const;
176
189 const FloatDataArrays& getFloatDataArrays() const;
192
194 FloatDataArrays& getFloatDataArrays();
195
197 void setFloatDataArrays(const FloatDataArrays& fda)
198 {
199 float_data_arrays_ = fda;
200 }
201
203 const StringDataArrays& getStringDataArrays() const;
204
206 StringDataArrays& getStringDataArrays();
207
209 void setStringDataArrays(const StringDataArrays& sda)
210 {
211 string_data_arrays_ = sda;
212 }
213
215 const IntegerDataArrays& getIntegerDataArrays() const;
216
218 IntegerDataArrays& getIntegerDataArrays();
219
221 void setIntegerDataArrays(const IntegerDataArrays& ida)
222 {
223 integer_data_arrays_ = ida;
224 }
225
227
230
235 void sortByIntensity(bool reverse = false);
236
243 void sortByPosition();
244
246 bool isSorted() const;
247
249
252
262 Size findNearest(CoordinateType rt) const;
263
270 Iterator RTBegin(CoordinateType rt);
271
278 Iterator RTBegin(Iterator begin, CoordinateType rt, Iterator end);
279
286 Iterator RTEnd(CoordinateType rt);
287
294 Iterator RTEnd(Iterator begin, CoordinateType rt, Iterator end);
295
302 ConstIterator RTBegin(CoordinateType rt) const;
303
310 ConstIterator RTBegin(ConstIterator begin, CoordinateType rt, ConstIterator end) const;
311
318 ConstIterator RTEnd(CoordinateType rt) const;
319
320 ConstIterator MZEnd(CoordinateType rt) const;
321
328 ConstIterator RTEnd(ConstIterator begin, CoordinateType rt, ConstIterator end) const;
329
338 Iterator PosBegin(CoordinateType rt);
339
348 Iterator PosBegin(Iterator begin, CoordinateType rt, Iterator end);
349
358 ConstIterator PosBegin(CoordinateType rt) const;
359
368 ConstIterator PosBegin(ConstIterator begin, CoordinateType rt, ConstIterator end) const;
369
378 Iterator PosEnd(CoordinateType rt);
379
388 Iterator PosEnd(Iterator begin, CoordinateType rt, Iterator end);
389
398 ConstIterator PosEnd(CoordinateType rt) const;
399
408 ConstIterator PosEnd(ConstIterator begin, CoordinateType rt, ConstIterator end) const;
409
415 void clear(bool clear_meta_data);
416
418
419 protected:
420
422 String name_;
423
425 FloatDataArrays float_data_arrays_;
426
428 StringDataArrays string_data_arrays_;
429
431 IntegerDataArrays integer_data_arrays_;
432 };
433
435 OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const MSChromatogram& chrom);
436
437 } // namespace OpenMS
438
OpenMS::MSChromatogram::PeakType
ChromatogramPeak PeakType
Definition: MSChromatogram.h:72
OpenMS::MSChromatogram::name_
String name_
Name.
Definition: MSChromatogram.h:422
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::MSChromatogram::Iterator
ContainerType::iterator Iterator
Mutable iterator.
Definition: MSChromatogram.h:91
OpenMS::ChromatogramPeak
A 1-dimensional raw data point or peak for chromatograms.
Definition: ChromatogramPeak.h:54
OpenMS::MSChromatogram
The representation of a chromatogram.
Definition: MSChromatogram.h:54
OpenMS::RangeManager
Handles the management of a position and intensity range.
Definition: RangeManager.h:47
OpenMS::MSChromatogram::setStringDataArrays
void setStringDataArrays(const StringDataArrays &sda)
Sets the string meta data arrays.
Definition: MSChromatogram.h:209
StandardDeclarations.h
OpenMS::MSChromatogram::FloatDataArrays
std::vector< FloatDataArray > FloatDataArrays
Definition: MSChromatogram.h:79
OpenMS::MSChromatogram::ConstIterator
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSChromatogram.h:93
OpenMS::DataArrays::FloatDataArray
Float data array class.
Definition: DataArrays.h:45
DataArrays.h
OpenMS::ChromatogramSettings
Representation of chromatogram settings, e.g. SRM/MRM chromatograms.
Definition: ChromatogramSettings.h:59
OpenMS::MSChromatogram::CoordinateType
PeakType::CoordinateType CoordinateType
Coordinate (RT) type.
Definition: MSChromatogram.h:74
Iterator
OpenMS::MSChromatogram::MZLess
Comparator for the retention time.
Definition: MSChromatogram.h:63
OpenMS::MSChromatogram::operator!=
bool operator!=(const MSChromatogram &rhs) const
Equality operator.
Definition: MSChromatogram.h:152
OpenMS::DataArrays::StringDataArray
String data array class.
Definition: DataArrays.h:59
OpenMS::MSChromatogram::~MSChromatogram
~MSChromatogram() override
Destructor.
Definition: MSChromatogram.h:139
OpenMS::MSChromatogram::float_data_arrays_
FloatDataArrays float_data_arrays_
Float data arrays.
Definition: MSChromatogram.h:425
OpenMS::MSChromatogram::setIntegerDataArrays
void setIntegerDataArrays(const IntegerDataArrays &ida)
Sets the integer meta data arrays.
Definition: MSChromatogram.h:221
OpenMS::operator<<
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::MSChromatogram::integer_data_arrays_
IntegerDataArrays integer_data_arrays_
Integer data arrays.
Definition: MSChromatogram.h:431
OpenMS::DataArrays::IntegerDataArray
Integer data array class.
Definition: DataArrays.h:52
OpenMS::MSChromatogram::IntegerDataArray
OpenMS::DataArrays::IntegerDataArray IntegerDataArray
Integer data array vector type.
Definition: MSChromatogram.h:84
OpenMS::MSChromatogram::IntegerDataArrays
std::vector< IntegerDataArray > IntegerDataArrays
Definition: MSChromatogram.h:85
RangeManager.h
OpenMS::MSChromatogram::updateRanges
void updateRanges() override
Updates minimum and maximum position/intensity.
Definition: MSChromatogram.h:158
double
OpenMS::MSChromatogram::StringDataArrays
std::vector< StringDataArray > StringDataArrays
Definition: MSChromatogram.h:82
ComparatorUtils.h
ChromatogramSettings.h
OpenMS::MSChromatogram::StringDataArray
OpenMS::DataArrays::StringDataArray StringDataArray
String data array vector type.
Definition: MSChromatogram.h:81
OpenMS::MSChromatogram::ReverseIterator
ContainerType::reverse_iterator ReverseIterator
Mutable reverse iterator.
Definition: MSChromatogram.h:95
MetaInfoDescription.h
OpenMS::MSChromatogram::ContainerType
std::vector< PeakType > ContainerType
Chromatogram base type.
Definition: MSChromatogram.h:76
OpenMS::MSChromatogram::ConstReverseIterator
ContainerType::const_reverse_iterator ConstReverseIterator
Non-mutable reverse iterator.
Definition: MSChromatogram.h:97
OpenMS::MSChromatogram::string_data_arrays_
StringDataArrays string_data_arrays_
String data arrays.
Definition: MSChromatogram.h:428
OpenMS::MSChromatogram::FloatDataArray
OpenMS::DataArrays::FloatDataArray FloatDataArray
Float data array vector type.
Definition: MSChromatogram.h:78
ChromatogramPeak.h
OpenMS::Size
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
OpenMS::MSChromatogram::setFloatDataArrays
void setFloatDataArrays(const FloatDataArrays &fda)
Sets the float meta data arrays.
Definition: MSChromatogram.h:197
KDTree::operator==
bool operator==(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:806