OpenMS  2.8.0
Classes | Public Types | Public Member Functions | List of all members
MSExperiment Class Referencefinal

In-Memory representation of a mass spectrometry run. More...

#include <OpenMS/KERNEL/MSExperiment.h>

Inheritance diagram for MSExperiment:
[legend]
Collaboration diagram for MSExperiment:
[legend]

Classes

struct  ContainerAdd_
 Helper class to add either general data points in set2DData or use mass traces from meta values. More...
 
struct  ContainerAdd_< ContainerValueType, false >
 
struct  ContainerAdd_< ContainerValueType, true >
 

Public Types

typedef Peak1D PeakT
 
typedef ChromatogramPeak ChromatogramPeakT
 
Base type definitions
typedef PeakT PeakType
 Peak type. More...
 
typedef ChromatogramPeakT ChromatogramPeakType
 Chromatogram peak type. More...
 
typedef PeakType::CoordinateType CoordinateType
 Coordinate type of peak positions. More...
 
typedef PeakType::IntensityType IntensityType
 Intensity type of peaks. More...
 
typedef RangeManager< RangeRT, RangeMZ, RangeIntensityRangeManagerType
 RangeManager type. More...
 
typedef RangeManagerContainer< RangeRT, RangeMZ, RangeIntensityRangeManagerContainerType
 RangeManager type. More...
 
typedef MSSpectrum SpectrumType
 Spectrum Type. More...
 
typedef MSChromatogram ChromatogramType
 Chromatogram type. More...
 
typedef std::vector< SpectrumTypeBase
 STL base class type. More...
 
Iterator type definitions
typedef std::vector< SpectrumType >::iterator Iterator
 Mutable iterator. More...
 
typedef std::vector< SpectrumType >::const_iterator ConstIterator
 Non-mutable iterator. More...
 
typedef Internal::AreaIterator< PeakT, PeakT &, PeakT *, Iterator, SpectrumType::IteratorAreaIterator
 Mutable area iterator type (for traversal of a rectangular subset of the peaks) More...
 
typedef Internal::AreaIterator< const PeakT, const PeakT &, const PeakT *, ConstIterator, SpectrumType::ConstIteratorConstAreaIterator
 Immutable area iterator type (for traversal of a rectangular subset of the peaks) More...
 

Public Member Functions

UInt64 getSqlRunID () const
 
void setSqlRunID (UInt64 id)
 sets the run-ID which is used when storing an sqMass file More...
 
Conversion to/from 2D data
template<class Container >
void get2DData (Container &cont) const
 Reads out a 2D Spectrum. More...
 
template<class Container >
void set2DData (const Container &container)
 Assignment of a data container with RT and MZ to an MSExperiment. More...
 
template<class Container >
void set2DData (const Container &container, const StringList &store_metadata_names)
 Assignment of a data container with RT and MZ to an MSExperiment. More...
 
template<bool add_mass_traces, class Container >
void set2DData (const Container &container)
 Assignment of a data container with RT and MZ to an MSExperiment. More...
 
Iterating ranges and areas
AreaIterator areaBegin (CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz)
 Returns an area iterator for area. More...
 
AreaIterator areaEnd ()
 Returns an invalid area iterator marking the end of an area. More...
 
ConstAreaIterator areaBeginConst (CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz) const
 Returns a non-mutable area iterator for area. More...
 
ConstAreaIterator areaEndConst () const
 Returns an non-mutable invalid area iterator marking the end of an area. More...
 
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
 
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
 
ConstIterator RTBegin (CoordinateType rt) const
 Fast search for spectrum range begin. More...
 
ConstIterator RTEnd (CoordinateType rt) const
 Fast search for spectrum range end (returns the past-the-end iterator) More...
 
Iterator RTBegin (CoordinateType rt)
 Fast search for spectrum range begin. More...
 
Iterator RTEnd (CoordinateType rt)
 Fast search for spectrum range end (returns the past-the-end iterator) More...
 
Range methods
Note
The range values (min, max, etc.) are not updated automatically. Call updateRanges() to update the values!
void updateRanges () override
 
void updateRanges (Int ms_level)
 Updates the m/z, intensity, retention time and MS level ranges of all spectra with a certain ms level. More...
 
CoordinateType getMinMZ () const
 returns the minimal m/z value More...
 
CoordinateType getMaxMZ () const
 returns the maximal m/z value More...
 
