OpenMS
MSExperiment.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: Marc Sturm, Tom Waschischeck $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
16 
17 #include <vector>
18 
19 
20 namespace OpenMS
21 {
22  class Peak1D;
23  class ChromatogramPeak;
24 
43  class OPENMS_DLLAPI MSExperiment final : public RangeManagerContainer<RangeRT, RangeMZ, RangeIntensity, RangeMobility>,
45  {
46 
47 public:
48  typedef Peak1D PeakT;
50 
52 
53  typedef PeakT PeakType;
70  typedef std::vector<SpectrumType> Base;
72 
74 
75  typedef std::vector<SpectrumType>::iterator Iterator;
78  typedef std::vector<SpectrumType>::const_iterator ConstIterator;
84 
86  // Attention: these refer to the spectra vector only!
88  typedef Base::value_type value_type;
89  typedef Base::iterator iterator;
90  typedef Base::const_iterator const_iterator;
91 
94 
96  MSExperiment(const MSExperiment & source);
97 
99  MSExperiment(MSExperiment&&) = default;
100 
103 
106 
109 
111  ~MSExperiment() override;
112 
114  bool operator==(const MSExperiment & rhs) const;
115 
117  bool operator!=(const MSExperiment & rhs) const;
118 
120  inline Size size() const noexcept
121  {
122  return spectra_.size();
123  }
124 
126  inline void resize(Size n)
127  {
128  spectra_.resize(n);
129  }
130 
132  inline bool empty() const noexcept
133  {
134  return spectra_.empty();
135  }
136 
138  inline void reserve(Size n)
139  {
140  spectra_.reserve(n);
141  }
142 
145  {
146  return spectra_[n];
147  }
148 
150  inline const SpectrumType& operator[](Size n) const
151  {
152  return spectra_[n];
153  }
154 
155  inline Iterator begin() noexcept
156  {
157  return spectra_.begin();
158  }
159 
160  inline ConstIterator begin() const noexcept
161  {
162  return spectra_.cbegin();
163  }
164 
165  inline ConstIterator cbegin() const noexcept
166  {
167  return spectra_.cbegin();
168  }
169 
170  inline Iterator end()
171  {
172  return spectra_.end();
173  }
174 
175  inline ConstIterator end() const noexcept
176  {
177  return spectra_.cend();
178  }
179 
180  inline ConstIterator cend() const noexcept
181  {
182  return spectra_.cend();
183  }
185 
186  // Aliases / chromatograms
189 
191 
192 
198  template <class Container>
199  void get2DData(Container& cont) const
200  {
201  for (typename Base::const_iterator spec = spectra_.begin(); spec != spectra_.end(); ++spec)
202  {
203  if (spec->getMSLevel() != 1)
204  {
205  continue;
206  }
207  typename Container::value_type s; // explicit object here, since instantiation within push_back() fails on VS<12
208  for (typename SpectrumType::const_iterator it = spec->begin(); it != spec->end(); ++it)
209  {
210  cont.push_back(s);
211  cont.back().setRT(spec->getRT());
212  cont.back().setMZ(it->getMZ());
213  cont.back().setIntensity(it->getIntensity());
214  }
215  }
216  }
217 
229  template <class Container>
230  void set2DData(const Container& container)
231  {
232  set2DData<false, Container>(container);
233  }
234 
249  template <class Container>
250  void set2DData(const Container& container, const StringList& store_metadata_names)
251  {
252  // clean up the container first
253  clear(true);
254  SpectrumType* spectrum = nullptr;
255  typename PeakType::CoordinateType current_rt = -std::numeric_limits<typename PeakType::CoordinateType>::max();
256  for (typename Container::const_iterator iter = container.begin(); iter != container.end(); ++iter)
257  {
258  // check if the retention time has changed
259  if (current_rt != iter->getRT() || spectrum == nullptr)
260  {
261  // append new spectrum
262  if (current_rt > iter->getRT())
263  {
264  throw Exception::Precondition(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Input container is not sorted!");
265  }
266  current_rt = iter->getRT();
267  spectrum = createSpec_(current_rt, store_metadata_names);
268  }
269 
270  // add either data point or mass traces (depending on template argument value)
271  ContainerAdd_<typename Container::value_type, false>::addData_(spectrum, &(*iter), store_metadata_names);
272  }
273  }
274 
293  template <bool add_mass_traces, class Container>
294  void set2DData(const Container& container)
295  {
296  // clean up the container first
297  clear(true);
298  SpectrumType* spectrum = nullptr;
299  typename PeakType::CoordinateType current_rt = -std::numeric_limits<typename PeakType::CoordinateType>::max();
300  for (typename Container::const_iterator iter = container.begin(); iter != container.end(); ++iter)
301  {
302  // check if the retention time has changed
303  if (current_rt != iter->getRT() || spectrum == nullptr)
304  {
305  // append new spectrum
306  if (current_rt > iter->getRT())
307  {
308  throw Exception::Precondition(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Input container is not sorted!");
309  }
310  current_rt = iter->getRT();
311  spectrum = createSpec_(current_rt);
312  }
313 
314  // add either data point or mass traces (depending on template argument value)
316  }
317  }
318 
320 
321 
323 
324  AreaIterator areaBegin(CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz, UInt ms_level = 1);
326 
328  AreaIterator areaBegin(const RangeManagerType& range, UInt ms_level = 1);
329 
332 
335 
337  ConstAreaIterator areaBeginConst(const RangeManagerType& range, UInt ms_level = 1) const;
338 
341 
342  // for fast pyOpenMS access to MS1 peak data in format: [rt, [mz, intensity]]
344  std::vector<float>& rt,
345  std::vector<std::vector<float>>& mz,
346  std::vector<std::vector<float>>& intensity) const
347  {
348  float t = -1.0;
349  for (auto it = areaBeginConst(min_rt, max_rt, min_mz, max_mz); it != areaEndConst(); ++it)
350  {
351  if (it.getRT() != t)
352  {
353  t = (float)it.getRT();
354  rt.push_back(t);
355  }
356  mz.back().push_back((float)it->getMZ());
357  intensity.back().push_back(it->getIntensity());
358  }
359  }
360 
361  // for fast pyOpenMS access to MS1 peak data in format: [rt, [mz, intensity, ion mobility]]
363  std::vector<float>& rt,
364  std::vector<std::vector<float>>& mz,
365  std::vector<std::vector<float>>& intensity,
366  std::vector<std::vector<float>>& ion_mobility) const
367  {
368  float t = -1.0;
369  for (auto it = areaBeginConst(min_rt, max_rt, min_mz, max_mz); it != areaEndConst(); ++it)
370  {
371  if (it.getRT() != t)
372  {
373  t = (float)it.getRT();
374  rt.push_back(t);
375  }
376 
377  const MSSpectrum& spectrum = it.getSpectrum();
378  bool has_IM = spectrum.containsIMData();
379  float peak_IM{-1.0f};
380  if (has_IM)
381  {
382  const auto& im_data = spectrum.getIMData();
383  const Size peak_index = it.getPeakIndex().peak;
384  if (spectrum.getFloatDataArrays()[im_data.first].size() == spectrum.size())
385  {
386  peak_IM = spectrum.getFloatDataArrays()[im_data.first][peak_index];
387  }
388  }
389  ion_mobility.back().push_back(peak_IM);
390  mz.back().push_back((float)it->getMZ());
391  intensity.back().push_back(it->getIntensity());
392  }
393  }
394 
395  // for fast pyOpenMS access to MS1 peak data in format: [rt, mz, intensity]
397  CoordinateType min_rt,
398  CoordinateType max_rt,
399  CoordinateType min_mz,
400  CoordinateType max_mz,
401  std::vector<float>& rt,
402  std::vector<float>& mz,
403  std::vector<float>& intensity) const
404  {
405  for (auto it = areaBeginConst(min_rt, max_rt, min_mz, max_mz); it != areaEndConst(); ++it)
406  {
407  rt.push_back((float)it.getRT());
408  mz.push_back((float)it->getMZ());
409  intensity.push_back(it->getIntensity());
410  }
411  }
412 
413  // for fast pyOpenMS access to MS1 peak data in format: [rt, mz, intensity, ion mobility]
415  CoordinateType min_rt,
416  CoordinateType max_rt,
417  CoordinateType min_mz,
418  CoordinateType max_mz,
419  std::vector<float>& rt,
420  std::vector<float>& mz,
421  std::vector<float>& intensity,
422  std::vector<float>& ion_mobility) const
423  {
424  for (auto it = areaBeginConst(min_rt, max_rt, min_mz, max_mz); it != areaEndConst(); ++it)
425  {
426  rt.push_back((float)it.getRT());
427  mz.push_back((float)it->getMZ());
428  intensity.push_back(it->getIntensity());
429 
430  const MSSpectrum& spectrum = it.getSpectrum();
431  bool has_IM = spectrum.containsIMData();
432  float peak_IM = -1.0;
433  if (has_IM)
434  {
435  const auto& im_data = spectrum.getIMData();
436  const Size& peak_index = it.getPeakIndex().peak;
437  if (spectrum.getFloatDataArrays()[im_data.first].size() == spectrum.size())
438  {
439  peak_IM = spectrum.getFloatDataArrays()[im_data.first][peak_index];
440  }
441  }
442  ion_mobility.push_back(peak_IM);
443  }
444  }
445 
454 
463 
470 
477 
478 
487 
497 
504  // Docu in base class
505  void updateRanges() override;
506 
512  void updateRanges(Int ms_level);
513 
515  UInt64 getSize() const;
516 
518  const std::vector<UInt>& getMSLevels() const;
519 
521 
525 
527  void setSqlRunID(UInt64 id);
528 
531 
536  void sortSpectra(bool sort_mz = true);
537 
543  void sortChromatograms(bool sort_rt = true);
544 
550  bool isSorted(bool check_mz = true) const;
551 
553 
555  void reset();
556 
563 
566 
569 
571  void getPrimaryMSRunPath(StringList& toFill) const;
572 
579 
585  int getPrecursorSpectrum(int zero_based_index) const;
586 
588  void swap(MSExperiment& from);
589 
591  void setSpectra(const std::vector<MSSpectrum>& spectra);
592  void setSpectra(std::vector<MSSpectrum>&& spectra);
593 
595  void addSpectrum(const MSSpectrum& spectrum);
596  void addSpectrum(MSSpectrum&& spectrum);
597 
599  const std::vector<MSSpectrum>& getSpectra() const;
600 
602  std::vector<MSSpectrum>& getSpectra();
603 
605  ConstIterator getClosestSpectrumInRT(const double RT) const;
607 
609  ConstIterator getClosestSpectrumInRT(const double RT, UInt ms_level) const;
610  Iterator getClosestSpectrumInRT(const double RT, UInt ms_level);
611 
613  void setChromatograms(const std::vector<MSChromatogram>& chromatograms);
614  void setChromatograms(std::vector<MSChromatogram>&& chromatograms);
615 
617  void addChromatogram(const MSChromatogram& chromatogram);
619 
621  const std::vector<MSChromatogram>& getChromatograms() const;
622 
624  std::vector<MSChromatogram>& getChromatograms();
625 
627 
628  MSChromatogram& getChromatogram(Size id);
630 
633 
636 
640 
651  const MSChromatogram calculateTIC(float rt_bin_size = 0, UInt ms_level = 1) const;
652 
658  void clear(bool clear_meta_data);
659 
661  bool containsScanOfLevel(size_t ms_level) const;
662 
664  bool hasZeroIntensities(size_t ms_level) const;
665 
668 
670  bool isIMFrame() const;
671 
672  protected:
674  std::vector<UInt> ms_levels_;
678  std::vector<MSChromatogram > chromatograms_;
680  std::vector<SpectrumType> spectra_;
681 
682 private:
683 
685  template<typename ContainerValueType, bool addMassTraces>
687  {
688  static void addData_(SpectrumType* spectrum, const ContainerValueType* item);
689  static void addData_(SpectrumType* spectrum, const ContainerValueType* item, const StringList& store_metadata_names);
690  };
691 
692  template<typename ContainerValueType>
693  struct ContainerAdd_<ContainerValueType, false>
694  {
696  static void addData_(SpectrumType* spectrum, const ContainerValueType* item)
697  {
698  // create temporary peak and insert it into spectrum
699  spectrum->insert(spectrum->end(), PeakType());
700  spectrum->back().setIntensity(item->getIntensity());
701  spectrum->back().setPosition(item->getMZ());
702  }
704  static void addData_(SpectrumType* spectrum, const ContainerValueType* item, const StringList& store_metadata_names)
705  {
706  addData_(spectrum, item);
707  for (StringList::const_iterator itm = store_metadata_names.begin(); itm != store_metadata_names.end(); ++itm)
708  {
709  float val = std::numeric_limits<float>::quiet_NaN();
710  if (item->metaValueExists(*itm)) val = item->getMetaValue(*itm);
711  spectrum->getFloatDataArrays()[itm - store_metadata_names.begin()].push_back(val);
712  }
713  }
714  };
715 
716  template<typename ContainerValueType>
717  struct ContainerAdd_<ContainerValueType, true>
718  {
720  static void addData_(SpectrumType* spectrum, const ContainerValueType* item)
721  {
722  if (item->metaValueExists("num_of_masstraces"))
723  {
724  Size mts = item->getMetaValue("num_of_masstraces");
725  int charge = (item->getCharge()==0 ? 1 : item->getCharge()); // set to 1 if charge is 0, otherwise div/0 below
726  for (Size i = 0; i < mts; ++i)
727  {
728  String meta_name = String("masstrace_intensity_") + i;
729  if (!item->metaValueExists(meta_name))
730  {
731  throw Exception::Precondition(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, String("Meta value '") + meta_name + "' expected but not found in container.");
732  }
733  ContainerValueType p;
734  p.setIntensity(item->getMetaValue(meta_name));
735  p.setPosition(item->getMZ() + Constants::C13C12_MASSDIFF_U / charge * i);
737  }
738  }
740  }
741  };
742 
743  /*
744  @brief Append a spectrum to current MSExperiment
745 
746  @param rt RT of new spectrum
747  @return Pointer to newly created spectrum
748  */
750 
751  /*
752  @brief Append a spectrum including floatdata arrays to current MSExperiment
753 
754  @param rt RT of new spectrum
755  @param metadata_names Names of floatdata arrays attached to this spectrum
756  @return Pointer to newly created spectrum
757  */
759 
760  };
761 
763  OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const MSExperiment& exp);
764 
765 } // namespace OpenMS
766 
768 
769 
A 1-dimensional raw data point or peak for chromatograms.
Definition: ChromatogramPeak.h:28
Precondition failed exception.
Definition: Exception.h:128
Description of the experimental settings.
Definition: ExperimentalSettings.h:36
Forward iterator for an area of peaks in an experiment.
Definition: AreaIterator.h:36
The representation of a chromatogram.
Definition: MSChromatogram.h:30
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:45
const std::vector< UInt > & getMSLevels() const
returns an array of MS levels
const ExperimentalSettings & getExperimentalSettings() const
returns the meta information of this experiment (const access)
MSExperiment(MSExperiment &&)=default
Move constructor.
ConstIterator IMBegin(CoordinateType im) const
Fast search for spectrum range begin.
ConstIterator getClosestSpectrumInRT(const double RT, UInt ms_level) const
Returns the closest(=nearest) spectrum in retention time to the given RT of a certain MS level.
std::vector< SpectrumType > spectra_
spectra
Definition: MSExperiment.h:680
const std::vector< MSChromatogram > & getChromatograms() const
returns the chromatogram list
std::vector< SpectrumType > Base
STL base class type.
Definition: MSExperiment.h:70
void setChromatograms(std::vector< MSChromatogram > &&chromatograms)
Base::iterator iterator
Definition: MSExperiment.h:89
bool containsScanOfLevel(size_t ms_level) const
returns true if at least one of the spectra has the specified level
ConstAreaIterator areaBeginConst(CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz, UInt ms_level=1) const
Returns a non-mutable area iterator for area.
~MSExperiment() override
D'tor.
PeakType::CoordinateType CoordinateType
Coordinate type of peak positions.
Definition: MSExperiment.h:58
void get2DData(Container &cont) const
Reads out a 2D Spectrum.
Definition: MSExperiment.h:199
void swap(MSExperiment &from)
Swaps the content of this map with the content of from.
MSChromatogram ChromatogramType
Chromatogram type.
Definition: MSExperiment.h:68
void addSpectrum(const MSSpectrum &spectrum)
adds a spectrum to the list
PeakType::IntensityType IntensityType
Intensity type of peaks.
Definition: MSExperiment.h:60
void set2DData(const Container &container, const StringList &store_metadata_names)
Assignment of a data container with RT and MZ to an MSExperiment.
Definition: MSExperiment.h:250
std::vector< SpectrumType >::iterator Iterator
Mutable iterator.
Definition: MSExperiment.h:76
bool clearMetaDataArrays()
Clears the meta data arrays of all contained spectra (float, integer and string arrays)
SpectrumType * createSpec_(PeakType::CoordinateType rt)
ConstAreaIterator areaBeginConst(const RangeManagerType &range, UInt ms_level=1) const
Returns a non-mutable area iterator for all peaks in range. If a dimension is empty(),...
ConstIterator RTBegin(CoordinateType rt) const
Fast search for spectrum range begin.
Size getNrSpectra() const
get the total number of spectra available
bool empty() const noexcept
Are there any spectra (does not consider chromatograms)
Definition: MSExperiment.h:132
UInt64 getSize() const
returns the total number of peaks
ConstIterator begin() const noexcept
Definition: MSExperiment.h:160
MSExperiment & operator=(MSExperiment &&) &=default
Move assignment operator.
ConstIterator cbegin() const noexcept
Definition: MSExperiment.h:165
ConstIterator RTEnd(CoordinateType rt) const
Fast search for spectrum range end (returns the past-the-end iterator)
RangeManagerContainer< RangeRT, RangeMZ, RangeIntensity, RangeMobility > RangeManagerContainerType
RangeManager type.
Definition: MSExperiment.h:64
void addChromatogram(MSChromatogram &&chrom)
ExperimentalSettings & getExperimentalSettings()
returns the meta information of this experiment (mutable access)
void reserveSpaceChromatograms(Size s)
Iterator getClosestSpectrumInRT(const double RT, UInt ms_level)
Iterator begin() noexcept
Definition: MSExperiment.h:155
void get2DPeakData(CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz, std::vector< float > &rt, std::vector< std::vector< float >> &mz, std::vector< std::vector< float >> &intensity, std::vector< std::vector< float >> &ion_mobility) const
Definition: MSExperiment.h:362
SpectrumType * createSpec_(PeakType::CoordinateType rt, const StringList &metadata_names)
ChromatogramPeakT ChromatogramPeakType
Chromatogram peak type.
Definition: MSExperiment.h:56
MSSpectrum & getSpectrum(Size id)
returns a single spectrum
void get2DPeakDataIon(CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz, std::vector< float > &rt, std::vector< float > &mz, std::vector< float > &intensity, std::vector< float > &ion_mobility) const
Definition: MSExperiment.h:414
AreaIterator areaBegin(const RangeManagerType &range, UInt ms_level=1)
Returns a area iterator for all peaks in range. If a dimension is empty(), it is ignored (i....
Iterator RTEnd(CoordinateType rt)
Fast search for spectrum range end (returns the past-the-end iterator)
MSExperiment & operator=(const MSExperiment &source)
Assignment operator.
MSSpectrum SpectrumType
Spectrum Type.
Definition: MSExperiment.h:66
Size getNrChromatograms() const
get the total number of chromatograms available
Iterator getClosestSpectrumInRT(const double RT)
void get2DPeakData(CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz, std::vector< float > &rt, std::vector< std::vector< float >> &mz, std::vector< std::vector< float >> &intensity) const
Definition: MSExperiment.h:343
Base::value_type value_type
Definition: MSExperiment.h:88
Size size() const noexcept
The number of spectra.
Definition: MSExperiment.h:120
MSExperiment()
Constructor.
bool operator!=(const MSExperiment &rhs) const
Equality operator.
Peak1D PeakT
Definition: MSExperiment.h:48
ConstAreaIterator areaEndConst() const
Returns an non-mutable invalid area iterator marking the end of an area.
void set2DData(const Container &container)
Assignment of a data container with RT and MZ to an MSExperiment.
Definition: MSExperiment.h:230
void setSpectra(std::vector< MSSpectrum > &&spectra)
void getPrimaryMSRunPath(StringList &toFill) const
get the file path to the first MS run
std::vector< UInt > ms_levels_
MS levels of the data.
Definition: MSExperiment.h:674
void resize(Size n)
Resize to n spectra.
Definition: MSExperiment.h:126
ConstIterator cend() const noexcept
Definition: MSExperiment.h:180
std::vector< MSChromatogram > & getChromatograms()
returns the chromatogram list (mutable)
void setSpectra(const std::vector< MSSpectrum > &spectra)
sets the spectrum list
void updateRanges(Int ms_level)
Updates the m/z, intensity, retention time and MS level ranges of all spectra with a certain ms level...
void get2DPeakData(CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz, std::vector< float > &rt, std::vector< float > &mz, std::vector< float > &intensity) const
Definition: MSExperiment.h:396
void sortChromatograms(bool sort_rt=true)
Sorts the data points of the chromatograms by m/z.
Iterator RTBegin(CoordinateType rt)
Fast search for spectrum range begin.
Internal::AreaIterator< const PeakT, const PeakT &, const PeakT *, ConstIterator, SpectrumType::ConstIterator > ConstAreaIterator
Immutable area iterator type (for traversal of a rectangular subset of the peaks)
Definition: MSExperiment.h:82
void setChromatograms(const std::vector< MSChromatogram > &chromatograms)
sets the chromatogram list
Internal::AreaIterator< PeakT, PeakT &, PeakT *, Iterator, SpectrumType::Iterator > AreaIterator
Mutable area iterator type (for traversal of a rectangular subset of the peaks)
Definition: MSExperiment.h:80
const SpectrumType & operator[](Size n) const
Random access to n'th spectrum.
Definition: MSExperiment.h:150
const MSChromatogram calculateTIC(float rt_bin_size=0, UInt ms_level=1) const
Computes the total ion chromatogram (TIC) for a given MS level (use ms_level = 0 for all levels).
const std::vector< MSSpectrum > & getSpectra() const
returns the spectrum list
Iterator end()
Definition: MSExperiment.h:170
UInt64 total_size_
Number of all data points.
Definition: MSExperiment.h:676
bool isSorted(bool check_mz=true) const
Checks if all spectra are sorted with respect to ascending RT.
MSExperiment(const MSExperiment &source)
Copy constructor.
ConstIterator end() const noexcept
Definition: MSExperiment.h:175
RangeManager< RangeRT, RangeMZ, RangeIntensity, RangeMobility > RangeManagerType
RangeManager type.
Definition: MSExperiment.h:62
std::vector< MSSpectrum > & getSpectra()
returns the spectrum list (mutable)
ConstIterator getClosestSpectrumInRT(const double RT) const
Returns the closest(=nearest) spectrum in retention time to the given RT.
void set2DData(const Container &container)
Assignment of a data container with RT and MZ to an MSExperiment.
Definition: MSExperiment.h:294
ChromatogramPeak ChromatogramPeakT
Definition: MSExperiment.h:49
void sortSpectra(bool sort_mz=true)
Sorts the data points by retention time.
void reset()
Clear all internal data (spectra, ranges, metadata)
void addSpectrum(MSSpectrum &&spectrum)
void reserveSpaceSpectra(Size s)
bool hasZeroIntensities(size_t ms_level) const
returns true if any MS spectra of trthe specified level contain at least one peak with intensity of 0...
bool operator==(const MSExperiment &rhs) const
Equality operator.
ConstIterator IMEnd(CoordinateType im) const
Fast search for spectrum range end (returns the past-the-end iterator)
ConstIterator getPrecursorSpectrum(ConstIterator iterator) const
Returns the precursor spectrum of the scan pointed to by iterator.
void reserve(Size n)
Reserve space for n spectra.
Definition: MSExperiment.h:138
Base::const_iterator const_iterator
Definition: MSExperiment.h:90
void updateRanges() override
void setSqlRunID(UInt64 id)
sets the run-ID which is used when storing an sqMass file
MSExperiment & operator=(const ExperimentalSettings &source)
Assignment operator.
UInt64 getSqlRunID() const
void addChromatogram(const MSChromatogram &chromatogram)
adds a chromatogram to the list
std::vector< SpectrumType >::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSExperiment.h:78
bool hasPeptideIdentifications() const
do any of the spectra have a PeptideID?
void clear(bool clear_meta_data)
Clears all data and meta data.
SpectrumType & operator[](Size n)
Random access to n'th spectrum.
Definition: MSExperiment.h:144
int getPrecursorSpectrum(int zero_based_index) const
Returns the index of the precursor spectrum for spectrum at index zero_based_index.
std::vector< MSChromatogram > chromatograms_
chromatograms
Definition: MSExperiment.h:678
AreaIterator areaEnd()
Returns an invalid area iterator marking the end of an area.
bool isIMFrame() const
Are all MSSpectra in this experiment part of an IM Frame? I.e. they all have the same RT,...
The representation of a 1D spectrum.
Definition: MSSpectrum.h:44
bool containsIMData() const
std::pair< Size, DriftTimeUnit > getIMData() const
Get the Ion mobility data array's index and its associated unit.
const FloatDataArrays & getFloatDataArrays() const
Returns a const reference to the float meta data arrays.
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:28
double CoordinateType
Coordinate type.
Definition: Peak1D.h:40
float IntensityType
Intensity type.
Definition: Peak1D.h:36
Definition: RangeManager.h:867
A more convenient string class.
Definition: String.h:34
int Int
Signed integer type.
Definition: Types.h:72
uint64_t UInt64
Unsigned integer type (64bit)
Definition: Types.h:47
unsigned int UInt
Unsigned integer type.
Definition: Types.h:64
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
const double C13C12_MASSDIFF_U
Definition: Constants.h:95
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Peak2D PeakType
Definition: MassTrace.h:21
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
static void addData_(SpectrumType *spectrum, const ContainerValueType *item)
general method for adding data points
Definition: MSExperiment.h:696
static void addData_(SpectrumType *spectrum, const ContainerValueType *item, const StringList &store_metadata_names)
general method for adding data points, including metadata arrays (populated from metainfointerface)
Definition: MSExperiment.h:704
static void addData_(SpectrumType *spectrum, const ContainerValueType *item)
specialization for adding feature mass traces (does not support metadata_names currently)
Definition: MSExperiment.h:720
Helper class to add either general data points in set2DData or use mass traces from meta values.
Definition: MSExperiment.h:687
static void addData_(SpectrumType *spectrum, const ContainerValueType *item)
static void addData_(SpectrumType *spectrum, const ContainerValueType *item, const StringList &store_metadata_names)