![]() |
OpenMS
|
OpenSwath::ISpectrumAccess implementation backed by an on-disk OpenMS::CachedmzML cache. More...
#include <OpenMS/ANALYSIS/OPENSWATH/DATAACCESS/SpectrumAccessOpenMSCached.h>
Public Types | |
| typedef OpenMS::PeakMap | MSExperimentType |
| typedef OpenMS::MSSpectrum | MSSpectrumType |
Public Member Functions | |
| SpectrumAccessOpenMSCached (const std::string &filename) | |
Open the cached .mzML pair at filename. | |
| ~SpectrumAccessOpenMSCached () override | |
| Destructor; the inherited OpenMS::CachedmzML destructor closes the side-car stream. | |
| SpectrumAccessOpenMSCached (const SpectrumAccessOpenMSCached &rhs) | |
| Copy constructor. | |
| std::shared_ptr< OpenSwath::ISpectrumAccess > | lightClone () const override |
| Return a clone of this accessor as a new OpenSwath::ISpectrumAccess. | |
| OpenSwath::SpectrumPtr | getSpectrumById (int id) override |
| Read one spectrum from the side-car file. | |
| OpenSwath::SpectrumMeta | getSpectrumMetaById (int id) const override |
| Return the RT and MS level of one spectrum. | |
| std::vector< std::size_t > | getSpectraByRT (double RT, double deltaRT) const override |
Indices of cached spectra whose RT lies in [RT - deltaRT, RT + deltaRT]. | |
| size_t | getNrSpectra () const override |
| Number of spectra in the loaded metadata. | |
| SpectrumSettings | getSpectraMetaInfo (int id) const |
| Return the full SpectrumSettings of one spectrum. | |
| OpenSwath::ChromatogramPtr | getChromatogramById (int id) override |
| Read one chromatogram from the side-car file. | |
| size_t | getNrChromatograms () const override |
| Number of chromatograms in the loaded metadata. | |
| ChromatogramSettings | getChromatogramMetaInfo (int id) const |
| Return the ChromatogramSettings of one chromatogram. | |
| std::string | getChromatogramNativeID (int id) const override |
| Native id of one cached chromatogram. | |
Public Member Functions inherited from ISpectrumAccess | |
| virtual | ~ISpectrumAccess () |
| Destructor. | |
| SpectrumPtr | getSpectrumById (int id, double drift_start, double drift_end) |
| Return pointer to a spectrum at the given id, the spectrum will be filtered by drift time. | |
| SpectrumSequence | getMultipleSpectra (double RT, int nr_spectra_to_fetch) |
| SpectrumSequence | getMultipleSpectra (double RT, int nr_spectra_to_fetch, double drift_start, double drift_end) |
Public Member Functions inherited from CachedmzML | |
| CachedmzML () | |
| Default constructor. | |
| CachedmzML (const std::string &filename) | |
Construct and load metadata + side-car index from filename in one step. | |
| CachedmzML (const CachedmzML &rhs) | |
| Copy constructor. | |
| ~CachedmzML () | |
| Destructor. | |
| MSSpectrum | getSpectrum (Size id) |
| Read one spectrum from the side-car file. | |
| MSChromatogram | getChromatogram (Size id) |
| Read one chromatogram from the side-car file. | |
| size_t | getNrSpectra () const |
| Number of spectra in the loaded experiment. | |
| size_t | getNrChromatograms () const |
| Number of chromatograms in the loaded experiment. | |
| const MSExperiment & | getMetaData () const |
Experiment-level metadata loaded from the .mzML file. | |
Additional Inherited Members | |
Static Public Member Functions inherited from ISpectrumAccess | |
| static SpectrumPtr | filterByDrift (const SpectrumPtr &input, double drift_start, double drift_end) |
| filters a spectrum by drift time, spectrum pointer returned is a copy | |
Static Public Member Functions inherited from CachedmzML | |
| static void | store (const std::string &filename, const PeakMap &map) |
Write map to disk as a cached .mzML pair. | |
| static void | load (const std::string &filename, CachedmzML &map) |
Load a cached .mzML pair into map. | |
Protected Member Functions inherited from CachedmzML | |
| void | load_ (const std::string &filename) |
Protected Attributes inherited from CachedmzML | |
| MSExperiment | meta_ms_experiment_ |
| Meta data. | |
| std::ifstream | ifs_ |
| Internal filestream. | |
| std::string | filename_ |
| Name of the mzML file. | |
| std::string | filename_cached_ |
| Name of the cached mzML file. | |
| std::vector< std::streampos > | spectra_index_ |
| Indices. | |
| std::vector< std::streampos > | chrom_index_ |
OpenSwath::ISpectrumAccess implementation backed by an on-disk OpenMS::CachedmzML cache.
Combines the in-memory index of OpenMS::CachedmzML with the OpenSWATH spectrum-access interface: spectrum and chromatogram metadata are served from the in-memory MSExperiment, and the binary payloads are read on demand from the side-car .mzML.cached file.
| typedef OpenMS::PeakMap MSExperimentType |
| typedef OpenMS::MSSpectrum MSSpectrumType |
|
explicit |
Open the cached .mzML pair at filename.
Delegates to OpenMS::CachedmzML's filename constructor: the metadata is loaded from filename and the side-car index for filename + ".cached" is built; subsequent accessor calls read the payloads from that side-car on demand.
| [in] | filename | Path to the .mzML metadata file; the side-car is expected next to it at filename + ".cached". |
| Exception::FileNotFound | when either file cannot be opened. |
| Exception::ParseError | when the metadata cannot be parsed or the side-car index cannot be built. |
|
override |
Destructor; the inherited OpenMS::CachedmzML destructor closes the side-car stream.
| SpectrumAccessOpenMSCached | ( | const SpectrumAccessOpenMSCached & | rhs | ) |
Copy constructor.
Each copy keeps its own file handle on the .mzML.cached side-car (a fresh stream is opened on the same path by the inherited OpenMS::CachedmzML copy constructor). The in-memory metadata and side-car index are duplicated; the spectrum and chromatogram binary payloads are not.
| [in] | rhs | Source accessor to copy. |
|
overridevirtual |
Read one chromatogram from the side-car file.
| [in] | id | Chromatogram index in [0, getNrChromatograms()). Out-of-range access is a programming error (checked in debug builds). |
| Exception::ParseError | when seekg on the side-car stream fails. |
Implements ISpectrumAccess.
| ChromatogramSettings getChromatogramMetaInfo | ( | int | id | ) | const |
Return the ChromatogramSettings of one chromatogram.
| [in] | id | Chromatogram index in [0, getNrChromatograms()). Out-of-range access is a programming error (checked in debug builds). |
ChromatogramSettings.
|
overridevirtual |
Native id of one cached chromatogram.
| [in] | id | Chromatogram index in [0, getNrChromatograms()). Out-of-range access is a programming error (checked in debug builds). |
Implements ISpectrumAccess.
|
overridevirtual |
Number of chromatograms in the loaded metadata.
Implements ISpectrumAccess.
|
overridevirtual |
Number of spectra in the loaded metadata.
Implements ISpectrumAccess.
|
overridevirtual |
Indices of cached spectra whose RT lies in [RT - deltaRT, RT + deltaRT].
Walks the metadata MSExperiment forward from the first spectrum with RT >= RT - deltaRT.
| [in] | RT | Centre of the RT window. |
| [in] | deltaRT | Half-width of the RT window. Must be non-negative; a negative value is a programming error (checked in debug builds). |
Implements ISpectrumAccess.
| SpectrumSettings getSpectraMetaInfo | ( | int | id | ) | const |
Return the full SpectrumSettings of one spectrum.
Unlike getSpectrumMetaById (which returns only RT and ms_level), this returns the full per-spectrum metadata read at construction time.
| [in] | id | Spectrum index. No bounds check is performed. |
SpectrumSettings for that spectrum.
|
overridevirtual |
Read one spectrum from the side-car file.
| [in] | id | Spectrum index in [0, getNrSpectra()). Out-of-range access is a programming error (checked in debug builds). |
| Exception::ParseError | when seekg on the side-car stream fails (e.g. an overflow on a 32-bit system reading a > 2 GB cache file). |
Implements ISpectrumAccess.
|
overridevirtual |
Return the RT and MS level of one spectrum.
Only RT and ms_level are filled on the returned SpectrumMeta; for the full spectrum settings use getSpectraMetaInfo.
| [in] | id | Spectrum index in [0, getNrSpectra()). Out-of-range access is a programming error (checked in debug builds). |
SpectrumMeta carrying only RT and ms_level. Implements ISpectrumAccess.
|
overridevirtual |
Return a clone of this accessor as a new OpenSwath::ISpectrumAccess.
Equivalent to copy-constructing through SpectrumAccessOpenMSCached(const SpectrumAccessOpenMSCached&); the clone reads payloads lazily from its own stream on the same side-car file.
Implements ISpectrumAccess.