CoordinateType getMinRT () const
 returns the minimal retention time value More...
 
CoordinateType getMaxRT () const
 returns the maximal retention time value More...
 
UInt64 getSize () const
 returns the total number of peaks More...
 
const std::vector< UInt > & getMSLevels () const
 returns an array of MS levels More...
 
Sorting spectra and peaks
void sortSpectra (bool sort_mz=true)
 Sorts the data points by retention time. More...
 
void sortChromatograms (bool sort_rt=true)
 Sorts the data points of the chromatograms by m/z. More...
 
bool isSorted (bool check_mz=true) const
 Checks if all spectra are sorted with respect to ascending RT. More...
 
void reset ()
 Clear all internal data (spectra, ranges, metadata) More...
 
bool clearMetaDataArrays ()
 Clears the meta data arrays of all contained spectra (float, integer and string arrays) More...
 
const ExperimentalSettingsgetExperimentalSettings () const
 returns the meta information of this experiment (const access) More...
 
ExperimentalSettingsgetExperimentalSettings ()
 returns the meta information of this experiment (mutable access) More...
 
void getPrimaryMSRunPath (StringList &toFill) const
 get the file path to the first MS run More...
 
ConstIterator getPrecursorSpectrum (ConstIterator iterator) const
 Returns the precursor spectrum of the scan pointed to by iterator. More...
 
int getPrecursorSpectrum (int zero_based_index) const
 Returns the index of the precursor spectrum for spectrum at index zero_based_index. More...
 
void swap (MSExperiment &from)
 Swaps the content of this map with the content of from. More...
 
void setSpectra (const std::vector< MSSpectrum > &spectra)
 sets the spectrum list More...
 
void setSpectra (std::vector< MSSpectrum > &&spectra)
 
void addSpectrum (const MSSpectrum &spectrum)
 adds a spectrum to the list More...
 
void addSpectrum (MSSpectrum &&spectrum)
 
const std::vector< MSSpectrum > & getSpectra () const
 returns the spectrum list More...
 
std::vector< MSSpectrum > & getSpectra ()
 returns the spectrum list (mutable) More...
 
void setChromatograms (const std::vector< MSChromatogram > &chromatograms)
 sets the chromatogram list More...
 
void setChromatograms (std::vector< MSChromatogram > &&chromatograms)
 
void addChromatogram (const MSChromatogram &chromatogram)
 adds a chromatogram to the list More...
 
void addChromatogram (MSChromatogram &&chrom)
 
const std::vector< MSChromatogram > & getChromatograms () const
 returns the chromatogram list More...
 
std::vector< MSChromatogram > & getChromatograms ()
 returns the chromatogram list (mutable) More...
 
- Public Member Functions inherited from RangeManagerContainer< RangeRT, RangeMZ, RangeIntensity >
const RangeManager< RangeBases... > & getRange () const
 get range of current data (call updateRanges() before to ensure the range is accurate) More...
 
RangeManager< RangeBases... > & getRange ()
 get mutable range, provided for efficiency reasons (avoid updateRanges(), if only minor changes were made) More...
 
- Public Member Functions inherited from RangeManager< RangeBases... >
bool operator== (const RangeManager &rhs) const
 
bool assignUnsafe (const RangeManager< RangeBasesOther... > &rhs)
 
void assign (const RangeManager< RangeBasesOther... > &rhs)
 
bool extendUnsafe (const RangeManager< RangeBasesOther... > &rhs)
 
void extend (const RangeManager< RangeBasesOther... > &rhs)
 
void scaleBy (const double factor)
 calls RangeBase::scale() for each dimension More...
 
RangeBasegetRangeForDim (MSDim dim)
 obtain a range dimension at runtime using dim More...
 
HasRangeType hasRange () const
 is any/some/all dimension in this range populated? More...
 
bool containsAll (const RangeManager< RangeBasesOther... > &rhs) const
 
void clearRanges ()
 Resets all ranges. More...
 
void printRange (std::ostream &out) const
 print each dimension (base classes) to a stream More...
 
- Public Member Functions inherited from ExperimentalSettings
 ExperimentalSettings ()=default
 Constructor. More...
 
 ExperimentalSettings (const ExperimentalSettings &)=default
 Copy constructor. More...
 
 ExperimentalSettings (ExperimentalSettings &&)=default
 Move constructor. More...
 
 ~ExperimentalSettings () override
 Destructor. More...
 
