![]() |
OpenMS
|
OpenSwath::ISpectrumAccess implementation backed by an sqMass (SQLite) spectrum store. More...
#include <OpenMS/ANALYSIS/OPENSWATH/DATAACCESS/SpectrumAccessSqMass.h>
Public Types | |
| typedef OpenMS::MSSpectrum | MSSpectrumType |
| typedef OpenMS::MSChromatogram | MSChromatogramType |
Public Member Functions | |
| SpectrumAccessSqMass (const OpenMS::Internal::MzMLSqliteHandler &handler) | |
| Construct from an sqMass handler exposing every spectrum it contains. | |
| SpectrumAccessSqMass (const OpenMS::Internal::MzMLSqliteHandler &handler, const std::vector< int > &indices) | |
| Construct from an sqMass handler exposing only the spectra at the given indices. | |
| SpectrumAccessSqMass (const SpectrumAccessSqMass &sp, const std::vector< int > &indices) | |
| Construct a narrower view of an existing accessor. | |
| ~SpectrumAccessSqMass () override | |
| Destructor. | |
| SpectrumAccessSqMass (const SpectrumAccessSqMass &rhs) | |
| Copy constructor. | |
| std::shared_ptr< OpenSwath::ISpectrumAccess > | lightClone () const override |
| Return a copy of this accessor as a new OpenSwath::ISpectrumAccess pointer. | |
| OpenSwath::SpectrumPtr | getSpectrumById (int id) override |
| Load one spectrum by index in the visible view. | |
| OpenSwath::SpectrumMeta | getSpectrumMetaById (int id) const override |
| Load metadata (native id, RT, MS level) for one spectrum. | |
| void | getAllSpectra (std::vector< OpenSwath::SpectrumPtr > &spectra, std::vector< OpenSwath::SpectrumMeta > &spectra_meta) const |
| Batch-load every spectrum in the visible view into memory. | |
| std::vector< std::size_t > | getSpectraByRT (double RT, double deltaRT) const override |
| Indices into the visible view of spectra whose RT lies within an absolute window. | |
| size_t | getNrSpectra () const override |
| Number of spectra in the visible view. | |
| OpenSwath::ChromatogramPtr | getChromatogramById (int id) override |
| Not supported on sqMass. | |
| size_t | getNrChromatograms () const override |
| Number of chromatograms in the underlying sqMass file. | |
| std::string | getChromatogramNativeID (int id) const override |
| Not supported on sqMass. | |
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 | |
| OpenMS::Internal::MzMLSqliteHandler | handler_ |
| Handler for the underlying sqMass file (copied by value into each accessor / clone) | |
| std::vector< int > | sidx_ |
| Optional subset of absolute spectrum indices; empty means "all spectra in the file are visible". | |
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 backed by an sqMass (SQLite) spectrum store.
Wraps an OpenMS::Internal::MzMLSqliteHandler to expose its spectra through the OpenSWATH spectrum-access interface. Optionally restricts the visible set to a subset of spectra via a vector of indices, so the same on-disk store can back several views (e.g. one per SWATH window, or MS1-only / MS2-only).
Three constructors are provided:
(handler) — expose every spectrum in handler.(handler, indices) — expose only the spectra at the given indices.(parent, indices) — narrow an existing SpectrumAccessSqMass further; indices are interpreted against the parent's already-filtered view. Out-of-range entries throw Exception::IllegalArgument.All getXxxById methods honour the subset: id i refers to the i-th element of the visible view, not the i-th row of the underlying SQLite table.
Per-spectrum access (getSpectrumById / getSpectrumMetaById) is implemented but each call performs one OpenMS::Internal::MzMLSqliteHandler::readSpectra invocation and incurs the per-query SQLite overhead. Callers that need many spectra should prefer getAllSpectra, which issues a single batched read.
The class is read-only and SQLite supports parallel reads from independent connections, so cloning via lightClone gives a clone safe to use from another thread.
Spectrum-side operations are fully supported. On the chromatogram side, only the count getNrChromatograms is implemented; both getChromatogramById and getChromatogramNativeID throw Exception::NotImplemented. Use a different accessor (e.g. read via OpenMS::Internal::MzMLSqliteHandler directly) for chromatogram payloads.
| typedef OpenMS::MSSpectrum MSSpectrumType |
| SpectrumAccessSqMass | ( | const OpenMS::Internal::MzMLSqliteHandler & | handler | ) |
Construct from an sqMass handler exposing every spectrum it contains.
| [in] | handler | Read-only handler to the underlying sqMass file. |
| SpectrumAccessSqMass | ( | const OpenMS::Internal::MzMLSqliteHandler & | handler, |
| const std::vector< int > & | indices | ||
| ) |
Construct from an sqMass handler exposing only the spectra at the given indices.
| [in] | handler | Read-only handler to the underlying sqMass file. |
| [in] | indices | Absolute spectrum indices to expose; an empty vector falls back to "all spectra" semantics. |
| SpectrumAccessSqMass | ( | const SpectrumAccessSqMass & | sp, |
| const std::vector< int > & | indices | ||
| ) |
Construct a narrower view of an existing accessor.
If sp already has a subset configured, indices are interpreted against that subset (i.e. indices[k] is a position within sp's already-visible view, not within the raw sqMass file).
| [in] | sp | Parent accessor. |
| [in] | indices | Indices into sp's already-filtered view; empty inherits sp's subset unchanged. |
| Exception::IllegalArgument | If any entry of indices is out of range of sp's subset. |
|
override |
Destructor.
| SpectrumAccessSqMass | ( | const SpectrumAccessSqMass & | rhs | ) |
Copy constructor.
Duplicates the OpenMS::Internal::MzMLSqliteHandler value and the optional subset-index vector; no shared mutable state remains between the copy and the original.
| [in] | rhs | Source accessor to copy. |
| void getAllSpectra | ( | std::vector< OpenSwath::SpectrumPtr > & | spectra, |
| std::vector< OpenSwath::SpectrumMeta > & | spectra_meta | ||
| ) | const |
Batch-load every spectrum in the visible view into memory.
Preferred over repeated getSpectrumById calls — issues a single batched read.
| [out] | spectra | Receives one SpectrumPtr per visible spectrum. |
| [out] | spectra_meta | Receives the parallel metadata records. |
|
overridevirtual |
Not supported on sqMass.
| [in] | id | Ignored. |
| Exception::NotImplemented | Always — sqMass-backed access does not implement per-chromatogram payload retrieval. Use a different accessor for chromatogram payloads. |
Implements ISpectrumAccess.
|
overridevirtual |
Not supported on sqMass.
| [in] | id | Ignored. |
| Exception::NotImplemented | Always — sqMass-backed access does not expose chromatogram native ids. |
Implements ISpectrumAccess.
|
overridevirtual |
Number of chromatograms in the underlying sqMass file.
The count is supported even though per-chromatogram payload / native-id access is not.
Implements ISpectrumAccess.
|
overridevirtual |
Number of spectra in the visible view.
Implements ISpectrumAccess.
|
overridevirtual |
Indices into the visible view of spectra whose RT lies within an absolute window.
| [in] | RT | Centre of the RT window (same units as the underlying spectra). |
| [in] | deltaRT | Half-width of the RT window; matches spectra in \([RT - \mathrm{deltaRT}, RT + \mathrm{deltaRT}]\). |
OPENMS_PRECONDITION if deltaRT is negative. Implements ISpectrumAccess.
|
overridevirtual |
Load one spectrum by index in the visible view.
Issues a single OpenMS::Internal::MzMLSqliteHandler::readSpectra call per invocation, so the SQLite per-query overhead applies to each call.
| [in] | id | Spectrum index in the visible view (0-based; honours the optional subset). |
Implements ISpectrumAccess.
|
overridevirtual |
Load metadata (native id, RT, MS level) for one spectrum.
Same per-call cost trade-off as getSpectrumById.
| [in] | id | Spectrum index in the visible view (0-based). |
Implements ISpectrumAccess.
|
overridevirtual |
Return a copy of this accessor as a new OpenSwath::ISpectrumAccess pointer.
The clone uses an independent OpenMS::Internal::MzMLSqliteHandler value, so it is safe to use from another thread (SQLite supports parallel reads from independent connections).
Implements ISpectrumAccess.
|
private |
Handler for the underlying sqMass file (copied by value into each accessor / clone)
|
private |
Optional subset of absolute spectrum indices; empty means "all spectra in the file are visible".