![]() |
OpenMS
|
Representation of a mass spectrometry experiment on disk. More...
#include <OpenMS/KERNEL/OnDiscMSExperiment.h>
Public Member Functions | |
| OnDiscMSExperiment ()=default | |
| Constructor. | |
| bool | openFile (const std::string &filename, bool skipMetaData=false) |
| Open a specific file on disk. | |
| OnDiscMSExperiment (const OnDiscMSExperiment &source) | |
| Copy constructor. | |
| bool | operator== (const OnDiscMSExperiment &rhs) const |
| Equality operator. | |
| bool | operator!= (const OnDiscMSExperiment &rhs) const |
| Inequality operator. | |
| bool | isSortedByRT () const override |
| Checks if all spectra are sorted with respect to ascending RT. | |
| Size | getNrSpectra () const override |
| get the total number of spectra available | |
| Size | getNrChromatograms () const override |
| get the total number of chromatograms available | |
| std::shared_ptr< const ExperimentalSettings > | getExperimentalSettings () const override |
| returns the meta information of this experiment (const access) | |
| std::shared_ptr< PeakMap > | getMetaData () const |
| MSSpectrum | operator[] (Size n) |
| alias for getSpectrum | |
| MSSpectrum | getSpectrum (Size id) override |
| returns a single spectrum | |
| MSSpectrum | getSpectrumMetadata (Size id) override |
| returns a single spectrum without peaks and data arrays | |
| double | getSpectrumRT (Size id) const override |
Retention time of spectrum id, from the meta data. | |
| UInt | getSpectrumMSLevel (Size id) const override |
MS level of spectrum id, from the meta data. | |
| std::unique_ptr< IMSExperimentRandomAccess > | clone () const override |
| A copy with its own file stream (see the copy constructor) | |
| OpenMS::Interfaces::SpectrumPtr | getSpectrumById (Size id) |
| returns a single spectrum (without applying PeakFileOptions filters) | |
| MSChromatogram | getChromatogram (Size id) override |
| returns a single chromatogram | |
| MSChromatogram | getChromatogramByNativeId (const std::string &id) |
| returns a single chromatogram | |
| MSSpectrum | getSpectrumByNativeId (const std::string &id) |
| returns a single spectrum | |
| OpenMS::Interfaces::ChromatogramPtr | getChromatogramById (Size id) |
| returns a single chromatogram | |
| void | setSkipXMLChecks (bool skip) |
| sets whether to skip some XML checks and be fast instead | |
| PeakFileOptions & | getOptions () |
| Mutable access to the options for loading/storing. | |
| const PeakFileOptions & | getOptions () const |
| Non-mutable access to the options for loading/storing. | |
| void | setOptions (const PeakFileOptions &options) |
| set options for loading/storing | |
Public Member Functions inherited from IMSExperimentRandomAccess | |
| virtual | ~IMSExperimentRandomAccess () |
| Size | size () const |
| Alias for getNrSpectra() | |
| bool | empty () const |
| True if there are no spectra. | |
| virtual MSSpectrum | getSpectrumPeaks (Size index) |
Peaks and data arrays of spectrum index; other metadata may be missing. | |
| virtual Size | findFirstRT (double rt) const |
Index of the first spectrum with retention time >= rt. | |
Protected Attributes | |
| std::string | filename_ |
| The filename of the underlying data file. | |
| Internal::IndexedMzMLHandler | indexed_mzml_file_ |
| The index of the underlying data file (mutable: reading moves the file stream) | |
| std::shared_ptr< PeakMap > | meta_ms_experiment_ |
| The meta-data. | |
| std::unordered_map< std::string, Size > | chromatograms_native_ids_ |
| Mapping of chromatogram native ids to offsets. | |
| std::unordered_map< std::string, Size > | spectra_native_ids_ |
| Mapping of spectra native ids to offsets. | |
| PeakFileOptions | options_ |
| Options for loading / storing. | |
Private Types | |
| typedef ChromatogramPeak | ChromatogramPeakT |
| typedef Peak1D | PeakT |
Private Member Functions | |
| OnDiscMSExperiment & | operator= (const OnDiscMSExperiment &) |
| Private Assignment operator -> we cannot copy file streams in IndexedMzMLHandler. | |
| void | loadMetaData_ (const std::string &filename) |
| MSChromatogram | getMetaChromatogramById_ (const std::string &id) |
| MSSpectrum | getMetaSpectrumById_ (const std::string &id) |
Additional Inherited Members | |
Protected Member Functions inherited from IMSExperimentRandomAccess | |
| IMSExperimentRandomAccess ()=default | |
| IMSExperimentRandomAccess (const IMSExperimentRandomAccess &)=default | |
| IMSExperimentRandomAccess & | operator= (const IMSExperimentRandomAccess &)=default |
Representation of a mass spectrometry experiment on disk.
This class allows random access to spectra and chromatograms in indexed mzML files without loading the entire file into memory.
PeakFileOptions can be used to filter data when retrieving spectra/chromatograms:
Example:
|
private |
|
default |
Constructor.
This initializes the object, use openFile to open a file.
|
inline |
Copy constructor.
|
overridevirtual |
A copy with its own file stream (see the copy constructor)
Implements IMSExperimentRandomAccess.
|
overridevirtual |
returns a single chromatogram
If PeakFileOptions has RT or intensity range set, the chromatogram will be filtered accordingly.
| [in] | id | The index of the chromatogram |
Implements IMSExperimentRandomAccess.
| OpenMS::Interfaces::ChromatogramPtr getChromatogramById | ( | Size | id | ) |
returns a single chromatogram
| MSChromatogram getChromatogramByNativeId | ( | const std::string & | id | ) |
returns a single chromatogram
| [in] | id | The native identifier of the chromatogram |
|
inlineoverridevirtual |
returns the meta information of this experiment (const access)
Implements IMSExperimentRandomAccess.
|
private |
|
inline |
|
private |
|
inlineoverridevirtual |
get the total number of chromatograms available
Implements IMSExperimentRandomAccess.
|
inlineoverridevirtual |
get the total number of spectra available
Implements IMSExperimentRandomAccess.
| PeakFileOptions & getOptions | ( | ) |
Mutable access to the options for loading/storing.
| const PeakFileOptions & getOptions | ( | ) | const |
Non-mutable access to the options for loading/storing.
|
overridevirtual |
returns a single spectrum
If PeakFileOptions has m/z or intensity range set, the spectrum will be filtered accordingly.
| [in] | id | The index of the spectrum |
Implements IMSExperimentRandomAccess.
|
inline |
returns a single spectrum (without applying PeakFileOptions filters)
| MSSpectrum getSpectrumByNativeId | ( | const std::string & | id | ) |
returns a single spectrum
| [in] | id | The native identifier of the spectrum |
|
overridevirtual |
returns a single spectrum without peaks and data arrays
Needs the meta data: a file opened with skipMetaData has no RT, MS level or precursors in memory. PeakFileOptions filters are not applied.
| [in] | id | The index of the spectrum |
| Exception::IndexOverflow | if id >= getNrSpectra() |
| Exception::IllegalArgument | if the file was opened with skipMetaData |
Implements IMSExperimentRandomAccess.
MS level of spectrum id, from the meta data.
| Exception::IndexOverflow | if id >= getNrSpectra() |
| Exception::IllegalArgument | if the file was opened with skipMetaData |
Implements IMSExperimentRandomAccess.
|
overridevirtual |
Retention time of spectrum id, from the meta data.
| Exception::IndexOverflow | if id >= getNrSpectra() |
| Exception::IllegalArgument | if the file was opened with skipMetaData |
Implements IMSExperimentRandomAccess.
|
inlineoverridevirtual |
Checks if all spectra are sorted with respect to ascending RT.
Note that we cannot check whether all spectra are sorted (except if we were to load them all and check).
Implements IMSExperimentRandomAccess.
|
private |
| bool openFile | ( | const std::string & | filename, |
| bool | skipMetaData = false |
||
| ) |
Open a specific file on disk.
This tries to read the indexed mzML by parsing the index and then reading the meta information into memory.
|
inline |
Inequality operator.
References OpenMS::Internal::operator==().
|
private |
Private Assignment operator -> we cannot copy file streams in IndexedMzMLHandler.
|
inline |
Equality operator.
This only checks whether the underlying file is the same and the parsed meta-information is the same. Note that the file reader (e.g. the std::ifstream of the file) might be in a different state.
References OnDiscMSExperiment::filename_, and OnDiscMSExperiment::meta_ms_experiment_.
|
inline |
alias for getSpectrum
| void setOptions | ( | const PeakFileOptions & | options | ) |
set options for loading/storing
| void setSkipXMLChecks | ( | bool | skip | ) |
sets whether to skip some XML checks and be fast instead
|
protected |
Mapping of chromatogram native ids to offsets.
|
protected |
The filename of the underlying data file.
Referenced by OnDiscMSExperiment::operator==().
|
mutableprotected |
The index of the underlying data file (mutable: reading moves the file stream)
|
protected |
The meta-data.
Referenced by OnDiscMSExperiment::operator==().
|
protected |
Options for loading / storing.
|
protected |
Mapping of spectra native ids to offsets.