ExperimentalSettingsoperator= (const ExperimentalSettings &)=default
 Assignment operator. More...
 
ExperimentalSettingsoperator= (ExperimentalSettings &&) &=default
 Move assignment operator. More...
 
bool operator== (const ExperimentalSettings &rhs) const
 Equality operator. More...
 
bool operator!= (const ExperimentalSettings &rhs) const
 Equality operator. More...
 
const SamplegetSample () const
 returns a const reference to the sample description More...
 
SamplegetSample ()
 returns a mutable reference to the sample description More...
 
void setSample (const Sample &sample)
 sets the sample description More...
 
const std::vector< SourceFile > & getSourceFiles () const
 returns a const reference to the source data file More...
 
std::vector< SourceFile > & getSourceFiles ()
 returns a mutable reference to the source data file More...
 
void setSourceFiles (const std::vector< SourceFile > &source_files)
 sets the source data file More...
 
const std::vector< ContactPerson > & getContacts () const
 returns a const reference to the list of contact persons More...
 
std::vector< ContactPerson > & getContacts ()
 returns a mutable reference to the list of contact persons More...
 
void setContacts (const std::vector< ContactPerson > &contacts)
 sets the list of contact persons More...
 
const InstrumentgetInstrument () const
 returns a const reference to the MS instrument description More...
 
InstrumentgetInstrument ()
 returns a mutable reference to the MS instrument description More...
 
void setInstrument (const Instrument &instrument)
 sets the MS instrument description More...
 
const HPLCgetHPLC () const
 returns a const reference to the description of the HPLC run More...
 
HPLCgetHPLC ()
 returns a mutable reference to the description of the HPLC run More...
 
void setHPLC (const HPLC &hplc)
 sets the description of the HPLC run More...
 
const DateTimegetDateTime () const
 returns the date the experiment was performed More...
 
void setDateTime (const DateTime &date)
 sets the date the experiment was performed More...
 
const StringgetComment () const
 returns the free-text comment More...
 
void setComment (const String &comment)
 sets the free-text comment More...
 
const std::vector< ProteinIdentification > & getProteinIdentifications () const
 returns a const reference to the protein ProteinIdentification vector More...
 
std::vector< ProteinIdentification > & getProteinIdentifications ()
 returns a mutable reference to the protein ProteinIdentification vector More...
 
void setProteinIdentifications (const std::vector< ProteinIdentification > &protein_identifications)
 sets the protein ProteinIdentification vector More...
 
const StringgetFractionIdentifier () const
 returns fraction identifier More...
 
void setFractionIdentifier (const String &fraction_identifier)
 sets the fraction identifier More...
 
- Public Member Functions inherited from MetaInfoInterface
 MetaInfoInterface ()
 Constructor. More...
 
 MetaInfoInterface (const MetaInfoInterface &rhs)
 Copy constructor. More...
 
 MetaInfoInterface (MetaInfoInterface &&) noexcept
 Move constructor. More...
 
 ~MetaInfoInterface ()
 Destructor. More...
 
MetaInfoInterfaceoperator= (const MetaInfoInterface &rhs)
 Assignment operator. More...
 
MetaInfoInterfaceoperator= (MetaInfoInterface &&) noexcept
 Move assignment operator. More...
 
void swap (MetaInfoInterface &rhs)
 Swap contents. More...
 
bool operator== (const MetaInfoInterface &rhs) const
 Equality operator. More...
 
bool operator!= (const MetaInfoInterface &rhs) const
 Equality operator. More...
 
const DataValuegetMetaValue (const String &name, const DataValue &default_value=DataValue::EMPTY) const
 Returns the value corresponding to a string, or a default value (default: DataValue::EMPTY) if not found. More...
 
const DataValuegetMetaValue (UInt index, const DataValue &default_value=DataValue::EMPTY) const
 Returns the value corresponding to an index, or a default value (default: DataValue::EMPTY) if not found. More...
 
bool metaValueExists (const String &name) const
 Returns whether an entry with the given name exists. More...
 
bool metaValueExists (UInt index) const
 Returns whether an entry with the given index exists. More...
 
void setMetaValue (const String &name, const DataValue &value)
 Sets the DataValue corresponding to a name. More...
 
void setMetaValue (UInt index, const DataValue &value)
 Sets the DataValue corresponding to an index. More...
 
void removeMetaValue (const String &name)
 Removes the DataValue corresponding to name if it exists. More...
 
