OpenMS
|
In-Memory representation of a mass spectrometry run. More...
#include <OpenMS/KERNEL/MSExperiment.h>
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 > |
struct | SumIntensityReduction |
Calculates the sum of intensities for a range of elements. 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, UInt ms_level=1) |
Returns an area iterator for area . More... | |
AreaIterator | areaBegin (const RangeManagerType &range, UInt ms_level=1) |
Returns an area iterator for all peaks in range . If a dimension is empty(), it is ignored (i.e. does not restrict the 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, UInt ms_level=1) const |
Returns a non-mutable area iterator for area . More... | |
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(), it is ignored (i.e. does not restrict the area) More... | |
ConstAreaIterator | areaEndConst () const |
Returns a non-mutable invalid area iterator marking the end of an area. More... | |
void | get2DPeakDataPerSpectrum (CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz, Size ms_level, std::vector< float > &rt, std::vector< std::vector< float >> &mz, std::vector< std::vector< float >> &intensity) const |
void | get2DPeakDataIMPerSpectrum (CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz, Size ms_level, std::vector< float > &rt, std::vector< std::vector< float >> &mz, std::vector< std::vector< float >> &intensity, std::vector< std::vector< float >> &ion_mobility) const |
void | get2DPeakData (CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz, Size ms_level, std::vector< float > &rt, std::vector< float > &mz, std::vector< float > &intensity) const |
void | get2DPeakDataIM (CoordinateType min_rt, CoordinateType max_rt, CoordinateType min_mz, CoordinateType max_mz, Size ms_level, std::vector< float > &rt, std::vector< float > &mz, std::vector< float > &intensity, std::vector< float > &ion_mobility) const |
template<class MzReductionFunctionType > | |
std::vector< std::vector< MSExperiment::CoordinateType > > | aggregate (const std::vector< std::pair< RangeMZ, RangeRT >> &mz_rt_ranges, unsigned int ms_level, MzReductionFunctionType func_mz_reduction) const |
Aggregates data over specified m/z and RT ranges at a given MS level using a custom reduction function. More... | |
std::vector< std::vector< MSExperiment::CoordinateType > > | aggregate (const std::vector< std::pair< RangeMZ, RangeRT >> &mz_rt_ranges, unsigned int ms_level) const |
template<class MzReductionFunctionType > | |
std::vector< MSChromatogram > | extractXICs (const std::vector< std::pair< RangeMZ, RangeRT >> &mz_rt_ranges, unsigned int ms_level, MzReductionFunctionType func_mz_reduction) const |
Extracts extracted ion chromatograms (XICs) from the MSExperiment. More... | |
std::vector< MSChromatogram > | extractXICs (const std::vector< std::pair< RangeMZ, RangeRT >> &mz_rt_ranges, unsigned int ms_level) const |
std::vector< std::vector< MSExperiment::CoordinateType > > | aggregateFromMatrix (const Matrix< double > &ranges, unsigned int ms_level, const std::string &mz_agg) const |
Wrapper for aggregate function that takes a matrix of m/z and RT ranges. More... | |
std::vector< MSChromatogram > | extractXICsFromMatrix (const Matrix< double > &ranges, unsigned int ms_level, const std::string &mz_agg) const |
Wrapper for extractXICs function that takes a matrix of m/z and RT ranges. More... | |
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... | |
ConstIterator | IMBegin (CoordinateType im) const |
Fast search for spectrum range begin. More... | |
ConstIterator | IMEnd (CoordinateType im) const |
Fast search for spectrum range end (returns the past-the-end iterator) More... | |
Range methods | |
| |
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... | |
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 ExperimentalSettings & | getExperimentalSettings () const |
returns the meta information of this experiment (const access) More... | |
ExperimentalSettings & | getExperimentalSettings () |
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... | |
ConstIterator | getFirstProductSpectrum (ConstIterator iterator) const |
int | getFirstProductSpectrum (int zero_based_index) const |
Returns the index of the first product spectrum given an 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... | |
ConstIterator | getClosestSpectrumInRT (const double RT) const |
Returns the closest(=nearest) spectrum in retention time to the given RT. More... | |
Iterator | getClosestSpectrumInRT (const double RT) |
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. More... | |
Iterator | getClosestSpectrumInRT (const double RT, UInt ms_level) |
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, RangeMobility > | |
virtual | ~RangeManagerContainer ()=default |
D'tor. More... | |
const ThisRangeType & | getRange () const |
get range of current data (call updateRanges() before to ensure the range is accurate) More... | |
ThisRangeType & | 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 | operator!= (const RangeManager &rhs) const |
bool | assignUnsafe (const RangeManager< RangeBasesOther... > &rhs) |
auto & | 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... | |
void | minSpanIfSingular (const double min_span) |
If any dimension is a single point, e.g. min==max, then extend this dimension by min_span / 2 on either side. More... | |
bool | pushIntoUnsafe (const RangeManager< RangeBasesOther... > &rhs) |
void | pushInto (const RangeManager< RangeBasesOther... > &sandbox) |
bool | clampToUnsafe (const RangeManager< RangeBasesOther... > &rhs) |
void | clampTo (const RangeManager< RangeBasesOther... > &rhs) |
const RangeBase & | getRangeForDim (MSDim dim) const |
obtain a range dimension at runtime using dim More... | |
RangeBase & | getRangeForDim (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... | |
ThisRangeType & | clear (const DIM_UNIT range) |
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... | |
ExperimentalSettings & | operator= (const ExperimentalSettings &)=default |
Assignment operator. More... | |
ExperimentalSettings & | operator= (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 Sample & | getSample () const |
returns a const reference to the sample description More... | |
Sample & | getSample () |
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 Instrument & | getInstrument () const |
returns a const reference to the MS instrument description More... | |
Instrument & | getInstrument () |
returns a mutable reference to the MS instrument description More... | |
void | setInstrument (const Instrument &instrument) |
sets the MS instrument description More... | |
const HPLC & | getHPLC () const |
returns a const reference to the description of the HPLC run More... | |
HPLC & | getHPLC () |
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 DateTime & | getDateTime () const |
returns the date the experiment was performed More... | |
void | setDateTime (const DateTime &date) |
sets the date the experiment was performed More... | |
const String & | getComment () 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 String & | getFractionIdentifier () 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... | |
MetaInfoInterface & | operator= (const MetaInfoInterface &rhs) |
Assignment operator. More... | |
MetaInfoInterface & | operator= (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 DataValue & | getMetaValue (const String &name) const |
Returns the value corresponding to a string, or DataValue::EMPTY if not found. More... | |
DataValue | getMetaValue (const String &name, const DataValue &default_value) const |
Returns the value corresponding to a string, or a default value (e.g.: DataValue::EMPTY) if not found More... | |
const DataValue & | getMetaValue (UInt index) const |
Returns the value corresponding to the index, or DataValue::EMPTY if not found. More... | |
DataValue | getMetaValue (UInt index, const DataValue &default_value) const |
Returns the value corresponding to the index, or a default value (e.g.: 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... | |
DocumentIdentifier & | operator= (const DocumentIdentifier &)=default |
Assignment operator. More... | |
DocumentIdentifier & | operator= (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 String & | getIdentifier () 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 String & | getLoadedFilePath () 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::Type & | getLoadedFileType () 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 |
MSExperiment () | |
Constructor. More... | |
MSExperiment (const MSExperiment &source) | |
Copy constructor. More... | |
MSExperiment (MSExperiment &&)=default | |
Move constructor. More... | |
MSExperiment & | operator= (const MSExperiment &source) |
Assignment operator. More... | |
MSExperiment & | operator= (MSExperiment &&) &=default |
Move assignment operator. More... | |
MSExperiment & | operator= (const ExperimentalSettings &source) |
Assignment operator. More... | |
~MSExperiment () override | |
D'tor. More... | |
bool | operator== (const MSExperiment &rhs) const |
Equality operator. More... | |
bool | operator!= (const MSExperiment &rhs) const |
Equality operator. More... | |
Size | size () const noexcept |
The number of spectra. More... | |
void | resize (Size n) |
Resize to n spectra. More... | |
bool | empty () const noexcept |
Are there any spectra (does not consider chromatograms) More... | |
void | reserve (Size n) |
Reserve space for n spectra. More... | |
SpectrumType & | operator[] (Size n) |
Random access to n'th spectrum. More... | |
const SpectrumType & | operator[] (Size n) const |
Random access to n'th spectrum. More... | |
Iterator | begin () noexcept |
ConstIterator | begin () const noexcept |
ConstIterator | cbegin () const noexcept |
Iterator | end () |
ConstIterator | end () const noexcept |
ConstIterator | cend () const noexcept |
void | reserveSpaceSpectra (Size s) |
void | reserveSpaceChromatograms (Size s) |
Easy Access interface | |
std::vector< UInt > | ms_levels_ |
MS levels of the data. More... | |
UInt64 | total_size_ |
Number of all data points. More... | |
std::vector< MSChromatogram > | chromatograms_ |
chromatograms More... | |
std::vector< SpectrumType > | spectra_ |
spectra More... | |
MSChromatogram & | getChromatogram (Size id) |
returns a single chromatogram More... | |
MSSpectrum & | getSpectrum (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 trthe 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... | |
bool | isIMFrame () const |
Are all MSSpectra in this experiment part of an IM Frame? I.e. they all have the same RT, but different drift times. More... | |
SpectrumType * | createSpec_ (PeakType::CoordinateType rt) |
SpectrumType * | createSpec_ (PeakType::CoordinateType rt, const StringList &metadata_names) |
Additional Inherited Members | |
Static Public Member Functions inherited from MetaInfoInterface | |
static MetaInfoRegistry & | metaRegistry () |
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< SourceFile > | source_files_ |
std::vector< ContactPerson > | contacts_ |
Instrument | instrument_ |
HPLC | hplc_ |
DateTime | datetime_ |
String | comment_ |
std::vector< ProteinIdentification > | protein_identifications_ |
String | fraction_identifier_ |
Protected Attributes inherited from MetaInfoInterface | |
MetaInfo * | meta_ |
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... | |
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.
typedef Internal::AreaIterator<PeakT, PeakT&, PeakT*, Iterator, SpectrumType::Iterator> AreaIterator |
Mutable area iterator type (for traversal of a rectangular subset of the peaks)
typedef std::vector<SpectrumType> Base |
STL base class type.
typedef ChromatogramPeak ChromatogramPeakT |
Chromatogram peak type.
typedef MSChromatogram ChromatogramType |
Chromatogram type.
typedef Base::const_iterator const_iterator |
typedef 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)
typedef std::vector<SpectrumType>::const_iterator ConstIterator |
Non-mutable iterator.
Coordinate type of peak positions.
typedef PeakType::IntensityType IntensityType |
Intensity type of peaks.
typedef std::vector<SpectrumType>::iterator Iterator |
Mutable iterator.
typedef Base::iterator iterator |
typedef RangeManagerContainer<RangeRT, RangeMZ, RangeIntensity, RangeMobility> RangeManagerContainerType |
RangeManager type.
RangeManager type.
typedef MSSpectrum SpectrumType |
Spectrum Type.
typedef Base::value_type value_type |
MSExperiment | ( | ) |
Constructor.
MSExperiment | ( | const MSExperiment & | source | ) |
Copy constructor.
|
default |
Move constructor.
|
override |
D'tor.
void addChromatogram | ( | const MSChromatogram & | chromatogram | ) |
adds a chromatogram to the list
void addChromatogram | ( | MSChromatogram && | chrom | ) |
void addSpectrum | ( | const MSSpectrum & | spectrum | ) |
adds a spectrum to the list
Referenced by SpectraMerger::averageCentroidSpectra_(), SpectraMerger::averageProfileSpectra_(), MascotGenericFile::load(), MascotInfile::load(), MS2File::load(), DTA2DFile::load(), NucleicAcidSearchEngine::main_(), SpectraMerger::mergeSpectra_(), OPXLDataStructs::PreprocessedPairSpectra::PreprocessedPairSpectra(), and TOPPViewBase::showSpectrumGenerationDialog().
void addSpectrum | ( | MSSpectrum && | spectrum | ) |
|
inline |
|
inline |
Aggregates data over specified m/z and RT ranges at a given MS level using a custom reduction function.
This function processes spectra at a specified MS level and aggregates data within specified m/z (mass-to-charge) and RT (retention time) ranges. For each m/z and RT range, it computes a result using the provided m/z reduction function over the peaks that fall within the range.
The results are organized in a two-dimensional vector, where each sub-vector corresponds to a particular m/z and RT range, and contains the aggregated results for each spectrum that falls within that RT range.
This function allows for flexible aggregation of data within specified m/z and RT ranges, and is useful for XIC extraction.
MzReductionFunctionType | A callable type (function, lambda, or functor) that takes two iterators (begin_it and end_it ) over peaks (MSSpectrum::ConstIterator ) and returns a CoordinateType . The function defines how to reduce or aggregate the peaks within the specified m/z range (e.g., summing intensities, computing the mean m/z, etc.). |
[in,out] | mz_rt_ranges | A vector of pairs of RangeMZ and RangeRT specifying the m/z and RT ranges over which to aggregate data. Each pair defines a rectangular region in the m/z-RT plane. The vector will be sorted in-place by ascending minimum m/z and descending maximum m/z within the function. |
[in] | ms_level | The MS level of the spectra to be processed. Only spectra matching this MS level will be considered in the aggregation. |
[in] | func_mz_reduction | A function or functor that performs the m/z reduction. It should have the signature: CoordinateType func_mz_reduction(MSSpectrum::ConstIterator begin_it, MSSpectrum::ConstIterator end_it); The function receives iterators to the beginning and end of the peaks within the m/z range for a specific spectrum. It should process these peaks and return a single CoordinateType value representing the aggregated result. |
MSExperiment::CoordinateType
. Each sub-vector corresponds to an m/z and RT range in mz_rt_ranges
, and contains the aggregated results for each spectrum that falls within that RT range. The size of each sub-vector equals the number of spectra that overlap with the RT range.mz_rt_ranges
is empty or there are no spectra at the specified MS level, the function returns an empty vector.mz_rt_ranges
vector will be sorted within the function by ascending minimum m/z and descending maximum m/z.mz_rt_ranges
by sorting it. If the original order is important, make a copy before calling.func_mz_reduction
must be able to handle empty ranges (i.e., when begin_it == end_it
).None |
|
inline |
Wrapper for aggregate function that takes a matrix of m/z and RT ranges.
ranges | Matrix where each row contains [mz_min, mz_max, rt_min, rt_max] |
ms_level | MS level to process |
mz_agg | Aggregation function for m/z values ("sum", "max", "min", "mean") |
References Peak1D::getIntensity(), and OpenMS::Math::sum().
AreaIterator areaBegin | ( | const RangeManagerType & | range, |
UInt | ms_level = 1 |
||
) |
Returns an area iterator for all peaks in range
. If a dimension is empty(), it is ignored (i.e. does not restrict the area)
AreaIterator areaBegin | ( | CoordinateType | min_rt, |
CoordinateType | max_rt, | ||
CoordinateType | min_mz, | ||
CoordinateType | max_mz, | ||
UInt | ms_level = 1 |
||
) |
Returns an area iterator for area
.
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(), it is ignored (i.e. does not restrict the area)
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
.
AreaIterator areaEnd | ( | ) |
Returns an invalid area iterator marking the end of an area.
ConstAreaIterator areaEndConst | ( | ) | const |
Returns a non-mutable invalid area iterator marking the end of an area.
|
inlinenoexcept |
|
inlinenoexcept |
Referenced by KDTreeFeatureMaps::addMaps(), SpectraMerger::average(), SpectraMerger::averageCentroidSpectra_(), SpectraMerger::averageProfileSpectra_(), IDFilter::filterHitsByScore(), MapAlignmentAlgorithmIdentification::getRetentionTimes_(), IDFilter::keepHitsMatchingProteins(), IDFilter::keepNBestHits(), TOPPFLASHDeconv::main_(), NucleicAcidSearchEngine::main_(), SpectraMerger::mergeSpectra_(), SpectraMerger::mergeSpectraBlockWise(), and DTA2DFile::store().
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.
rt_bin_size | RT bin size in seconds (0 = no resampling) |
ms_level | MS level of spectra for calculation (0 = all levels) |
Referenced by DTA2DFile::storeTIC().
|
inlinenoexcept |
|
inlinenoexcept |
void clear | ( | bool | clear_meta_data | ) |
Clears all data and meta data.
clear_meta_data | If true, all meta data is cleared in addition to the data. |
Referenced by SpectraMerger::mergeSpectra_(), and PeakPickerIterative::pickExperiment().
bool clearMetaDataArrays | ( | ) |
Clears the meta data arrays of all contained spectra (float, integer and string arrays)
bool containsScanOfLevel | ( | size_t | ms_level | ) | const |
returns true if at least one of the spectra has the specified level
|
private |
|
private |
|
inlinenoexcept |
Are there any spectra (does not consider chromatograms)
Referenced by OpenSwathHelper::checkSwathMapAndSelectTransitions().
|
inline |
Referenced by KDTreeFeatureMaps::addMaps(), SpectraMerger::average(), SpectraMerger::averageCentroidSpectra_(), SpectraMerger::averageProfileSpectra_(), IDFilter::filterHitsByScore(), MapAlignmentAlgorithmIdentification::getRetentionTimes_(), IDFilter::keepHitsMatchingProteins(), IDFilter::keepNBestHits(), TOPPFLASHDeconv::main_(), NucleicAcidSearchEngine::main_(), SpectraMerger::mergeSpectra_(), SpectraMerger::mergeSpectraBlockWise(), and DTA2DFile::store().
|
inlinenoexcept |
|
inline |
|
inline |
Extracts extracted ion chromatograms (XICs) from the MSExperiment.
This function takes a vector of mz_rt_ranges, an ms_level, and a MzReductionFunctionType and extracts the XICs from the MSExperiment based on the given parameters.
mz_rt_ranges | A vector of pairs of RangeMZ and RangeRT representing the m/z and retention time ranges. |
ms_level | The MS level of the spectra to consider. |
func_mz_reduction | The MzReductionFunctionType used to reduce the m/z values. |
|
inline |
Wrapper for extractXICs function that takes a matrix of m/z and RT ranges.
ranges | Matrix where each row contains [mz_min, mz_max, rt_min, rt_max] |
ms_level | MS level to process |
mz_agg | Aggregation function for m/z values ("sum", "max", "min", "mean") |
References Peak1D::getIntensity(), and OpenMS::Math::sum().
|
inline |
Reads out a 2D Spectrum.
Container can be a PeakArray or an STL container of peaks which supports push_back(), end() and back()
|
inline |
|
inline |
References OpenMS::NONE.
|
inline |
References OpenMS::NONE.
|
inline |
MSChromatogram& getChromatogram | ( | Size | id | ) |
returns a single chromatogram
Referenced by SavitzkyGolayFilter::filterExperiment().
std::vector<MSChromatogram>& getChromatograms | ( | ) |
returns the chromatogram list (mutable)
const std::vector<MSChromatogram>& getChromatograms | ( | ) | const |
returns the chromatogram list
Referenced by SavitzkyGolayFilter::filterExperiment().
Iterator getClosestSpectrumInRT | ( | const double | RT | ) |
ConstIterator getClosestSpectrumInRT | ( | const double | RT | ) | const |
Returns the closest(=nearest) spectrum in retention time to the given RT.
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.
ExperimentalSettings& getExperimentalSettings | ( | ) |
returns the meta information of this experiment (mutable access)
const ExperimentalSettings& getExperimentalSettings | ( | ) | const |
returns the meta information of this experiment (const access)
Referenced by XMassFile::importExperimentalSettings().
ConstIterator getFirstProductSpectrum | ( | ConstIterator | iterator | ) | const |
@brief Returns the first product spectrum of the scan pointed to by @p iterator A product spectrum is a spectrum of the next higher MS level that has the current spectrum as precursor. If there is no product scan, the past-the-end iterator is returned. This assumes that product occurs somewhere after the current spectrum and comes before the next scan that is of a level that is lower than the current one.
Example: MS1 - ix: 0 MS2 - ix: 1, prec: 0 MS2 - ix: 2, prec: 0 <-- current scan MS3 - ix: 3, prec: 1 MS3 - ix: 4, prec: 2 <-- product scan MS2 - ix: 5, prec: 0 MS3 - ix: 6, prec: 5 MS1 - ix: 7 ... <-- Not searched anymore. Returns end of experiment iterator if not found until here.
Uses the native spectrum ID from the first precursor entry of the potential product scans for comparisons -> Works for multiple precursor ranges from the same precursor scan but not for multiple precursor ranges from different precursor scans.
int getFirstProductSpectrum | ( | int | zero_based_index | ) | const |
Returns the index of the first product spectrum given an index.
zero_based_index | The index of the current spectrum. |
const std::vector<UInt>& getMSLevels | ( | ) | const |
returns an array of MS levels
Size getNrChromatograms | ( | ) | const |
get the total number of chromatograms available
Size getNrSpectra | ( | ) | const |
get the total number of spectra available
Referenced by NucleicAcidSearchEngine::main_().
ConstIterator getPrecursorSpectrum | ( | ConstIterator | iterator | ) | const |
Returns the precursor spectrum of the scan pointed to by iterator
.
If there is no (matching) precursor scan the past-the-end iterator is returned.
This assumes that precursors occur somewhere before the current spectrum but not necessarily the first one from the last MS level (we double-check with the annotated precursorList.
If precursor annotations are present, uses the native spectrum ID from the first precursor entry of the current scan for comparisons -> Works for multiple precursor ranges from the same precursor scan but not for multiple precursor ranges from different precursor scans. If none are present, picks the first scan of a lower level.
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.
void getPrimaryMSRunPath | ( | StringList & | toFill | ) | const |
get the file path to the first MS run
Referenced by NucleicAcidSearchEngine::main_().
UInt64 getSize | ( | ) | const |
returns the total number of peaks
std::vector<MSSpectrum>& getSpectra | ( | ) |
returns the spectrum list (mutable)
const std::vector<MSSpectrum>& getSpectra | ( | ) | const |
returns the spectrum list
Referenced by SpectraMerger::mergeSpectra_().
MSSpectrum& getSpectrum | ( | Size | id | ) |
returns a single spectrum
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.
bool hasPeptideIdentifications | ( | ) | const |
do any of the spectra have a PeptideID?
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.0
ConstIterator IMBegin | ( | CoordinateType | im | ) | const |
Fast search for spectrum range begin.
Returns the first scan which has equal or higher (>=) ion mobility than rt
.
ConstIterator IMEnd | ( | CoordinateType | im | ) | const |
Fast search for spectrum range end (returns the past-the-end iterator)
Returns the first scan which has higher (>) ion mobility than im
.
bool isIMFrame | ( | ) | const |
Are all MSSpectra in this experiment part of an IM Frame? I.e. they all have the same RT, but different drift times.
bool isSorted | ( | bool | check_mz = true | ) | const |
Checks if all spectra are sorted with respect to ascending RT.
check_mz | if true, checks if all peaks are sorted with respect to ascending m/z |
bool operator!= | ( | const MSExperiment & | rhs | ) | const |
Equality operator.
MSExperiment& operator= | ( | const ExperimentalSettings & | source | ) |
Assignment operator.
MSExperiment& operator= | ( | const MSExperiment & | source | ) |
Assignment operator.
|
default |
Move assignment operator.
bool operator== | ( | const MSExperiment & | rhs | ) | const |
Equality operator.
|
inline |
Random access to n'th
spectrum.
|
inline |
Random access to n'th
spectrum.
|
inline |
Reserve space for n
spectra.
void reserveSpaceChromatograms | ( | Size | s | ) |
void reserveSpaceSpectra | ( | Size | s | ) |
void reset | ( | ) |
Clear all internal data (spectra, ranges, metadata)
Referenced by InspectOutfile::getExperiment(), MascotGenericFile::load(), MascotInfile::load(), MS2File::load(), and DTA2DFile::load().
|
inline |
Resize to n
spectra.
Referenced by PeakPickerIterative::pickExperiment().
Iterator RTBegin | ( | CoordinateType | rt | ) |
Fast search for spectrum range begin.
ConstIterator RTBegin | ( | CoordinateType | rt | ) | const |
Fast search for spectrum range begin.
Returns the first scan which has equal or higher (>=) RT than rt
.
Iterator RTEnd | ( | CoordinateType | rt | ) |
Fast search for spectrum range end (returns the past-the-end iterator)
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
.
|
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!
container | An iterable type whose elements support getRT(), getMZ() and getIntensity() |
Exception::Precondition | is thrown if the container is not sorted according to retention time (in debug AND release mode) |
|
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!
Container | An iterable type whose elements support getRT(), getMZ() and getIntensity() |
add_mass_traces | If 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) |
container | The input data with RT,m/z and intensity |
Exception::Precondition | is 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 |
|
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!
container | An 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! |
Exception::Precondition | is thrown if the container is not sorted according to retention time (in debug AND release mode) |
void setChromatograms | ( | const std::vector< MSChromatogram > & | chromatograms | ) |
sets the chromatogram list
void setChromatograms | ( | std::vector< MSChromatogram > && | chromatograms | ) |
void setSpectra | ( | const std::vector< MSSpectrum > & | spectra | ) |
sets the spectrum list
void setSpectra | ( | std::vector< MSSpectrum > && | spectra | ) |
void setSqlRunID | ( | UInt64 | id | ) |
sets the run-ID which is used when storing an sqMass file
|
inlinenoexcept |
The number of spectra.
Referenced by PlotCanvas::addDataProcessing_(), MorphologicalFilter::filterExperiment(), SavitzkyGolayFilter::filterExperiment(), TOPPFLASHDeconv::main_(), NucleicAcidSearchEngine::main_(), IDMapper::mapPrecursorsToIdentifications(), SpectraMerger::mergeSpectra_(), SpectraMerger::mergeSpectraPrecursors(), PeakPickerIterative::pickExperiment(), NucleicAcidSearchEngine::preprocessSpectra_(), LinearResampler::rasterExperiment(), DTA2DFile::store(), and DTA2DFile::storeTIC().
void sortChromatograms | ( | bool | sort_rt = true | ) |
Sorts the data points of the chromatograms by m/z.
sort_rt | if true, chromatograms are sorted by rt position as well |
void sortSpectra | ( | bool | sort_mz = true | ) |
Sorts the data points by retention time.
sort_mz | if true, spectra are sorted by m/z position as well |
Referenced by SpectraMerger::average(), TOPPFLASHDeconv::main_(), NucleicAcidSearchEngine::main_(), SpectraMerger::mergeSpectraBlockWise(), SpectraMerger::mergeSpectraPrecursors(), and NucleicAcidSearchEngine::preprocessSpectra_().
void swap | ( | MSExperiment & | from | ) |
Swaps the content of this map with the content of from
.
|
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, RangeMobility >.
void updateRanges | ( | Int | ms_level | ) |
Updates the m/z, intensity, retention time and MS level ranges of all spectra with a certain ms level.
ms_level | MS level to consider for m/z range , RT range and intensity range (All MS levels if negative) |
|
protected |
chromatograms
|
protected |
MS levels of the data.
|
protected |
spectra
|
protected |
Number of all data points.