51 class ChromatogramPeak;
105 typedef std::vector<SpectrumType>
Base;
110 typedef std::vector<SpectrumType>::iterator
Iterator;
129 return spectra_.size();
139 return spectra_.empty();
159 return spectra_.begin();
164 return spectra_.begin();
169 return spectra_.end();
174 return spectra_.end();
179 void reserveSpaceSpectra(
Size s);
180 void reserveSpaceChromatograms(
Size s);
208 template <
class Container>
211 for (
typename Base::const_iterator spec = spectra_.begin(); spec != spectra_.end(); ++spec)
213 if (spec->getMSLevel() != 1)
217 typename Container::value_type s;
218 for (
typename SpectrumType::const_iterator it = spec->begin(); it != spec->end(); ++it)
221 cont.back().setRT(spec->getRT());
222 cont.back().setMZ(it->getMZ());
223 cont.back().setIntensity(it->getIntensity());
239 template <
class Container>
242 set2DData<false, Container>(container);
259 template <
class Container>
266 for (
typename Container::const_iterator iter = container.begin(); iter != container.end(); ++iter)
269 if (current_rt != iter->getRT() || spectrum ==
nullptr)
272 if (current_rt > iter->getRT())
276 current_rt = iter->getRT();
277 spectrum = createSpec_(current_rt, store_metadata_names);
302 template <
bool add_mass_traces,
class Container>
309 for (
typename Container::const_iterator iter = container.begin(); iter != container.end(); ++iter)
312 if (current_rt != iter->getRT() || spectrum ==
nullptr)
315 if (current_rt > iter->getRT())
319 current_rt = iter->getRT();
320 spectrum = createSpec_(current_rt);
333 AreaIterator areaBegin(CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz);
340 ConstAreaIterator areaBeginConst(CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz)
const;
343 ConstAreaIterator areaEndConst()
const;
352 ConstIterator RTBegin(CoordinateType rt)
const;
361 ConstIterator RTEnd(CoordinateType rt)
const;
368 Iterator RTBegin(CoordinateType rt);
375 Iterator RTEnd(CoordinateType rt);
386 void updateRanges()
override;
393 void updateRanges(
Int ms_level);
396 CoordinateType getMinMZ()
const;
399 CoordinateType getMaxMZ()
const;
402 CoordinateType getMinRT()
const;
405 CoordinateType getMaxRT()
const;
412 const AreaType & getDataRange()
const;
418 const std::vector<UInt> & getMSLevels()
const;
429 void sortSpectra(
bool sort_mz =
true);
436 void sortChromatograms(
bool sort_rt =
true);
443 bool isSorted(
bool check_mz =
true)
const;
455 bool clearMetaDataArrays();
464 void getPrimaryMSRunPath(
StringList& toFill)
const;
471 ConstIterator getPrecursorSpectrum(ConstIterator iterator)
const;
477 void setSpectra(
const std::vector<MSSpectrum> & spectra);
480 void addSpectrum(
const MSSpectrum & spectrum);
483 const std::vector<MSSpectrum> & getSpectra()
const;
486 std::vector<MSSpectrum> & getSpectra();
489 void setChromatograms(
const std::vector<MSChromatogram > & chromatograms);
495 const std::vector<MSChromatogram > & getChromatograms()
const;
498 std::vector<MSChromatogram > & getChromatograms();
509 Size getNrSpectra()
const;
512 Size getNrChromatograms()
const;
523 void clear(
bool clear_meta_data);
542 template<
typename ContainerValueType,
bool addMassTraces>
545 static void addData_(
SpectrumType* spectrum,
const ContainerValueType* item);
546 static void addData_(
SpectrumType* spectrum,
const ContainerValueType* item,
const StringList& store_metadata_names);
549 template<
typename ContainerValueType>
556 spectrum->insert(spectrum->end(),
PeakType());
557 spectrum->back().setIntensity(item->getIntensity());
558 spectrum->back().setPosition(item->getMZ());
563 addData_(spectrum, item);
564 for (StringList::const_iterator itm = store_metadata_names.begin(); itm != store_metadata_names.end(); ++itm)
566 float val = std::numeric_limits<float>::quiet_NaN();
567 if (item->metaValueExists(*itm)) val = item->getMetaValue(*itm);
573 template<
typename ContainerValueType>
579 if (item->metaValueExists(
"num_of_masstraces"))
581 Size mts = item->getMetaValue(
"num_of_masstraces");
582 int charge = (item->getCharge()==0 ? 1 : item->getCharge());
583 for (
Size i = 0; i < mts; ++i)
586 if (!item->metaValueExists(meta_name))
588 throw Exception::Precondition(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
String(
"Meta value '") + meta_name +
"' expected but not found in container.");
590 ContainerValueType p;
591 p.setIntensity(item->getMetaValue(meta_name));
621 std::ostream &
operator<<(std::ostream & os,
const MSExperiment & exp);
const double C13C12_MASSDIFF_U
A more convenient string class.
Definition: String.h:57
void set2DData(const Container &container)
Assignment of a data container with RT and MZ to an MSExperiment.
Definition: MSExperiment.h:303
static void addData_(SpectrumType *spectrum, const ContainerValueType *item)
general method for adding data points
Definition: MSExperiment.h:553
std::vector< SpectrumType >::iterator Iterator
Mutable iterator.
Definition: MSExperiment.h:111
Peak1D PeakT
Definition: MSExperiment.h:83
The representation of a chromatogram.
Definition: MSChromatogram.h:54
Base::value_type value_type
Definition: MSExperiment.h:123
Peak2D PeakType
Definition: MassTrace.h:47
ChromatogramPeakT ChromatogramPeakType
Chromatogram peak type.
Definition: MSExperiment.h:91
Forward iterator for an area of peaks in an experiment.
Definition: AreaIterator.h:57
ConstIterator end() const
Definition: MSExperiment.h:172
std::vector< MSChromatogram > chromatograms_
chromatograms
Definition: MSExperiment.h:534
Iterator begin()
Definition: MSExperiment.h:157
bool operator==(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:806
Base::const_iterator const_iterator
Definition: MSExperiment.h:125
void resize(Size s)
Definition: MSExperiment.h:132
PeakType::IntensityType IntensityType
Intensity type of peaks.
Definition: MSExperiment.h:97
Size size() const
Definition: MSExperiment.h:127
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
Precondition failed exception.
Definition: Exception.h:166
const FloatDataArrays & getFloatDataArrays() const
Returns a const reference to the float meta data arrays.
MSSpectrum SpectrumType
Spectrum Type.
Definition: MSExperiment.h:101
RangeManager< 2 > RangeManagerType
RangeManager type.
Definition: MSExperiment.h:99
Iterator end()
Definition: MSExperiment.h:167
Base::iterator iterator
Definition: MSExperiment.h:124
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
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:115
void reserve(Size s)
Definition: MSExperiment.h:142
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:260
Helper class to add either general data points in set2DData or use mass traces from meta values...
Definition: MSExperiment.h:543
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:54
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
ChromatogramPeak ChromatogramPeakT
Definition: MSExperiment.h:84
PeakType::CoordinateType CoordinateType
Coordinate type of peak positions.
Definition: MSExperiment.h:95
bool empty() const
Definition: MSExperiment.h:137
OPENMS_UINT64_TYPE UInt64
Unsigned integer type (64bit)
Definition: Types.h:77
std::vector< SpectrumType > spectra_
spectra
Definition: MSExperiment.h:537
DRange< 2 > AreaType
Area type.
Definition: MSExperiment.h:93
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:73
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
MSChromatogram ChromatogramType
Chromatogram type.
Definition: MSExperiment.h:103
std::vector< SpectrumType >::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSExperiment.h:113
bool operator!=(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:824
static void addData_(SpectrumType *spectrum, const ContainerValueType *item)
specialization for adding feature mass traces (does not support metadata_names currently) ...
Definition: MSExperiment.h:577
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
void get2DData(Container &cont) const
Reads out a 2D Spectrum.
Definition: MSExperiment.h:209
std::vector< SpectrumType > Base
STL base class type.
Definition: MSExperiment.h:105
A 1-dimensional raw data point or peak for chromatograms.
Definition: ChromatogramPeak.h:54
Handles the management of a position and intensity range.
Definition: RangeManager.h:47
void set2DData(const Container &container)
Assignment of a data container with RT and MZ to an MSExperiment.
Definition: MSExperiment.h:240
ConstIterator begin() const
Definition: MSExperiment.h:162
UInt64 total_size_
Number of all data points.
Definition: MSExperiment.h:531
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:561
int Int
Signed integer type.
Definition: Types.h:102
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:117
Description of the experimental settings.
Definition: ExperimentalSettings.h:58
std::vector< UInt > ms_levels_
MS levels of the data.
Definition: MSExperiment.h:529