|
OpenMS
2.5.0
|
Go to the documentation of this file.
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);
214 template <
class Container>
217 for (
typename Base::const_iterator spec = spectra_.begin(); spec != spectra_.end(); ++spec)
219 if (spec->getMSLevel() != 1)
223 typename Container::value_type s;
224 for (
typename SpectrumType::const_iterator it = spec->begin(); it != spec->end(); ++it)
227 cont.back().setRT(spec->getRT());
228 cont.back().setMZ(it->getMZ());
229 cont.back().setIntensity(it->getIntensity());
245 template <
class Container>
248 set2DData<false, Container>(container);
265 template <
class Container>
272 for (
typename Container::const_iterator iter = container.begin(); iter != container.end(); ++iter)
275 if (current_rt != iter->getRT() || spectrum ==
nullptr)
278 if (current_rt > iter->getRT())
282 current_rt = iter->getRT();
283 spectrum = createSpec_(current_rt, store_metadata_names);
308 template <
bool add_mass_traces,
class Container>
315 for (
typename Container::const_iterator iter = container.begin(); iter != container.end(); ++iter)
318 if (current_rt != iter->getRT() || spectrum ==
nullptr)
321 if (current_rt > iter->getRT())
325 current_rt = iter->getRT();
326 spectrum = createSpec_(current_rt);
339 AreaIterator areaBegin(CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz);
346 ConstAreaIterator areaBeginConst(CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz)
const;
349 ConstAreaIterator areaEndConst()
const;
358 ConstIterator RTBegin(CoordinateType rt)
const;
367 ConstIterator RTEnd(CoordinateType rt)
const;
374 Iterator RTBegin(CoordinateType rt);
392 void updateRanges()
override;
399 void updateRanges(
Int ms_level);
402 CoordinateType getMinMZ()
const;
405 CoordinateType getMaxMZ()
const;
408 CoordinateType getMinRT()
const;
411 CoordinateType getMaxRT()
const;
418 const AreaType& getDataRange()
const;
424 const std::vector<UInt>& getMSLevels()
const;
435 void sortSpectra(
bool sort_mz =
true);
442 void sortChromatograms(
bool sort_rt =
true);
449 bool isSorted(
bool check_mz =
true)
const;
461 bool clearMetaDataArrays();
470 void getPrimaryMSRunPath(
StringList& toFill)
const;
477 ConstIterator getPrecursorSpectrum(ConstIterator iterator)
const;
483 void setSpectra(
const std::vector<MSSpectrum>& spectra);
490 spectra_.push_back(std::forward<MSSpectrum>(spectrum));
494 const std::vector<MSSpectrum>& getSpectra()
const;
497 std::vector<MSSpectrum>& getSpectra();
500 void setChromatograms(
const std::vector<MSChromatogram>& chromatograms);
507 chromatograms_.push_back(std::forward<MSChromatogram>(chrom));
511 const std::vector<MSChromatogram>& getChromatograms()
const;
514 std::vector<MSChromatogram>& getChromatograms();
525 Size getNrSpectra()
const;
528 Size getNrChromatograms()
const;
546 void clear(
bool clear_meta_data);
564 template<
typename ContainerValueType,
bool addMassTraces>
567 static void addData_(
SpectrumType* spectrum,
const ContainerValueType* item);
568 static void addData_(
SpectrumType* spectrum,
const ContainerValueType* item,
const StringList& store_metadata_names);
571 template<
typename ContainerValueType>
578 spectrum->insert(spectrum->end(),
PeakType());
579 spectrum->back().setIntensity(item->getIntensity());
580 spectrum->back().setPosition(item->getMZ());
585 addData_(spectrum, item);
586 for (StringList::const_iterator itm = store_metadata_names.begin(); itm != store_metadata_names.end(); ++itm)
588 float val = std::numeric_limits<float>::quiet_NaN();
589 if (item->metaValueExists(*itm)) val = item->getMetaValue(*itm);
595 template<
typename ContainerValueType>
601 if (item->metaValueExists(
"num_of_masstraces"))
603 Size mts = item->getMetaValue(
"num_of_masstraces");
604 int charge = (item->getCharge()==0 ? 1 : item->getCharge());
605 for (
Size i = 0; i < mts; ++i)
608 if (!item->metaValueExists(meta_name))
610 throw Exception::Precondition(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
String(
"Meta value '") + meta_name +
"' expected but not found in container.");
612 ContainerValueType p;
613 p.setIntensity(item->getMetaValue(meta_name));
642 OPENMS_DLLAPI std::ostream&
operator<<(std::ostream& os,
const MSExperiment& exp);
Peak2D PeakType
Definition: MassTrace.h:47
void set2DData(const Container &container)
Assignment of a data container with RT and MZ to an MSExperiment.
Definition: MSExperiment.h:246
OPENMS_UINT64_TYPE UInt64
Unsigned integer type (64bit)
Definition: Types.h:77
Forward iterator for an area of peaks in an experiment.
Definition: AreaIterator.h:57
std::vector< SpectrumType > Base
STL base class type.
Definition: MSExperiment.h:105
void set2DData(const Container &container)
Assignment of a data container with RT and MZ to an MSExperiment.
Definition: MSExperiment.h:309
Base::value_type value_type
Definition: MSExperiment.h:123
Description of the experimental settings.
Definition: ExperimentalSettings.h:59
A more convenient string class.
Definition: String.h:58
Iterator begin()
Definition: MSExperiment.h:157
Precondition failed exception.
Definition: Exception.h:166
bool operator!=(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:824
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
ChromatogramPeakT ChromatogramPeakType
Chromatogram peak type.
Definition: MSExperiment.h:91
PeakType::IntensityType IntensityType
Intensity type of peaks.
Definition: MSExperiment.h:97
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:266
PeakType::CoordinateType CoordinateType
Coordinate type of peak positions.
Definition: MSExperiment.h:95
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:583
Base::const_iterator const_iterator
Definition: MSExperiment.h:125
RangeManager< 2 > RangeManagerType
RangeManager type.
Definition: MSExperiment.h:99
Size size() const
Definition: MSExperiment.h:127
MSSpectrum SpectrumType
Spectrum Type.
Definition: MSExperiment.h:101
void reserve(Size s)
Definition: MSExperiment.h:142
MSChromatogram ChromatogramType
Chromatogram type.
Definition: MSExperiment.h:103
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
std::vector< SpectrumType >::iterator Iterator
Mutable iterator.
Definition: MSExperiment.h:111
Handles the management of a position and intensity range.
Definition: RangeManager.h:47
Helper class to add either general data points in set2DData or use mass traces from meta values.
Definition: MSExperiment.h:565
Base::iterator iterator
Definition: MSExperiment.h:124
ConstIterator end() const
Definition: MSExperiment.h:172
A 1-dimensional raw data point or peak for chromatograms.
Definition: ChromatogramPeak.h:54
ChromatogramPeak ChromatogramPeakT
Definition: MSExperiment.h:84
ConstIterator begin() const
Definition: MSExperiment.h:162
bool empty() const
Definition: MSExperiment.h:137
DRange< 2 > AreaType
Area type.
Definition: MSExperiment.h:93
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:54
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
void addChromatogram(MSChromatogram &&chrom)
Definition: MSExperiment.h:505
void resize(Size s)
Definition: MSExperiment.h:132
const FloatDataArrays & getFloatDataArrays() const
Returns a const reference to the float meta data arrays.
bool operator==(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:806
void addSpectrum(MSSpectrum &&spectrum)
Definition: MSExperiment.h:488
Iterator end()
Definition: MSExperiment.h:167
Peak1D PeakT
Definition: MSExperiment.h:83
The representation of a chromatogram.
Definition: MSChromatogram.h:54
static void addData_(SpectrumType *spectrum, const ContainerValueType *item)
specialization for adding feature mass traces (does not support metadata_names currently)
Definition: MSExperiment.h:599
std::vector< UInt > ms_levels_
MS levels of the data.
Definition: MSExperiment.h:551
std::vector< MSChromatogram > chromatograms_
chromatograms
Definition: MSExperiment.h:556
void get2DData(Container &cont) const
Reads out a 2D Spectrum.
Definition: MSExperiment.h:215
std::vector< SpectrumType >::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSExperiment.h:113
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
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
const double C13C12_MASSDIFF_U
static void addData_(SpectrumType *spectrum, const ContainerValueType *item)
general method for adding data points
Definition: MSExperiment.h:575
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
UInt64 total_size_
Number of all data points.
Definition: MSExperiment.h:553
std::vector< SpectrumType > spectra_
spectra
Definition: MSExperiment.h:559