void removeMetaValue (UInt index)
 Removes the DataValue corresponding to index if it exists. More...
 
void addMetaValues (const MetaInfoInterface &from)
 function to copy all meta values from one object to this one More...
 
void getKeys (std::vector< String > &keys) const
 Fills the given vector with a list of all keys for which a value is set. More...
 
void getKeys (std::vector< UInt > &keys) const
 Fills the given vector with a list of all keys for which a value is set. More...
 
bool isMetaEmpty () const
 Returns if the MetaInfo is empty. More...
 
void clearMetaInfo ()
 Removes all meta values. More...
 
- Public Member Functions inherited from DocumentIdentifier
 DocumentIdentifier ()
 Default constructor. More...
 
 DocumentIdentifier (const DocumentIdentifier &)=default
 Copy constructor. More...
 
 DocumentIdentifier (DocumentIdentifier &&)=default
 Move constructor. More...
 
virtual ~DocumentIdentifier ()
 Destructor. More...
 
DocumentIdentifieroperator= (const DocumentIdentifier &)=default
 Assignment operator. More...
 
DocumentIdentifieroperator= (DocumentIdentifier &&) &=default
 Move assignment operator. More...
 
bool operator== (const DocumentIdentifier &rhs) const
 Equality operator. More...
 
void setIdentifier (const String &id)
 set document identifier (e.g. an LSID) More...
 
const StringgetIdentifier () const
 retrieve document identifier (e.g. an LSID) More...
 
void swap (DocumentIdentifier &from)
 exchange content with from More...
 
void setLoadedFilePath (const String &file_name)
 set the file_name_ according to absolute path of the file loaded from preferably done whilst loading More...
 
const StringgetLoadedFilePath () const
 get the file_name_ which is the absolute path to the file loaded from More...
 
void setLoadedFileType (const String &file_name)
 set the file_type according to the type of the file loaded from (see FileHandler::Type) preferably done whilst loading More...
 
const FileTypes::TypegetLoadedFileType () const
 get the file_type (e.g. featureXML, consensusXML, mzData, mzXML, mzML, ...) of the file loaded from More...
 

Delegations of calls to the vector of MSSpectra

typedef Base::value_type value_type
 
typedef Base::iterator iterator
 
typedef Base::const_iterator const_iterator
 
Size size () const
 
void resize (Size s)
 
bool empty () const
 
void reserve (Size s)
 
SpectrumTypeoperator[] (Size n)
 
const SpectrumTypeoperator[] (Size n) const
 
Iterator begin ()
 
ConstIterator begin () const
 
Iterator end ()
 
ConstIterator end () const
 
void reserveSpaceSpectra (Size s)
 
void reserveSpaceChromatograms (Size s)
 
 MSExperiment ()
 Constructor. More...
 
 MSExperiment (const MSExperiment &source)
 Copy constructor. More...
 
 MSExperiment (MSExperiment &&)=default
 Move constructor. More...
 
MSExperimentoperator= (const MSExperiment &source)
 Assignment operator. More...
 
MSExperimentoperator= (MSExperiment &&) &=default
 Move assignment operator. More...
 
MSExperimentoperator= (const ExperimentalSettings &source)
 Assignment operator. More...
 
bool operator== (const MSExperiment &rhs) const
 Equality operator. More...
 
bool operator!= (const MSExperiment &rhs) const
 Equality operator. More...
 

Easy Access interface

std::vector< UIntms_levels_
 MS levels of the data. More...
 
UInt64 total_size_
 Number of all data points. More...
 
std::vector< MSChromatogramchromatograms_
 chromatograms More...
 
std::vector< SpectrumTypespectra_
 spectra More...
 
MSChromatogramgetChromatogram (Size id)
 returns a single chromatogram More...
 
MSSpectrumgetSpectrum (Size id)
 returns a single spectrum More...
 
Size getNrSpectra () const
 get the total number of spectra available More...
 
Size getNrChromatograms () const
 get the total number of chromatograms available More...
 
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). More...
 
void clear (bool clear_meta_data)
 Clears all data and meta data. More...
 
bool containsScanOfLevel (size_t ms_level) const
 returns true if at least one of the spectra has the specified level More...
 
bool hasZeroIntensities (size_t ms_level) const
 returns true if any MS spectra of the specified level contain at least one peak with intensity of 0.0 More...
 
