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 
17 
18 #include <vector>
19 
20 
21 namespace OpenMS
22 {
23  class Peak1D;
24  class ChromatogramPeak;
25 
44  class OPENMS_DLLAPI MSExperiment final : public RangeManagerContainer<RangeRT, RangeMZ, RangeIntensity, RangeMobility>,
46  {
47 
48 public:
49  typedef Peak1D PeakT;
51 
53 
54  typedef PeakT PeakType;
71  typedef std::vector<SpectrumType> Base;
73 
75 
76  typedef std::vector<SpectrumType>::iterator Iterator;
79  typedef std::vector<SpectrumType>::const_iterator ConstIterator;
85 
87  // Attention: these refer to the spectra vector only!
89  typedef Base::value_type value_type;
90  typedef Base::iterator iterator;
91  typedef Base::const_iterator const_iterator;
92 
95 
97  MSExperiment(const MSExperiment & source);
98 
101 
104 
107 
110 
112  ~MSExperiment() override;
113 
115  bool operator==(const MSExperiment & rhs) const;
116 
118  bool operator!=(const MSExperiment & rhs) const;
119 
121  inline Size size() const noexcept
122  {
123  return spectra_.size();
124  }
125 
127  inline void resize(Size n)
128  {
129  spectra_.resize(n);
130  }
131 
133  inline bool empty() const noexcept
134  {
135  return spectra_.empty();
136  }
137 
139  inline void reserve(Size n)
140  {
141  spectra_.reserve(n);
142  }
143 
146  {
147  return spectra_[n];
148  }
149 
151  inline const SpectrumType& operator[](Size n) const
152  {
153  return spectra_[n];
154  }
155 
156  inline Iterator begin() noexcept
157  {
158  return spectra_.begin();
159  }
160 
161  inline ConstIterator begin() const noexcept
162  {
163  return spectra_.cbegin();
164  }
165 
166  inline ConstIterator cbegin() const noexcept
167  {
168  return spectra_.cbegin();
169  }
170 
171  inline Iterator end()
172  {
173  return spectra_.end();
174  }
175 
176  inline ConstIterator end() const noexcept
177  {
178  return spectra_.cend();
179  }
180 
181  inline ConstIterator cend() const noexcept
182  {
183  return spectra_.cend();
184  }
186 
187  // Aliases / chromatograms
190 
192 
193 
199  template <class Container>
200  void get2DData(Container& cont) const
201  {
202  for (typename Base::const_iterator spec = spectra_.begin(); spec != spectra_.end(); ++spec)
203  {
204  if (spec->getMSLevel() != 1)
205  {
206  continue;
207  }
208  typename Container::value_type s; // explicit object here, since instantiation within push_back() fails on VS<12
209  for (typename SpectrumType::const_iterator it = spec->begin(); it != spec->end(); ++it)
210  {
211  cont.push_back(s);
212  cont.back().setRT(spec->getRT());
213  cont.back().setMZ(it->getMZ());
214  cont.back().setIntensity(it->getIntensity());
215  }
216  }
217  }
218 
230  template <class Container>
231  void set2DData(const Container& container)
232  {
233  set2DData<false, Container>(container);
234  }
235 
250  template <class Container>
251  void set2DData(const Container& container, const StringList& store_metadata_names)
252  {
253  // clean up the container first
254  clear(true);
255  SpectrumType* spectrum = nullptr;
256  typename PeakType::CoordinateType current_rt = -std::numeric_limits<typename PeakType::CoordinateType>::max();
257  for (typename Container::const_iterator iter = container.begin(); iter != container.end(); ++iter)
258  {
259  // check if the retention time has changed
260  if (current_rt != iter->getRT() || spectrum == nullptr)
261  {
262  // append new spectrum
263  if (current_rt > iter->getRT())
264  {
265  throw Exception::Precondition(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Input container is not sorted!");
266  }
267  current_rt = iter->getRT();
268  spectrum = createSpec_(current_rt, store_metadata_names);
269  }
270 
271  // add either data point or mass traces (depending on template argument value)
272  ContainerAdd_<typename Container::value_type, false>::addData_(spectrum, &(*iter), store_metadata_names);
273  }
274  }
275 
294  template <bool add_mass_traces, class Container>
295  void set2DData(const Container& container)
296  {
297  // clean up the container first
298  clear(true);
299  SpectrumType* spectrum = nullptr;
300  typename PeakType::CoordinateType current_rt = -std::numeric_limits<typename PeakType::CoordinateType>::max();
301  for (typename Container::const_iterator iter = container.begin(); iter != container.end(); ++iter)
302  {
303  // check if the retention time has changed
304  if (current_rt != iter->getRT() || spectrum == nullptr)
305  {
306  // append new spectrum
307  if (current_rt > iter->getRT())
308  {
309  throw Exception::Precondition(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Input container is not sorted!");
310  }
311  current_rt = iter->getRT();
312  spectrum = createSpec_(current_rt);
313  }
314 
315  // add either data point or mass traces (depending on template argument value)
317  }
318  }
319 
321 
322 
324 
325  AreaIterator areaBegin(CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz, UInt ms_level = 1);
327 
329  AreaIterator areaBegin(const RangeManagerType& range, UInt ms_level = 1);
330 
333 
336 
338  ConstAreaIterator areaBeginConst(const RangeManagerType& range, UInt ms_level = 1) const;
339 
342 
343  // for fast pyOpenMS access to MS1 peak data in format: [rt, [mz, intensity]]
345  std::vector<float>& rt,
346  std::vector<std::vector<float>>& mz,
347  std::vector<std::vector<float>>& intensity) const
348  {
349  float t = -1.0;
350  for (auto it = areaBeginConst(min_rt, max_rt, min_mz, max_mz); it != areaEndConst(); ++it)
351  {
352  if (it.getRT() != t)
353  {
354  t = (float)it.getRT();
355  rt.push_back(t);
356  }
357  mz.back().push_back((float)it->getMZ());
358  intensity.back().push_back(it->getIntensity());
359  }
360  }
361 
362  // for fast pyOpenMS access to MS1 peak data in format: [rt, [mz, intensity, ion mobility]]
364  std::vector<float>& rt,
365  std::vector<std::vector<float>>& mz,
366  std::vector<std::vector<float>>& intensity,
367  std::vector<std::vector<float>>& ion_mobility) const
368  {
369  float t = -1.0;
370  for (auto it = areaBeginConst(min_rt, max_rt, min_mz, max_mz); it != areaEndConst(); ++it)
371  {
372  if (it.getRT() != t)
373  {
374  t = (float)it.getRT();
375  rt.push_back(t);
376  }
377 
378  const MSSpectrum& spectrum = it.getSpectrum();
379  bool has_IM = spectrum.containsIMData();
380  float peak_IM{-1.0f};
381  if (has_IM)
382  {
383  const auto& im_data = spectrum.getIMData();
384  const Size peak_index = it.getPeakIndex().peak;
385  if (spectrum.getFloatDataArrays()[im_data.first].size() == spectrum.size())
386  {
387  peak_IM = spectrum.getFloatDataArrays()[im_data.first][peak_index];
388  }
389  }
390  ion_mobility.back().push_back(peak_IM);
391  mz.back().push_back((float)it->getMZ());
392  intensity.back().push_back(it->getIntensity());
393  }
394  }
395 
396  // for fast pyOpenMS access to MS1 peak data in format: [rt, mz, intensity]
398  CoordinateType min_rt,
399  CoordinateType max_rt,
400  CoordinateType min_mz,
401  CoordinateType max_mz,
402  std::vector<float>& rt,
403  std::vector<float>& mz,
404  std::vector<float>& intensity) const
405  {
406  for (auto it = areaBeginConst(min_rt, max_rt, min_mz, max_mz); it != areaEndConst(); ++it)
407  {
408  rt.push_back((float)it.getRT());
409  mz.push_back((float)it->getMZ());
410  intensity.push_back(it->getIntensity());
411  }
412  }
413 
414  // for fast pyOpenMS access to MS1 peak data in format: [rt, mz, intensity, ion mobility]
416  CoordinateType min_rt,
417  CoordinateType max_rt,
418  CoordinateType min_mz,
419  CoordinateType max_mz,
420  std::vector<float>& rt,
421  std::vector<float>& mz,
422  std::vector<float>& intensity,
423  std::vector<float>& ion_mobility) const
424  {
425  for (auto it = areaBeginConst(min_rt, max_rt, min_mz, max_mz); it != areaEndConst(); ++it)
426  {
427  rt.push_back((float)it.getRT());
428  mz.push_back((float)it->getMZ());
429  intensity.push_back(it->getIntensity());
430 
431  const MSSpectrum& spectrum = it.getSpectrum();
432  bool has_IM = spectrum.containsIMData();
433  float peak_IM = -1.0;
434  if (has_IM)
435  {
436  const auto& im_data = spectrum.getIMData();
437  const Size& peak_index = it.getPeakIndex().peak;
438  if (spectrum.getFloatDataArrays()[im_data.first].size() == spectrum.size())
439  {
440  peak_IM = spectrum.getFloatDataArrays()[im_data.first][peak_index];
441  }
442  }
443  ion_mobility.push_back(peak_IM);
444  }
445  }
446 
455 
464 
471 
478 
479 
488 
498 
505  // Docu in base class
506  void updateRanges() override;
507 
513  void updateRanges(Int ms_level);
514 
516  UInt64 getSize() const;
517 
519  const std::vector<UInt>& getMSLevels() const;
520 
522 
526 
528  void setSqlRunID(UInt64 id);
529 
532 
537  void sortSpectra(bool sort_mz = true);
538 
544  void sortChromatograms(bool sort_rt = true);
545 
551  bool isSorted(bool check_mz = true) const;
552 
554 
556  void reset();
557 
564 
567 
570 
572  void getPrimaryMSRunPath(StringList& toFill) const;
573 
580 
586  int getPrecursorSpectrum(int zero_based_index) const;
587 
589  void swap(MSExperiment& from);
590 
592  void setSpectra(const std::vector<MSSpectrum>& spectra);
593  void setSpectra(std::vector<MSSpectrum>&& spectra);
594 
596  void addSpectrum(const MSSpectrum& spectrum);
597  void addSpectrum(MSSpectrum&& spectrum);
598 
600  const std::vector<MSSpectrum>& getSpectra() const;
601 
603  std::vector<MSSpectrum>& getSpectra();
604 
606  ConstIterator getClosestSpectrumInRT(const double RT) const;
608 
610  ConstIterator getClosestSpectrumInRT(const double RT, UInt ms_level) const;
611  Iterator getClosestSpectrumInRT(const double RT, UInt ms_level);
612 
614  void setChromatograms(const std::vector<MSChromatogram>& chromatograms);
615  void setChromatograms(std::vector<MSChromatogram>&& chromatograms);
616 
618  void addChromatogram(const MSChromatogram& chromatogram);
620 
622  const std::vector<MSChromatogram>& getChromatograms() const;
623 
625  std::vector<MSChromatogram>& getChromatograms();
626 
628 
629  MSChromatogram& getChromatogram(Size id);
631 
634 
637 
641 
652  const MSChromatogram calculateTIC(float rt_bin_size = 0, UInt ms_level = 1) const;
653 
659  void clear(bool clear_meta_data);
660 
662  bool containsScanOfLevel(size_t ms_level) const;
663 
665  bool hasZeroIntensities(size_t ms_level) const;
666 
669 
671  bool isIMFrame() const;
672 
673  protected:
675  std::vector<UInt> ms_levels_;
679  std::vector<MSChromatogram > chromatograms_;
681  std::vector<SpectrumType> spectra_;
682 
683 private:
684 
686  template<typename ContainerValueType, bool addMassTraces>
688  {
689  static void addData_(SpectrumType* spectrum, const ContainerValueType* item);
690  static void addData_(SpectrumType* spectrum, const ContainerValueType* item, const StringList& store_metadata_names);
691  };
692 
693  template<typename ContainerValueType>
694  struct ContainerAdd_<ContainerValueType, false>
695  {
697  static void addData_(SpectrumType* spectrum, const ContainerValueType* item)
698  {
699  // create temporary peak and insert it into spectrum
700  spectrum->insert(spectrum->end(), PeakType());
701  spectrum->back().setIntensity(item->getIntensity());
702  spectrum->back().setPosition(item->getMZ());
703  }
705  static void addData_(SpectrumType* spectrum, const ContainerValueType* item, const StringList& store_metadata_names)
706  {
707  addData_(spectrum, item);
708  for (StringList::const_iterator itm = store_metadata_names.begin(); itm != store_metadata_names.end(); ++itm)
709  {
710  float val = std::numeric_limits<float>::quiet_NaN();
711  if (item->metaValueExists(*itm)) val = item->getMetaValue(*itm);
712  spectrum->getFloatDataArrays()[itm - store_metadata_names.begin()].push_back(val);
713  }
714  }
715  };
716 
717  template<typename ContainerValueType>
718  struct ContainerAdd_<ContainerValueType, true>
719  {
721  static void addData_(SpectrumType* spectrum, const ContainerValueType* item)
722  {
723  if (item->metaValueExists("num_of_masstraces"))
724  {
725  Size mts = item->getMetaValue("num_of_masstraces");
726  int charge = (item->getCharge()==0 ? 1 : item->getCharge()); // set to 1 if charge is 0, otherwise div/0 below
727  for (Size i = 0; i < mts; ++i)
728  {
729  String meta_name = String("masstrace_intensity_") + i;
730  if (!item->metaValueExists(meta_name))
731  {
732  throw Exception::Precondition(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, String("Meta value '") + meta_name + "' expected but not found in container.");
733  }
734  ContainerValueType p;
735  p.setIntensity(item->getMetaValue(meta_name));
736  p.setPosition(item->getMZ() + Constants::C13C12_MASSDIFF_U / charge * i);
738  }
739  }
741  }
742  };
743 
744  /*
745  @brief Append a spectrum to current MSExperiment
746 
747  @param rt RT of new spectrum
748  @return Pointer to newly created spectrum
749  */
751 
752  /*
753  @brief Append a spectrum including floatdata arrays to current MSExperiment
754 
755  @param rt RT of new spectrum
756  @param metadata_names Names of floatdata arrays attached to this spectrum
757  @return Pointer to newly created spectrum
758  */
760 
761  };
762 
764  OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const MSExperiment& exp);
765 
766 } // namespace OpenMS
767 
769 
770 
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:31
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:46
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:681
const std::vector< MSChromatogram > & getChromatograms() const
returns the chromatogram list
std::vector< SpectrumType > Base
STL base class type.
Definition: MSExperiment.h:71
void setChromatograms(std::vector< MSChromatogram > &&chromatograms)
Base::iterator iterator
Definition: MSExperiment.h:90
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:59
void get2DData(Container &cont) const
Reads out a 2D Spectrum.
Definition: MSExperiment.h:200
void swap(MSExperiment &from)
Swaps the content of this map with the content of from.
MSChromatogram ChromatogramType
Chromatogram type.
Definition: MSExperiment.h:69
void addSpectrum(const MSSpectrum &spectrum)
adds a spectrum to the list
PeakType::IntensityType IntensityType
Intensity type of peaks.
Definition: MSExperiment.h:61
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:251
std::vector< SpectrumType >::iterator Iterator
Mutable iterator.
Definition: MSExperiment.h:77
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:133
UInt64 getSize() const
returns the total number of peaks
ConstIterator begin() const noexcept
Definition: MSExperiment.h:161
MSExperiment & operator=(MSExperiment &&) &=default
Move assignment operator.
ConstIterator cbegin() const noexcept
Definition: MSExperiment.h:166
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:65
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:156
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:363
SpectrumType * createSpec_(PeakType::CoordinateType rt, const StringList &metadata_names)
ChromatogramPeakT ChromatogramPeakType
Chromatogram peak type.
Definition: MSExperiment.h:57
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:415
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:67
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:344
Base::value_type value_type
Definition: MSExperiment.h:89
Size size() const noexcept
The number of spectra.
Definition: MSExperiment.h:121
MSExperiment()
Constructor.
bool operator!=(const MSExperiment &rhs) const
Equality operator.
Peak1D PeakT
Definition: MSExperiment.h:49
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:231
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:675
void resize(Size n)
Resize to n spectra.
Definition: MSExperiment.h:127
ConstIterator cend() const noexcept
Definition: MSExperiment.h:181
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:397
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:83
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:81
const SpectrumType & operator[](Size n) const
Random access to n'th spectrum.
Definition: MSExperiment.h:151
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:171
UInt64 total_size_
Number of all data points.
Definition: MSExperiment.h:677
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:176
RangeManager< RangeRT, RangeMZ, RangeIntensity, RangeMobility > RangeManagerType
RangeManager type.
Definition: MSExperiment.h:63
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:295
ChromatogramPeak ChromatogramPeakT
Definition: MSExperiment.h:50
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:139
Base::const_iterator const_iterator
Definition: MSExperiment.h:91
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:79
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:145
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:679
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
FLASHIda C++ to C# (or vice versa) bridge functions The functions here are called in C# to invoke fun...
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:697
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:705
static void addData_(SpectrumType *spectrum, const ContainerValueType *item)
specialization for adding feature mass traces (does not support metadata_names currently)
Definition: MSExperiment.h:721
Helper class to add either general data points in set2DData or use mass traces from meta values.
Definition: MSExperiment.h:688
static void addData_(SpectrumType *spectrum, const ContainerValueType *item)
static void addData_(SpectrumType *spectrum, const ContainerValueType *item, const StringList &store_metadata_names)