Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
MSExperiment.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-2013.
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: Stephan Aiche$
32 // $Authors: Marc Sturm $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_KERNEL_MSEXPERIMENT_H
36 #define OPENMS_KERNEL_MSEXPERIMENT_H
37 
45 
46 #include <vector>
47 #include <algorithm>
48 #include <limits>
49 
50 namespace OpenMS
51 {
52  class Peak1D;
53 
67  template <typename PeakT = Peak1D, typename ChromatogramPeakT = ChromatogramPeak>
68  class MSExperiment :
69  public RangeManager<2>,
70  public ExperimentalSettings,
71  public PersistentObject
72  {
73 
74 public:
75 
77 
78  typedef PeakT PeakType;
81  typedef ChromatogramPeakT ChromatogramPeakType;
95  typedef std::vector<SpectrumType> Base;
97 
99 
100  typedef typename std::vector<SpectrumType>::iterator Iterator;
103  typedef typename std::vector<SpectrumType>::const_iterator ConstIterator;
109 
111  // Attention: these refer to the spectra vector only!
113  typedef typename Base::value_type value_type;
114  typedef typename Base::iterator iterator;
115  typedef typename Base::const_iterator const_iterator;
116 
117  inline Size size() const
118  {
119  return spectra_.size();
120  }
121 
122  inline void resize(Size s)
123  {
124  spectra_.resize(s);
125  }
126 
127  inline bool empty() const
128  {
129  return spectra_.empty();
130  }
131 
132  inline void reserve(Size s)
133  {
134  spectra_.reserve(s);
135  }
136 
138  {
139  return spectra_[n];
140  }
141 
142  inline const SpectrumType& operator[] (Size n) const
143  {
144  return spectra_[n];
145  }
146 
147  inline Iterator begin()
148  {
149  return spectra_.begin();
150  }
151 
152  inline ConstIterator begin() const
153  {
154  return spectra_.begin();
155  }
156 
157  inline Iterator end()
158  {
159  return spectra_.end();
160  }
161 
162  inline ConstIterator end() const
163  {
164  return spectra_.end();
165  }
167 
168  // Aliases / chromatograms
169  inline void reserveSpaceSpectra(Size s)
170  {
171  spectra_.reserve(s);
172  }
174  {
175  chromatograms_.reserve(s);
176  }
177 
183  ms_levels_(),
184  total_size_(0)
185  {}
186 
188  MSExperiment(const MSExperiment & source) :
189  RangeManagerType(source),
190  ExperimentalSettings(source),
191  PersistentObject(source),
192  ms_levels_(source.ms_levels_),
193  total_size_(source.total_size_),
195  spectra_(source.spectra_)
196  {}
197 
200  {
201  if (&source == this) return *this;
202 
206 
207  ms_levels_ = source.ms_levels_;
208  total_size_ = source.total_size_;
210  spectra_ = source.spectra_;
211 
212  //no need to copy the alloc?!
213  //alloc_
214 
215  return *this;
216  }
217 
220  {
222  return *this;
223  }
224 
226  bool operator==(const MSExperiment & rhs) const
227  {
228  return ExperimentalSettings::operator==(rhs) &&
229  chromatograms_ == rhs.chromatograms_ &&
230  spectra_ == rhs.spectra_;
231  }
232 
234  bool operator!=(const MSExperiment & rhs) const
235  {
236  return !(operator==(rhs));
237  }
238 
240 
241 
247  template <class Container>
248  void get2DData(Container & cont) const
249  {
250  for (typename Base::const_iterator spec = spectra_.begin(); spec != spectra_.end(); ++spec)
251  {
252  if (spec->getMSLevel() != 1)
253  {
254  continue;
255  }
256  for (typename SpectrumType::const_iterator it = spec->begin(); it != spec->end(); ++it)
257  {
258  cont.push_back(typename Container::value_type());
259  cont.back().setRT(spec->getRT());
260  cont.back().setMZ(it->getMZ());
261  cont.back().setIntensity(it->getIntensity());
262  }
263  }
264  }
265 
274  template <class Container>
275  void set2DData(const Container & cont)
276  {
277  SpectrumType * spectrum = 0;
278  // If the container is empty, nothing will happen
279  if (cont.empty()) return;
280 
281  typename PeakType::CoordinateType current_rt = -(std::numeric_limits<typename PeakType::CoordinateType>::max)();
282 
283  for (typename Container::const_iterator iter = cont.begin(); iter != cont.end(); ++iter)
284  {
285  // check if the retention time time has changed
286  if (current_rt != iter->getRT() || spectrum == 0)
287  {
288  if (current_rt > iter->getRT())
289  {
290  throw Exception::Precondition(__FILE__, __LINE__, __PRETTY_FUNCTION__, "Input container is not sorted!");
291  }
292  current_rt = iter->getRT();
293  spectra_.insert(spectra_.end(), SpectrumType());
294  spectrum = &(spectra_.back());
295  spectrum->setRT(current_rt);
296  spectrum->setMSLevel(1);
297  }
298 
299  // create temporary peak and insert it into spectrum
300  spectrum->insert(spectrum->end(), PeakType());
301  spectrum->back().setIntensity(iter->getIntensity());
302  spectrum->back().setPosition(iter->getMZ());
303  }
304  }
305 
307 
309 
312  {
313  OPENMS_PRECONDITION(min_rt <= max_rt, "Swapped RT range boundaries!")
314  OPENMS_PRECONDITION(min_mz <= max_mz, "Swapped MZ range boundaries!")
315  OPENMS_PRECONDITION(this->isSorted(true), "Experiment is not sorted by RT and m/z! Using AreaIterator will give invalid results!")
316  //std::cout << "areaBegin: " << min_rt << " " << max_rt << " " << min_mz << " " << max_mz << std::endl;
317  return AreaIterator(spectra_.begin(), RTBegin(min_rt), RTEnd(max_rt), min_mz, max_mz);
318  }
319 
322  {
323  return AreaIterator();
324  }
325 
328  {
329  OPENMS_PRECONDITION(min_rt <= max_rt, "Swapped RT range boundaries!")
330  OPENMS_PRECONDITION(min_mz <= max_mz, "Swapped MZ range boundaries!")
331  OPENMS_PRECONDITION(this->isSorted(true), "Experiment is not sorted by RT and m/z! Using ConstAreaIterator will give invalid results!")
332  //std::cout << "areaBeginConst: " << min_rt << " " << max_rt << " " << min_mz << " " << max_mz << std::endl;
333  return ConstAreaIterator(spectra_.begin(), RTBegin(min_rt), RTEnd(max_rt), min_mz, max_mz);
334  }
335 
338  {
339  return ConstAreaIterator();
340  }
341 
350  {
351  SpectrumType s;
352  s.setRT(rt);
353  return lower_bound(spectra_.begin(), spectra_.end(), s, typename SpectrumType::RTLess());
354  }
355 
364  {
365  SpectrumType s;
366  s.setRT(rt);
367  return upper_bound(spectra_.begin(), spectra_.end(), s, typename SpectrumType::RTLess());
368  }
369 
376  {
377  SpectrumType s;
378  s.setRT(rt);
379  return lower_bound(spectra_.begin(), spectra_.end(), s, typename SpectrumType::RTLess());
380  }
381 
388  {
389  SpectrumType s;
390  s.setRT(rt);
391  return upper_bound(spectra_.begin(), spectra_.end(), s, typename SpectrumType::RTLess());
392  }
393 
395 
401  // Docu in base class
403  virtual void updateRanges()
404  {
405  updateRanges(-1);
406  }
407 
413  void updateRanges(Int ms_level)
414  {
415  //clear MS levels
416  ms_levels_.clear();
417 
418  //reset mz/rt/int range
419  this->clearRanges();
420  //reset point count
421  total_size_ = 0;
422 
423  //empty
424  if (spectra_.empty() && chromatograms_.empty())
425  {
426  return;
427  }
428 
429  //update
430  for (typename Base::iterator it = spectra_.begin(); it != spectra_.end(); ++it)
431  {
432  if (ms_level < Int(0) || Int(it->getMSLevel()) == ms_level)
433  {
434  //ms levels
435  if (std::find(ms_levels_.begin(), ms_levels_.end(), it->getMSLevel()) == ms_levels_.end())
436  {
437  ms_levels_.push_back(it->getMSLevel());
438  }
439 
440  // calculate size
441  total_size_ += it->size();
442 
443  //rt
444  if (it->getRT() < RangeManagerType::pos_range_.minX()) RangeManagerType::pos_range_.setMinX(it->getRT());
445  if (it->getRT() > RangeManagerType::pos_range_.maxX()) RangeManagerType::pos_range_.setMaxX(it->getRT());
446 
447  //do not update mz and int when the spectrum is empty
448  if (it->size() == 0) continue;
449 
450  it->updateRanges();
451 
452  //mz
453  if (it->getMin()[0] < RangeManagerType::pos_range_.minY()) RangeManagerType::pos_range_.setMinY(it->getMin()[0]);
454  if (it->getMax()[0] > RangeManagerType::pos_range_.maxY()) RangeManagerType::pos_range_.setMaxY(it->getMax()[0]);
455 
456  //int
457  if (it->getMinInt() < RangeManagerType::int_range_.minX()) RangeManagerType::int_range_.setMinX(it->getMinInt());
458  if (it->getMaxInt() > RangeManagerType::int_range_.maxX()) RangeManagerType::int_range_.setMaxX(it->getMaxInt());
459 
460  }
461  // for MS level = 1 we extend the range for all the MS2 precursors
462  if (ms_level == 1 && it->getMSLevel() == 2)
463  {
464  if (!it->getPrecursors().empty())
465  {
466  DoubleReal pc_rt = it->getRT();
467  if (pc_rt < RangeManagerType::pos_range_.minX()) RangeManagerType::pos_range_.setMinX(pc_rt);
468  if (pc_rt > RangeManagerType::pos_range_.maxX()) RangeManagerType::pos_range_.setMaxX(pc_rt);
469  DoubleReal pc_mz = it->getPrecursors()[0].getMZ();
470  if (pc_mz < RangeManagerType::pos_range_.minY()) RangeManagerType::pos_range_.setMinY(pc_mz);
471  if (pc_mz > RangeManagerType::pos_range_.maxY()) RangeManagerType::pos_range_.setMaxY(pc_mz);
472  }
473 
474  }
475 
476  }
477  std::sort(ms_levels_.begin(), ms_levels_.end());
478 
479 
480 
481 
482  if (this->chromatograms_.empty())
483  {
484  return;
485  }
486 
487  //TODO CHROM update intensity, m/z and RT according to chromatograms as well! (done????)
488 
489  for (typename std::vector<ChromatogramType>::iterator it = chromatograms_.begin(); it != chromatograms_.end(); ++it)
490  {
491 
492  // ignore TICs and ECs (as these are usually positioned at 0 and therefor lead to a large white margin in plots if included)
493  if (it->getChromatogramType() == ChromatogramSettings::TOTAL_ION_CURRENT_CHROMATOGRAM ||
494  it->getChromatogramType() == ChromatogramSettings::EMISSION_CHROMATOGRAM)
495  {
496  continue;
497  }
498 
499  // update MZ
500  if (it->getMZ() < RangeManagerType::pos_range_.minY()) RangeManagerType::pos_range_.setMinY(it->getMZ());
501  if (it->getMZ() > RangeManagerType::pos_range_.maxY()) RangeManagerType::pos_range_.setMaxY(it->getMZ());
502 
503  // do not update RT and in if the specturm is empty
504  if (it->size() == 0) continue;
505 
506  total_size_ += it->size();
507 
508  it->updateRanges();
509 
510  // RT
511  if (it->getMin()[0] < RangeManagerType::pos_range_.minX()) RangeManagerType::pos_range_.setMinX(it->getMin()[0]);
512  if (it->getMax()[0] > RangeManagerType::pos_range_.maxX()) RangeManagerType::pos_range_.setMaxX(it->getMax()[0]);
513 
514  // int
515  if (it->getMinInt() < RangeManagerType::int_range_.minX()) RangeManagerType::int_range_.setMinX(it->getMinInt());
516  if (it->getMaxInt() > RangeManagerType::int_range_.maxX()) RangeManagerType::int_range_.setMaxX(it->getMaxInt());
517  }
518  }
519 
522  {
523  return RangeManagerType::pos_range_.minPosition()[1];
524  }
525 
528  {
529  return RangeManagerType::pos_range_.maxPosition()[1];
530  }
531 
534  {
535  return RangeManagerType::pos_range_.minPosition()[0];
536  }
537 
540  {
541  return RangeManagerType::pos_range_.maxPosition()[0];
542  }
543 
549  const AreaType & getDataRange() const
550  {
552  }
553 
555  UInt64 getSize() const
556  {
557  return total_size_;
558  }
559 
561  const std::vector<UInt> & getMSLevels() const
562  {
563  return ms_levels_;
564  }
565 
567 
570 
575  void sortSpectra(bool sort_mz = true)
576  {
577  std::sort(spectra_.begin(), spectra_.end(), typename SpectrumType::RTLess());
578 
579  if (sort_mz)
580  {
581  // sort each spectrum by m/z
582  for (Iterator iter = spectra_.begin(); iter != spectra_.end(); ++iter)
583  {
584  iter->sortByPosition();
585  }
586  }
587  }
588 
594  void sortChromatograms(bool sort_rt = true)
595  {
596  // sort the chromatograms according to their product m/z
597  std::sort(chromatograms_.begin(), chromatograms_.end(), typename ChromatogramType::MZLess());
598 
599  if (sort_rt)
600  {
601  for (typename std::vector<ChromatogramType>::iterator it = chromatograms_.begin(); it != chromatograms_.end(); ++it)
602  {
603  it->sortByPosition();
604  }
605  }
606  }
607 
613  bool isSorted(bool check_mz = true) const
614  {
615  //check RT positions
616  for (Size i = 1; i < spectra_.size(); ++i)
617  {
618  if (spectra_[i - 1].getRT() > spectra_[i].getRT()) return false;
619  }
620  //check spectra
621  if (check_mz)
622  {
623  for (Size i = 0; i < spectra_.size(); ++i)
624  {
625  if (!spectra_[i].isSorted()) return false;
626  }
627  }
628  // TODO CHROM
629  return true;
630  }
631 
633 
635  void reset()
636  {
637  spectra_.clear(); //remove data
638  RangeManagerType::clearRanges(); //reset range manager
640  }
641 
648  {
649  bool meta_present = false;
650  for (Size i = 0; i < spectra_.size(); ++i)
651  {
652  if (spectra_[i].getFloatDataArrays().size() != 0 || spectra_[i].getIntegerDataArrays().size() != 0 || spectra_[i].getStringDataArrays().size() != 0)
653  {
654  meta_present = true;
655  }
656  spectra_[i].getStringDataArrays().clear();
657  spectra_[i].getIntegerDataArrays().clear();
658  spectra_[i].getFloatDataArrays().clear();
659  }
660  return meta_present;
661  }
662 
665  {
666  return *this;
667  }
668 
671  {
672  return *this;
673  }
674 
681  {
682  if (iterator == spectra_.end() || iterator == spectra_.begin())
683  {
684  return spectra_.end();
685  }
686  UInt ms_level = iterator->getMSLevel();
687  do
688  {
689  --iterator;
690  if (iterator->getMSLevel() < ms_level)
691  {
692  return iterator;
693  }
694  }
695  while (iterator != spectra_.begin());
696 
697  return spectra_.end();
698  }
699 
701  void swap(MSExperiment & from)
702  {
703  MSExperiment tmp;
704 
705  //swap range information
706  tmp.RangeManagerType::operator=(* this);
707  this->RangeManagerType::operator=(from);
708  from.RangeManagerType::operator=(tmp);
709 
710  //swap experimental settings
711  tmp.ExperimentalSettings::operator=(* this);
713  from.ExperimentalSettings::operator=(tmp);
714 
715  //swap persistent object
716  tmp.PersistentObject::operator=(* this);
717  this->PersistentObject::operator=(from);
718  from.PersistentObject::operator=(tmp);
719 
720  // swap chromatograms
721  std::swap(chromatograms_, from.chromatograms_);
722 
723  //swap peaks
724  spectra_.swap(from.getSpectra());
725 
726  //swap remaining members
727  ms_levels_.swap(from.ms_levels_);
728  std::swap(total_size_, from.total_size_);
729  }
730 
732  void setSpectra(const std::vector<MSSpectrum<PeakT> > & spectra)
733  {
734  spectra_ = spectra;
735  }
736 
738  void addSpectrum(const MSSpectrum<PeakT> & spectrum)
739  {
740  spectra_.push_back(spectrum);
741  }
742 
744  const std::vector<MSSpectrum<PeakT> > & getSpectra() const
745  {
746  return spectra_;
747  }
748 
750  std::vector<MSSpectrum<PeakT> > & getSpectra()
751  {
752  return spectra_;
753  }
754 
756  void setChromatograms(const std::vector<MSChromatogram<ChromatogramPeakType> > & chromatograms)
757  {
758  chromatograms_ = chromatograms;
759  }
760 
763  {
764  chromatograms_.push_back(chromatogram);
765  }
766 
768  const std::vector<MSChromatogram<ChromatogramPeakType> > & getChromatograms() const
769  {
770  return chromatograms_;
771  }
772 
775  {
776  return chromatograms_[id];
777  }
778 
781  {
782  // The TIC is (re)calculated from the MS1 spectra. Even if MSExperiment does not contain a TIC chromatogram explicitly, it can be reported.
784  for (typename Base::const_iterator spec_it = spectra_.begin(); spec_it != spectra_.end(); ++spec_it)
785  {
786  if (spec_it->getMSLevel() == 1)
787  {
788  DoubleReal totalIntensity = 0;
789  // sum intensities of a spectrum
790  for (typename SpectrumType::const_iterator peak_it = spec_it->begin(); peak_it != spec_it->end(); ++peak_it)
791  {
792  totalIntensity += peak_it->getIntensity();
793  }
794  // fill chromatogram
796  peak.setRT(spec_it->getRT());
797  peak.setIntensity(totalIntensity);
798  TIC.push_back(peak);
799  }
800  }
801  return TIC;
802  }
803 
809  void clear(bool clear_meta_data)
810  {
811  spectra_.clear();
812 
813  if (clear_meta_data)
814  {
815  clearRanges();
816  clearId();
817  this->ExperimentalSettings::operator=(ExperimentalSettings()); // no "clear" method
818  chromatograms_.clear();
819  ms_levels_.clear();
820  total_size_ = 0;
821  }
822  }
823 
824 protected:
825 
826  // Docu in base class
827  virtual void clearChildIds_()
828  {
829  for (Size i = 0; i < spectra_.size(); ++i)
830  {
831  spectra_[i].clearId(true);
832  }
833  }
834 
836  std::vector<UInt> ms_levels_;
839 
841  std::vector<MSChromatogram<ChromatogramPeakType> > chromatograms_;
842 
844  std::vector<SpectrumType> spectra_;
845  };
846 
847 
849  template <typename PeakT, typename ChromatogramPeakT>
850  std::ostream & operator<<(std::ostream & os, const MSExperiment<PeakT, ChromatogramPeakT> & exp)
851  {
852  os << "-- MSEXPERIMENT BEGIN --" << std::endl;
853 
854  //experimental settings
855  os << static_cast<const ExperimentalSettings &>(exp);
856 
857  //spectra
858  for (typename MSExperiment<PeakT>::const_iterator it = exp.begin(); it != exp.end(); ++it)
859  {
860  os << *it;
861  }
862 
863  //chromatograms
864  for (typename std::vector<MSChromatogram<ChromatogramPeakT> >::const_iterator it = exp.getChromatograms().begin(); it != exp.getChromatograms().end(); ++it)
865  {
866  os << *it;
867  }
868 
869  os << "-- MSEXPERIMENT END --" << std::endl;
870 
871  return os;
872  }
873 
874 } // namespace OpenMS
875 
876 #endif // OPENMS_KERNEL_MSEXPERIMENT_H
void setRT(CoordinateType rt)
Mutable access to RT.
Definition: ChromatogramPeak.h:117
MSSpectrum< PeakType > SpectrumType
Spectrum Type.
Definition: MSExperiment.h:91
Internal::AreaIterator< PeakT, PeakT &, PeakT *, Iterator, typename SpectrumType::Iterator > AreaIterator
Mutable area iterator type (for traversal of a rectangular subset of the peaks)
Definition: MSExperiment.h:105
void get2DData(Container &cont) const
Reads out a 2D Spectrum.
Definition: MSExperiment.h:248
void reserveSpaceChromatograms(Size s)
Definition: MSExperiment.h:173
bool operator==(const ExperimentalSettings &rhs) const
Equality operator.
void reset()
Resets all internal values.
Definition: MSExperiment.h:635
PositionRangeType pos_range_
Position range (D-dimensional)
Definition: RangeManager.h:151
Size size() const
Definition: MSExperiment.h:117
std::vector< SpectrumType >::iterator Iterator
Mutable iterator.
Definition: MSExperiment.h:101
bool operator==(const MSExperiment &rhs) const
Equality operator.
Definition: MSExperiment.h:226
CoordinateType maxX() const
Accessor for min_ coordinate maximum.
Definition: DIntervalBase.h:252
Base::value_type value_type
Definition: MSExperiment.h:113
std::vector< MSChromatogram< ChromatogramPeakType > > chromatograms_
chromatograms
Definition: MSExperiment.h:841
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: Macros.h:107
Iterator RTEnd(CoordinateType rt)
Fast search for spectrum range end (returns the past-the-end iterator)
Definition: MSExperiment.h:387
bool clearMetaDataArrays()
Clears the meta data arrays of all contained spectra (float, integer and string arrays) ...
Definition: MSExperiment.h:647
MSExperiment()
Constructor.
Definition: MSExperiment.h:179
ChromatogramPeakT ChromatogramPeakType
Chromatogram peak type.
Definition: MSExperiment.h:81
Forward iterator for an area of peaks in an experiment.
Definition: AreaIterator.h:58
Iterator begin()
Definition: MSExperiment.h:147
void sortSpectra(bool sort_mz=true)
Sorts the data points by retention time.
Definition: MSExperiment.h:575
Base::const_iterator const_iterator
Definition: MSExperiment.h:115
void resize(Size s)
Definition: MSExperiment.h:122
PeakType::IntensityType IntensityType
Intenstiy type of peaks.
Definition: MSExperiment.h:87
void swap(MSExperiment &from)
Swaps the content of this map with the content of from.
Definition: MSExperiment.h:701
CoordinateType getMaxMZ() const
returns the maximal m/z value
Definition: MSExperiment.h:527
ConstIterator RTEnd(CoordinateType rt) const
Fast search for spectrum range end (returns the past-the-end iterator)
Definition: MSExperiment.h:363
Precondition failed exception.
Definition: Exception.h:167
const MSChromatogram< ChromatogramPeakType > getTIC() const
returns the total ion chromatogram (TIC)
Definition: MSExperiment.h:780
void addChromatogram(const MSChromatogram< ChromatogramPeakType > &chromatogram)
adds a chromatogram to the list
Definition: MSExperiment.h:762
ConstAreaIterator areaEndConst() const
Returns an non-mutable invalid area iterator marking the end of an area.
Definition: MSExperiment.h:337
CoordinateType getMinMZ() const
returns the minimal m/z value
Definition: MSExperiment.h:521
CoordinateType getMinRT() const
returns the minimal retention time value
Definition: MSExperiment.h:533
SpectrumType & operator[](Size n)
Definition: MSExperiment.h:137
RangeManager< 2 > RangeManagerType
RangeManager type.
Definition: MSExperiment.h:89
Iterator end()
Definition: MSExperiment.h:157
ConstIterator RTBegin(CoordinateType rt) const
Fast search for spectrum range begin.
Definition: MSExperiment.h:349
Base::iterator iterator
Definition: MSExperiment.h:114
MSChromatogram< ChromatogramPeakType > ChromatogramType
Chromatogram type.
Definition: MSExperiment.h:93
void sortChromatograms(bool sort_rt=true)
Sorts the data points of the chromatograms by m/z.
Definition: MSExperiment.h:594
void updateRanges(Int ms_level)
Updates the m/z, intensity, retention time and MS level ranges of all spectra with a certain ms level...
Definition: MSExperiment.h:413
ConstAreaIterator areaBeginConst(CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz) const
Returns a non-mutable area iterator for area.
Definition: MSExperiment.h:327
Base class for all persistent objects.
Definition: PersistentObject.h:52
void reserve(Size s)
Definition: MSExperiment.h:132
CoordinateType minX() const
Accessor for min_ coordinate minimum.
Definition: DIntervalBase.h:240
MSChromatogram< ChromatogramPeakType > & getChromatogram(Size id)
returns a single chromatogram
Definition: MSExperiment.h:774
RangeManager & operator=(const RangeManager &rhs)
Assignment operator.
Definition: RangeManager.h:77
Real IntensityType
Intensity type.
Definition: Peak1D.h:64
PersistentObject & operator=(const PersistentObject &rhs)
Assignment operator.
const ExperimentalSettings & getExperimentalSettings() const
returns the meta information of this experiment (const access)
Definition: MSExperiment.h:664
void clearRanges()
Resets the ranges.
Definition: RangeManager.h:140
void setMSLevel(UInt ms_level)
Sets the MS level.
Definition: MSSpectrum.h:237
ConstIterator end() const
Definition: MSExperiment.h:162
bool operator!=(const MSExperiment &rhs) const
Equality operator.
Definition: MSExperiment.h:234
Definition: ChromatogramSettings.h:77
AreaIterator areaBegin(CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz)
Returns an area iterator for area.
Definition: MSExperiment.h:311
const std::vector< MSSpectrum< PeakT > > & getSpectra() const
returns the spectra list
Definition: MSExperiment.h:744
PeakType::CoordinateType CoordinateType
Coordinate type of peak positions.
Definition: MSExperiment.h:85
IntensityRangeType int_range_
Intensity range (1-dimensional)
Definition: RangeManager.h:149
PeakT PeakType
Peak type.
Definition: MSExperiment.h:79
void reserveSpaceSpectra(Size s)
Definition: MSExperiment.h:169
OPENMS_UINT64_TYPE UInt64
Unsigned integer type (64bit)
Definition: Types.h:75
std::vector< SpectrumType > spectra_
spectra
Definition: MSExperiment.h:844
DRange< 2 > AreaType
Area type.
Definition: MSExperiment.h:83
Internal::AreaIterator< const PeakT, const PeakT &, const PeakT *, ConstIterator, typename SpectrumType::ConstIterator > ConstAreaIterator
Immutable area iterator type (for traversal of a rectangular subset of the peaks) ...
Definition: MSExperiment.h:107
void addSpectrum(const MSSpectrum< PeakT > &spectrum)
adds a spectra to the list
Definition: MSExperiment.h:738
ExperimentalSettings & getExperimentalSettings()
returns the meta information of this experiment (mutable access)
Definition: MSExperiment.h:670
const std::vector< UInt > & getMSLevels() const
returns an array of MS levels
Definition: MSExperiment.h:561
MSExperiment(const MSExperiment &source)
Copy constructor.
Definition: MSExperiment.h:188
Representation of a mass spectrometry experiment.
Definition: MSExperiment.h:68
bool isSorted(bool check_mz=true) const
Checks if all spectra are sorted with respect to ascending RT.
Definition: MSExperiment.h:613
void clearId(bool deep=true)
Clears the persistence id.
ExperimentalSettings & operator=(const ExperimentalSettings &source)
Assignment operator.
void setChromatograms(const std::vector< MSChromatogram< ChromatogramPeakType > > &chromatograms)
sets the chromatogram list
Definition: MSExperiment.h:756
const AreaType & getDataRange() const
Returns RT and m/z range the data lies in.
Definition: MSExperiment.h:549
MSExperiment & operator=(const ExperimentalSettings &source)
Assignment operator.
Definition: MSExperiment.h:219
std::vector< MSSpectrum< PeakT > > & getSpectra()
returns the spectra list
Definition: MSExperiment.h:750
void set2DData(const Container &cont)
Assignment of a 2D spectrum to MSExperiment.
Definition: MSExperiment.h:275
std::vector< SpectrumType >::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSExperiment.h:103
void setIntensity(IntensityType intensity)
Mutable access to the data point intensity (height)
Definition: ChromatogramPeak.h:108
AreaIterator areaEnd()
Returns an invalid area iterator marking the end of an area.
Definition: MSExperiment.h:321
CoordinateType getMaxRT() const
returns the maximal retention time value
Definition: MSExperiment.h:539
UInt64 getSize() const
returns the total number of peaks
Definition: MSExperiment.h:555
void setRT(DoubleReal rt)
Sets the absolute retention time (is seconds)
Definition: MSSpectrum.h:221
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
void clear(bool clear_meta_data)
Clears all data and meta data.
Definition: MSExperiment.h:809
MSExperiment & operator=(const MSExperiment &source)
Assignment operator.
Definition: MSExperiment.h:199
bool empty() const
Definition: MSExperiment.h:127
Iterator RTBegin(CoordinateType rt)
Fast search for spectrum range begin.
Definition: MSExperiment.h:375
Feature::CoordinateType CoordinateType
Definition: AdditiveSeries.C:52
std::vector< SpectrumType > Base
STL base class type.
Definition: MSExperiment.h:95
A 1-dimensional raw data point or peak for chromatograms.
Definition: ChromatogramPeak.h:55
void setSpectra(const std::vector< MSSpectrum< PeakT > > &spectra)
sets the spectra list
Definition: MSExperiment.h:732
Handles the managment of a position and intensity range.
Definition: RangeManager.h:48
virtual void updateRanges()
Updates minimum and maximum position/intensity.
Definition: MSExperiment.h:403
UInt64 total_size_
Number of all data points.
Definition: MSExperiment.h:838
int Int
Signed integer type.
Definition: Types.h:100
ConstIterator getPrecursorSpectrum(ConstIterator iterator) const
Returns the precursor spectrum of the scan pointed to by iterator.
Definition: MSExperiment.h:680
Description of the experimental settings.
Definition: ExperimentalSettings.h:59
virtual void clearChildIds_()
Clears the persistence id of all sub-objects.
Definition: MSExperiment.h:827
const std::vector< MSChromatogram< ChromatogramPeakType > > & getChromatograms() const
returns the chromatogram list
Definition: MSExperiment.h:768
ConstIterator begin() const
Definition: MSExperiment.h:152
std::vector< UInt > ms_levels_
MS levels of the data.
Definition: MSExperiment.h:836
ExperimentalSettings()
Constructor.

OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:18 using doxygen 1.8.5