bool hasPeptideIdentifications () const
 do any of the spectra have a PeptideID? More...
 
SpectrumTypecreateSpec_ (PeakType::CoordinateType rt)
 
SpectrumTypecreateSpec_ (PeakType::CoordinateType rt, const StringList &metadata_names)
 

Additional Inherited Members

- Static Public Member Functions inherited from MetaInfoInterface
static MetaInfoRegistrymetaRegistry ()
 Returns a reference to the MetaInfoRegistry. More...
 
- Protected Member Functions inherited from RangeManager< RangeBases... >
void for_each_base_ (Visitor &&visitor)
 use fold expression to iterate over all RangeBases of RangeManager and apply a lambda (Visitor) for each one More...
 
void for_each_base_ (Visitor &&visitor) const
 .. and a const version More...
 
- Protected Member Functions inherited from MetaInfoInterface
void createIfNotExists_ ()
 Creates the MetaInfo object if it does not exist. More...
 
- Static Protected Member Functions inherited from RangeManager< RangeBases... >
static void static_for_each_base_ (Visitor &&visitor)
 use fold expression to iterate over all RangeBases of RangeManager and apply a lambda (Visitor) for each one (for static members) More...
 
- Protected Attributes inherited from ExperimentalSettings
Sample sample_
 
std::vector< SourceFilesource_files_
 
std::vector< ContactPersoncontacts_
 
Instrument instrument_
 
HPLC hplc_
 
DateTime datetime_
 
String comment_
 
std::vector< ProteinIdentificationprotein_identifications_
 
String fraction_identifier_
 
- Protected Attributes inherited from MetaInfoInterface
MetaInfometa_
 Pointer to the MetaInfo object (0 by default) More...
 
- Protected Attributes inherited from DocumentIdentifier
String id_
 the ID (e.g. LSID) More...
 
String file_path_
 the path to the loaded file More...
 
FileTypes::Type file_type_
 the type of the loaded file More...
 

Detailed Description

In-Memory representation of a mass spectrometry run.

This representation of an MS run is organized as list of spectra and chromatograms and provides an in-memory representation of popular mass-spectrometric file formats such as mzXML or mzML. The meta-data associated with an experiment is contained in ExperimentalSettings (by inheritance) while the raw data (as well as spectra and chromatogram level meta data) is stored in objects of type MSSpectrum and MSChromatogram, which are accessible through the getSpectrum and getChromatogram functions.

Note
For range operations, see RangeUtils module!
Some of the meta data is associated with the spectra directly (e.g. DataProcessing) and therefore the spectra need to be present to retain this information.
For an on-disc representation of an MS experiment, see OnDiskExperiment.

Member Typedef Documentation

◆ AreaIterator

Mutable area iterator type (for traversal of a rectangular subset of the peaks)

◆ Base

typedef std::vector<SpectrumType> Base

STL base class type.

◆ ChromatogramPeakT

◆ ChromatogramPeakType

Chromatogram peak type.

◆ ChromatogramType

Chromatogram type.

◆ const_iterator

typedef Base::const_iterator const_iterator

◆ ConstAreaIterator

Immutable area iterator type (for traversal of a rectangular subset of the peaks)

◆ ConstIterator

typedef std::vector<SpectrumType>::const_iterator ConstIterator

Non-mutable iterator.

◆ CoordinateType

Coordinate type of peak positions.

◆ IntensityType

Intensity type of peaks.

◆ Iterator

typedef std::vector<SpectrumType>::iterator Iterator

Mutable iterator.

◆ iterator

typedef Base::iterator iterator

◆ PeakT

typedef Peak1D PeakT

◆ PeakType

typedef PeakT PeakType

Peak type.

◆ RangeManagerContainerType

RangeManager type.

◆ RangeManagerType

RangeManager type.

◆ SpectrumType

Spectrum Type.

◆ value_type

typedef Base::value_type value_type

Constructor & Destructor Documentation

◆ MSExperiment() [1/3]

Constructor.

◆ MSExperiment() [2/3]

MSExperiment ( const MSExperiment source)

Copy constructor.

◆ MSExperiment() [3/3]

MSExperiment ( MSExperiment &&  )
default

Move constructor.

Member Function Documentation

◆ addChromatogram() [1/2]

void addChromatogram ( const MSChromatogram chromatogram)

adds a chromatogram to the list

◆ addChromatogram() [2/2]

void addChromatogram ( MSChromatogram &&  chrom)

