Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
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-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: Andreas Bertsch $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_KERNEL_MSCHROMATOGRAM_H
36 #define OPENMS_KERNEL_MSCHROMATOGRAM_H
37 
45 
46 namespace OpenMS
47 {
48  class ChromatogramPeak;
49 
55  class OPENMS_DLLAPI MSChromatogram :
56  private std::vector<ChromatogramPeak>,
57  public RangeManager<1>,
59  {
60 
61 public:
62 
64  struct OPENMS_DLLAPI MZLess :
65  public std::binary_function<MSChromatogram, MSChromatogram, bool>
66  {
67  bool operator()(const MSChromatogram& a, const MSChromatogram& b) const;
68  };
69 
77  typedef std::vector<PeakType> ContainerType;
80  typedef std::vector<FloatDataArray> FloatDataArrays;
83  typedef std::vector<StringDataArray> StringDataArrays;
86  typedef std::vector<IntegerDataArray> IntegerDataArrays;
88 
90 
91  typedef typename ContainerType::iterator Iterator;
94  typedef typename ContainerType::const_iterator ConstIterator;
96  typedef typename ContainerType::reverse_iterator ReverseIterator;
98  typedef typename ContainerType::const_reverse_iterator ConstReverseIterator;
100 
102 
103  using ContainerType::operator[];
104  using ContainerType::begin;
105  using ContainerType::rbegin;
106  using ContainerType::end;
107  using ContainerType::rend;
108  using ContainerType::resize;
109  using ContainerType::size;
110  using ContainerType::push_back;
111  using ContainerType::pop_back;
112  using ContainerType::empty;
113  using ContainerType::front;
114  using ContainerType::back;
115  using ContainerType::reserve;
116  using ContainerType::insert;
117  using ContainerType::erase;
118  using ContainerType::swap;
119 
120  using typename ContainerType::iterator;
121  using typename ContainerType::const_iterator;
122  using typename ContainerType::size_type;
123  using typename ContainerType::value_type;
124  using typename ContainerType::reference;
125  using typename ContainerType::const_reference;
126  using typename ContainerType::pointer;
127  using typename ContainerType::difference_type;
129 
132  ContainerType(),
133  RangeManager<1>(),
135  name_(),
136  float_data_arrays_(),
137  string_data_arrays_(),
138  integer_data_arrays_()
139  {}
140 
143  ContainerType(source),
144  RangeManager<1>(source),
145  ChromatogramSettings(source),
146  name_(source.name_),
147  float_data_arrays_(source.float_data_arrays_),
148  string_data_arrays_(source.string_data_arrays_),
149  integer_data_arrays_(source.integer_data_arrays_)
150  {}
151 
153  virtual ~MSChromatogram()
154  {}
155 
157  MSChromatogram& operator=(const MSChromatogram& source);
158 
160  bool operator==(const MSChromatogram& rhs) const;
161 
163  bool operator!=(const MSChromatogram& rhs) const
164  {
165  return !(operator==(rhs));
166  }
167 
168  // Docu in base class (RangeManager)
169  virtual void updateRanges()
170  {
171  this->clearRanges();
172  updateRanges_(ContainerType::begin(), ContainerType::end());
173  }
174 
178  const String& getName() const;
179 
181  void setName(const String& name);
182 
184 
186  double getMZ() const;
187 
200  const FloatDataArrays& getFloatDataArrays() const;
203 
205  FloatDataArrays& getFloatDataArrays();
206 
208  void setFloatDataArrays(const FloatDataArrays& fda)
209  {
210  float_data_arrays_ = fda;
211  }
212 
214  const StringDataArrays& getStringDataArrays() const;
215 
217  StringDataArrays& getStringDataArrays();
218 
220  void setStringDataArrays(const StringDataArrays& sda)
221  {
222  string_data_arrays_ = sda;
223  }
224 
226  const IntegerDataArrays& getIntegerDataArrays() const;
227 
229  IntegerDataArrays& getIntegerDataArrays();
230 
232  void setIntegerDataArrays(const IntegerDataArrays& ida)
233  {
234  integer_data_arrays_ = ida;
235  }
236 
238 
241 
246  void sortByIntensity(bool reverse = false);
247 
254  void sortByPosition();
255 
257  bool isSorted() const;
258 
260 
263 
273  Size findNearest(CoordinateType rt) const;
274 
281  Iterator RTBegin(CoordinateType rt);
282 
289  Iterator RTBegin(Iterator begin, CoordinateType rt, Iterator end);
290 
297  Iterator RTEnd(CoordinateType rt);
298 
305  Iterator RTEnd(Iterator begin, CoordinateType rt, Iterator end);
306 
313  ConstIterator RTBegin(CoordinateType rt) const;
314 
321  ConstIterator RTBegin(ConstIterator begin, CoordinateType rt, ConstIterator end) const;
322 
329  ConstIterator RTEnd(CoordinateType rt) const;
330 
331  ConstIterator MZEnd(CoordinateType rt) const;
332 
339  ConstIterator RTEnd(ConstIterator begin, CoordinateType rt, ConstIterator end) const;
340 
346  void clear(bool clear_meta_data);
347 
349 
350 protected:
351 
354 
356  FloatDataArrays float_data_arrays_;
357 
359  StringDataArrays string_data_arrays_;
360 
362  IntegerDataArrays integer_data_arrays_;
363  };
364 
366  std::ostream& operator<<(std::ostream& os, const MSChromatogram& chrom);
367 
368 } // namespace OpenMS
369 
370 #endif // OPENMS_KERNEL_MSCHROMATOGRAM_H
FloatDataArrays float_data_arrays_
Float data arrays.
Definition: MSChromatogram.h:356
bool operator!=(const MSChromatogram &rhs) const
Equality operator.
Definition: MSChromatogram.h:163
A more convenient string class.
Definition: String.h:57
std::vector< IntegerDataArray > IntegerDataArrays
Definition: MSChromatogram.h:86
The representation of a chromatogram.
Definition: MSChromatogram.h:55
ContainerType::iterator Iterator
Mutable iterator.
Definition: MSChromatogram.h:92
std::vector< PeakType > ContainerType
Chromatogram base type.
Definition: MSChromatogram.h:77
bool operator==(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:806
PeakType::CoordinateType CoordinateType
Coordinate (RT) type.
Definition: MSChromatogram.h:75
void setIntegerDataArrays(const IntegerDataArrays &ida)
Sets the integer meta data arrays.
Definition: MSChromatogram.h:232
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSChromatogram.h:94
virtual void updateRanges()
Updates minimum and maximum position/intensity.
Definition: MSChromatogram.h:169
OpenMS::DataArrays::IntegerDataArray IntegerDataArray
Integer data array vector type.
Definition: MSChromatogram.h:85
MSChromatogram()
Constructor.
Definition: MSChromatogram.h:131
Float data array class.
Definition: DataArrays.h:46
Integer data array class.
Definition: DataArrays.h:52
MSChromatogram(const MSChromatogram &source)
Copy constructor.
Definition: MSChromatogram.h:142
virtual ~MSChromatogram()
Destructor.
Definition: MSChromatogram.h:153
std::vector< StringDataArray > StringDataArrays
Definition: MSChromatogram.h:83
Comparator for the retention time.
Definition: MSChromatogram.h:64
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
std::vector< FloatDataArray > FloatDataArrays
Definition: MSChromatogram.h:80
OpenMS::DataArrays::StringDataArray StringDataArray
String data array vector type.
Definition: MSChromatogram.h:82
Representation of chromatogram settings, e.g. SRM/MRM chromatograms.
Definition: ChromatogramSettings.h:59
ChromatogramPeak PeakType
Definition: MSChromatogram.h:73
StringDataArrays string_data_arrays_
String data arrays.
Definition: MSChromatogram.h:359
ContainerType::reverse_iterator ReverseIterator
Mutable reverse iterator.
Definition: MSChromatogram.h:96
void setFloatDataArrays(const FloatDataArrays &fda)
Sets the float meta data arrays.
Definition: MSChromatogram.h:208
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
IntegerDataArrays integer_data_arrays_
Integer data arrays.
Definition: MSChromatogram.h:362
OpenMS::DataArrays::FloatDataArray FloatDataArray
Float data array vector type.
Definition: MSChromatogram.h:79
ContainerType::const_reverse_iterator ConstReverseIterator
Non-mutable reverse iterator.
Definition: MSChromatogram.h:98
String name_
Name.
Definition: MSChromatogram.h:353
A 1-dimensional raw data point or peak for chromatograms.
Definition: ChromatogramPeak.h:55
String data array class.
Definition: DataArrays.h:58
Handles the management of a position and intensity range.
Definition: RangeManager.h:48
void setStringDataArrays(const StringDataArrays &sda)
Sets the string meta data arrays.
Definition: MSChromatogram.h:220

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