![]() |
OpenMS
|
OpenSwath::ISpectrumAccess implementation that holds the complete spectrum / chromatogram payload in memory. More...
#include <OpenMS/ANALYSIS/OPENSWATH/DATAACCESS/SpectrumAccessOpenMSInMemory.h>
Public Types | |
| typedef OpenMS::PeakMap | MSExperimentType |
| typedef OpenMS::MSSpectrum | MSSpectrumType |
| typedef OpenMS::MSChromatogram | MSChromatogramType |
Public Member Functions | |
| SpectrumAccessOpenMSInMemory (OpenSwath::ISpectrumAccess &origin) | |
Construct by reading every spectrum and chromatogram from origin into memory. | |
| ~SpectrumAccessOpenMSInMemory () override | |
| Destructor. | |
| SpectrumAccessOpenMSInMemory (const SpectrumAccessOpenMSInMemory &rhs) | |
| Copy constructor (light copy). | |
| 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 |
| Look up one spectrum by index. | |
| OpenSwath::SpectrumMeta | getSpectrumMetaById (int id) const override |
| Look up one spectrum's metadata by index. | |
| 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 cached in memory. | |
| OpenSwath::ChromatogramPtr | getChromatogramById (int id) override |
| Look up one chromatogram by index. | |
| size_t | getNrChromatograms () const override |
| Number of chromatograms cached in memory. | |
| 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) |
Private Attributes | |
| std::vector< OpenSwath::SpectrumPtr > | spectra_ |
| Spectrum payloads captured at construction; shared with light clones. | |
| std::vector< OpenSwath::SpectrumMeta > | spectra_meta_ |
| Parallel metadata cache (native id, RT, MS level) keyed on the same index. | |
| std::vector< OpenSwath::ChromatogramPtr > | chromatograms_ |
| Chromatogram payloads captured at construction; shared with light clones. | |
| std::vector< std::string > | chromatogram_ids_ |
| Parallel chromatogram native-id cache keyed on the same index. | |
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 | |
OpenSwath::ISpectrumAccess implementation that holds the complete spectrum / chromatogram payload in memory.
Constructed from any other OpenSwath::ISpectrumAccess (file-backed, on-disk cached, etc.); every spectrum and chromatogram is read through the source's interface during construction and cached locally, so subsequent accesses do not touch the disk again. The view exposes exactly the same data as the source. After construction the source is no longer referenced.
After this snippet, data_access still serves the original data (its backing store is opaque to the caller), while in_memory_data_access serves the same data with the guarantee that it is held in memory and not re-read from disk.
| typedef OpenMS::PeakMap MSExperimentType |
| typedef OpenMS::MSSpectrum MSSpectrumType |
|
explicit |
Construct by reading every spectrum and chromatogram from origin into memory.
After construction the accessor exposes the same spectra and chromatograms as origin, served entirely from memory; origin itself is no longer referenced.
| [in] | origin | Source accessor; read once during construction and not retained. |
|
override |
Destructor.
| SpectrumAccessOpenMSInMemory | ( | const SpectrumAccessOpenMSInMemory & | rhs | ) |
Copy constructor (light copy).
The copy shares the underlying spectrum / chromatogram payloads with rhs; only the per-element handles are duplicated. No data is re-read from the original source.
| [in] | rhs | Source accessor to copy. |
|
overridevirtual |
Look up one chromatogram by index.
| [in] | id | Chromatogram index in [0, getNrChromatograms()). Out-of-range access is a programming error (checked in debug builds). |
ChromatogramPtr for the requested chromatogram. Implements ISpectrumAccess.
|
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 cached in memory.
Implements ISpectrumAccess.
|
overridevirtual |
Number of spectra cached in memory.
Implements ISpectrumAccess.
|
overridevirtual |
Indices of cached spectra whose RT lies in [RT - deltaRT, RT + deltaRT].
Relies on the cached metadata being sorted by RT (inherited from the source); the lookup is logarithmic in the number of spectra.
| [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.
|
overridevirtual |
Look up one spectrum by index.
| [in] | id | Spectrum index in [0, getNrSpectra()). Out-of-range access is a programming error (checked in debug builds). |
SpectrumPtr for the requested spectrum. Implements ISpectrumAccess.
|
overridevirtual |
Look up one spectrum's metadata by index.
| [in] | id | Spectrum index in [0, getNrSpectra()). Out-of-range access is a programming error (checked in debug builds). |
SpectrumMeta for the requested spectrum. Implements ISpectrumAccess.
|
overridevirtual |
Return a clone of this accessor as a new OpenSwath::ISpectrumAccess.
The clone shares this accessor's spectrum / chromatogram payloads, so it is cheap to create and safe to hand to another thread without re-reading the source.
Implements ISpectrumAccess.
|
private |
Parallel chromatogram native-id cache keyed on the same index.
|
private |
Chromatogram payloads captured at construction; shared with light clones.
|
private |
Spectrum payloads captured at construction; shared with light clones.
|
private |
Parallel metadata cache (native id, RT, MS level) keyed on the same index.