◆ addSpectrum() [1/2]

void addSpectrum ( const MSSpectrum spectrum)

◆ addSpectrum() [2/2]

void addSpectrum ( MSSpectrum &&  spectrum)

◆ areaBegin()

AreaIterator areaBegin ( CoordinateType  min_rt,
CoordinateType  max_rt,
CoordinateType  min_mz,
CoordinateType  max_mz 
)

Returns an area iterator for area.

◆ areaBeginConst()

ConstAreaIterator areaBeginConst ( CoordinateType  min_rt,
CoordinateType  max_rt,
CoordinateType  min_mz,
CoordinateType  max_mz 
) const

Returns a non-mutable area iterator for area.

◆ areaEnd()

AreaIterator areaEnd ( )

Returns an invalid area iterator marking the end of an area.

◆ areaEndConst()

ConstAreaIterator areaEndConst ( ) const

Returns an non-mutable invalid area iterator marking the end of an area.

◆ begin() [1/2]

Iterator begin ( )
inline

◆ begin() [2/2]

ConstIterator begin ( ) const
inline

◆ calculateTIC()

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).

By default, each MS spectrum's intensity just gets summed up. Regular RT bins can be obtained by specifying rt_bin_size. If a bin size in RT seconds greater than 0 is given resampling is used.

Parameters
bin_sizeRT bin size in seconds (0 = no resampling)
ms_levelMS level of spectra for calculation (0 = all levels)
Returns
TIC Chromatogram

Referenced by DTA2DFile::storeTIC().

◆ clear()

void clear ( bool  clear_meta_data)

Clears all data and meta data.

Parameters
clear_meta_dataIf true, all meta data is cleared in addition to the data.

Referenced by SpectraMerger::mergeSpectra_(), PeakPickerIterative::pickExperiment(), and IsotopeWaveletTransform< PeakType >::updateBoxStates().

◆ clearMetaDataArrays()

bool clearMetaDataArrays ( )

Clears the meta data arrays of all contained spectra (float, integer and string arrays)

Returns
true if meta data arrays were present and removed. false otherwise.

◆ containsScanOfLevel()

bool containsScanOfLevel ( size_t  ms_level) const

returns true if at least one of the spectra has the specified level

◆ createSpec_() [1/2]

SpectrumType* createSpec_ ( PeakType::CoordinateType  rt)
private

◆ createSpec_() [2/2]

SpectrumType* createSpec_ ( PeakType::CoordinateType  rt,
const StringList metadata_names 
)
private

◆ empty()

bool empty ( ) const
inline

◆ end() [1/2]

Iterator end ( )
inline

◆ end() [2/2]

ConstIterator end ( ) const
inline

◆ get2DData()

void get2DData ( Container &  cont) const
inline

Reads out a 2D Spectrum.

Container can be a PeakArray or an STL container of peaks which supports push_back(), end() and back()

◆ get2DPeakData() [1/2]

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
inline

◆ get2DPeakData() [2/2]

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
inline

◆ getChromatogram()

MSChromatogram& getChromatogram ( Size  id)

returns a single chromatogram

Referenced by SavitzkyGolayFilter::filterExperiment().

◆ getChromatograms() [1/2]

std::vector<MSChromatogram>& getChromatograms ( )

returns the chromatogram list (mutable)

◆ getChromatograms() [2/2]

const std::vector<MSChromatogram>& getChromatograms ( ) const

returns the chromatogram list

Referenced by SavitzkyGolayFilter::filterExperiment().

◆ getExperimentalSettings() [1/2]

ExperimentalSettings& getExperimentalSettings ( )

returns the meta information of this experiment (mutable access)

◆ getExperimentalSettings() [2/2]

const ExperimentalSettings& getExperimentalSettings ( ) const

returns the meta information of this experiment (const access)

Referenced by XMassFile::importExperimentalSettings().

◆ getMaxMZ()

CoordinateType getMaxMZ ( ) const

returns the maximal m/z value

◆ getMaxRT()

CoordinateType getMaxRT ( ) const

returns the maximal retention time value

◆ getMinMZ()

CoordinateType getMinMZ ( ) const

returns the minimal m/z value

◆ getMinRT()

CoordinateType getMinRT ( ) const

returns the minimal retention time value

◆ getMSLevels()

const std::vector<UInt>& getMSLevels ( ) const

returns an array of MS levels

◆ getNrChromatograms()

Size getNrChromatograms ( ) const

get the total number of chromatograms available

◆ getNrSpectra()

Size getNrSpectra ( ) const

get the total number of spectra available

Referenced by NucleicAcidSearchEngine::main_().

◆ getPrecursorSpectrum() [1/2]

ConstIterator getPrecursorSpectrum ( ConstIterator  iterator) const

Returns the precursor spectrum of the scan pointed to by iterator.

If there is no precursor scan the past-the-end iterator is returned.

◆ getPrecursorSpectrum() [2/2]

int getPrecursorSpectrum ( int  zero_based_index) const

Returns the index of the precursor spectrum for spectrum at index zero_based_index.

If there is no precursor scan -1 is returned.

◆ getPrimaryMSRunPath()

void getPrimaryMSRunPath ( StringList toFill) const

get the file path to the first MS run

Referenced by NucleicAcidSearchEngine::main_().

◆ getSize()

UInt64 getSize ( ) const

returns the total number of peaks

◆ getSpectra() [1/2]

std::vector<MSSpectrum>& getSpectra ( )

returns the spectrum list (mutable)

◆ getSpectra() [2/2]

const std::vector<MSSpectrum>& getSpectra ( ) const

returns the spectrum list

Referenced by SpectraMerger::mergeSpectra_().

◆ getSpectrum()

MSSpectrum& getSpectrum ( Size  id)

returns a single spectrum

◆ getSqlRunID()

UInt64 getSqlRunID ( ) const

If the file is loaded from an sqMass file, this run-ID allows to connect to the corresponding OSW identification file If the run-ID was not stored (older version) or this MSExperiment was not loaded from sqMass, then 0 is returned.

◆ hasPeptideIdentifications()

bool hasPeptideIdentifications ( ) const

do any of the spectra have a PeptideID?

◆ hasZeroIntensities()

bool hasZeroIntensities ( size_t  ms_level) const

returns true if any MS spectra of the specified level contain at least one peak with intensity of 0.0

◆ isSorted()

bool isSorted ( bool  check_mz = true) const

Checks if all spectra are sorted with respect to ascending RT.

Parameters
check_mzif true, checks if all peaks are sorted with respect to ascending m/z

◆ operator!=()

bool operator!= ( const MSExperiment rhs) const

Equality operator.

◆ operator=() [1/3]

MSExperiment& operator= ( const ExperimentalSettings source)

Assignment operator.

◆ operator=() [2/3]

MSExperiment& operator= ( const MSExperiment source)

Assignment operator.

◆ operator=() [3/3]

MSExperiment& operator= ( MSExperiment &&  ) &
default

Move assignment operator.

◆ operator==()

bool operator== ( const MSExperiment rhs) const

Equality operator.

◆ operator[]() [1/2]

SpectrumType& operator[] ( Size  n)
inline

◆ operator[]() [2/2]

const SpectrumType& operator[] ( Size  n) const
inline

◆ reserve()

void reserve ( Size  s)
inline

◆ reserveSpaceChromatograms()

void reserveSpaceChromatograms ( Size  s)

◆ reserveSpaceSpectra()

void reserveSpaceSpectra ( Size  s)

◆ reset()

void reset ( )

Clear all internal data (spectra, ranges, metadata)

Referenced by InspectOutfile::getExperiment(), MascotGenericFile::load(), MascotInfile::load(), MS2File::load(), and DTA2DFile::load().

◆ resize()

void resize ( Size  s)
inline

◆ RTBegin() [1/2]

Iterator RTBegin ( CoordinateType  rt)

Fast search for spectrum range begin.

Note
Make sure the spectra are sorted with respect to retention time! Otherwise the result is undefined.

◆ RTBegin() [2/2]

ConstIterator RTBegin ( CoordinateType  rt) const

Fast search for spectrum range begin.

Returns the first scan which has equal or higher (>=) RT than rt.

Note
Make sure the spectra are sorted with respect to retention time! Otherwise the result is undefined.

◆ RTEnd() [1/2]

Iterator RTEnd ( CoordinateType  rt)

Fast search for spectrum range end (returns the past-the-end iterator)

Note
Make sure the spectra are sorted with respect to retention time! Otherwise the result is undefined.

◆ RTEnd() [2/2]

ConstIterator RTEnd ( CoordinateType  rt) const

Fast search for spectrum range end (returns the past-the-end iterator)

Returns the first scan which has higher (>) RT than rt.

Note
Make sure the spectra are sorted with respect to retention time! Otherwise the result is undefined.

◆ set2DData() [1/3]

void set2DData ( const Container &  container)
inline

Assignment of a data container with RT and MZ to an MSExperiment.

Fill MSExperiment with data. Note that all data present (including meta-data) will be deleted prior to adding new data!

Parameters
containerAn iterable type whose elements support getRT(), getMZ() and getIntensity()
Exceptions
Exception::Preconditionis thrown if the container is not sorted according to retention time (in debug AND release mode)

◆ set2DData() [2/3]

void set2DData ( const Container &  container)
inline

Assignment of a data container with RT and MZ to an MSExperiment.

Fill MSExperiment with data. Note that all data present (including meta-data) will be deleted prior to adding new data!

Parameters
containerAn iterable type whose elements support getRT(), getMZ() and getIntensity()
add_mass_tracesIf true, each container element is searched for the metavalue "num_of_masstraces". If found, "masstrace_intensity" (X>=0) meta values are added as data points (with 13C spacing). This is useful for, e.g., FF-Metabo output. Note that the actual feature will NOT be added if mass traces are found (since MT0 is usually identical)
Exceptions
Exception::Preconditionis thrown if the container is not sorted according to retention time (in debug AND release mode) OR a "masstrace_intensity" value is expected but not found

◆ set2DData() [3/3]

void set2DData ( const Container &  container,
const StringList store_metadata_names 
)
inline

Assignment of a data container with RT and MZ to an MSExperiment.

Fill MSExperiment with data. Note that all data present (including meta-data) will be deleted prior to adding new data!

Parameters
containerAn iterable type whose elements support getRT(), getMZ() and getIntensity()
store_metadata_names[MetaInfoInterface input only] Names of metadata arrays which should be created; data is filled from the metainfointerface of each element of the input container. Currently, only float data is supported!
Exceptions
Exception::Preconditionis thrown if the container is not sorted according to retention time (in debug AND release mode)

◆ setChromatograms() [1/2]

void setChromatograms ( const std::vector< MSChromatogram > &  chromatograms)

sets the chromatogram list

◆ setChromatograms() [2/2]

void setChromatograms ( std::vector< MSChromatogram > &&  chromatograms)

◆ setSpectra() [1/2]

void setSpectra ( const std::vector< MSSpectrum > &  spectra)

sets the spectrum list

◆ setSpectra() [2/2]

void setSpectra ( std::vector< MSSpectrum > &&  spectra)

◆ setSqlRunID()

void setSqlRunID ( UInt64  id)

sets the run-ID which is used when storing an sqMass file

◆ size()

Size size ( ) const
inline

◆ sortChromatograms()

void sortChromatograms ( bool  sort_rt = true)

Sorts the data points of the chromatograms by m/z.

Parameters
sort_rtif true, chromatograms are sorted by rt position as well

◆ sortSpectra()

void sortSpectra ( bool  sort_mz = true)

Sorts the data points by retention time.

Parameters
sort_mzif true, spectra are sorted by m/z position as well

Referenced by SpectraMerger::average(), NucleicAcidSearchEngine::main_(), SpectraMerger::mergeSpectraBlockWise(), SpectraMerger::mergeSpectraPrecursors(), and NucleicAcidSearchEngine::preprocessSpectra_().

◆ swap()

void swap ( MSExperiment from)

Swaps the content of this map with the content of from.

◆ updateRanges() [1/2]

void updateRanges ( )
overridevirtual

implement this function to reflect the underlying data of the derived class (e.g. an MSSpectrum) Usually, call clearRanges() internally and then populate the dimensions.

Implements RangeManagerContainer< RangeRT, RangeMZ, RangeIntensity >.

◆ updateRanges() [2/2]

void updateRanges ( Int  ms_level)

Updates the m/z, intensity, retention time and MS level ranges of all spectra with a certain ms level.

Parameters
ms_levelMS level to consider for m/z range , RT range and intensity range (All MS levels if negative)

Member Data Documentation

◆ chromatograms_

std::vector<MSChromatogram > chromatograms_
protected

chromatograms

◆ ms_levels_

std::vector<UInt> ms_levels_
protected

MS levels of the data.

◆ spectra_

std::vector<SpectrumType> spectra_
protected

spectra

◆ total_size_

UInt64 total_size_
protected

Number of all data points.