| OpenMS 2.5.0

Public Types | Public Member Functions | Private Attributes | List of all members
SpectrumAccessSqMass Class Reference

An implementation of the Spectrum Access interface using SQL files. More...

`#include <OpenMS/ANALYSIS/OPENSWATH/DATAACCESS/SpectrumAccessSqMass.h>`

Inheritance diagram for SpectrumAccessSqMass:

## Public Types

typedef OpenMS::MSSpectrum | MSSpectrumType
typedef OpenMS::MSChromatogram | MSChromatogramType

## Public Member Functions

| SpectrumAccessSqMass (const OpenMS::Internal::MzMLSqliteHandler &handler)
| Constructor. More...
| SpectrumAccessSqMass (const OpenMS::Internal::MzMLSqliteHandler &handler, const std::vector< int > &indices)
| SpectrumAccessSqMass (const SpectrumAccessSqMass &sp, const std::vector< int > &indices)
| ~SpectrumAccessSqMass () override
| Destructor. More...
| SpectrumAccessSqMass (const SpectrumAccessSqMass &rhs)
| Copy constructor. More...
boost::shared_ptr< OpenSwath::ISpectrumAccess > | lightClone () const override
| Light clone operator (actual data will not get copied) More...
OpenSwath::SpectrumPtr | getSpectrumById (int) override
| Return a pointer to a spectrum at the given id. More...
OpenSwath::SpectrumMeta | getSpectrumMetaById (int) const override
| Returns the meta information for a spectrum. More...
void | getAllSpectra (std::vector< OpenSwath::SpectrumPtr > &spectra, std::vector< OpenSwath::SpectrumMeta > &spectra_meta) const
| Load all spectra from the underlying sqMass file into memory. More...
std::vector< std::size_t > | getSpectraByRT (double, double) const override
| Return a vector of ids of spectra that are within RT +/- deltaRT. More...
size_t | getNrSpectra () const override
| Returns the number of spectra available. More...
OpenSwath::ChromatogramPtr | getChromatogramById (int) override
| Return a pointer to a chromatogram at the given id. More...
size_t | getNrChromatograms () const override
| Returns the number of chromatograms available. More...
std::string | getChromatogramNativeID (int) const override
| Returns the native id of the chromatogram at the given id. More...
Public Member Functions inherited from ISpectrumAccess
virtual | ~ISpectrumAccess ()
| Destructor. More...

## Private Attributes

OpenMS::Internal::MzMLSqliteHandler | handler_
| Access to underlying sqMass file. More...
std::vector< int > | sidx_
| Optional subset of spectral indices. More...

## Detailed Description

An implementation of the Spectrum Access interface using SQL files.

The interface takes an MzMLSqliteHandler object to access spectra and chromatograms from a sqlite file (sqMass). Currently access to individual spectra and chromatograms are not supported due to large overhead of opening a DB connection and performing a single query.

Instead, the users should use getAllSpectra which returns all available spectra together.

The interface allows to be constructed in a way as to only provide access to a subset of spectra / chromatograms by supplying a set of indices which are then used to provide a transparent interface to any consumer who will get access to the described subset of spectra / chromatograms. This can be useful to provide a specific interface to MS1 or MS2 spectra only or to different DIA / SWATH-MS windows.

Parallel access is supported through this interface as it is read-only and sqlite3 supports multiple parallel read threads as long as they use a different db connection.

Sample usage:

// Obtain swath_map with boundaries first
std::vector<int> indices = sql_mass_reader.readSpectraForWindow(swath_map);
OpenMS::Internal::MzMLSqliteHandler handler(file);
OpenSwath::SpectrumAccessPtr sptr(new OpenMS::SpectrumAccessSqMass(handler, indices));
swath_maps[k].sptr = sptr;

## Member Typedef Documentation

## ◆ MSChromatogramType

typedef OpenMS::MSChromatogram MSChromatogramType

## ◆ MSSpectrumType

typedef OpenMS::MSSpectrum MSSpectrumType

## Constructor & Destructor Documentation

## ◆ SpectrumAccessSqMass() [1/4]

SpectrumAccessSqMass | ( | const OpenMS::Internal::MzMLSqliteHandler & | handler | ) |

Constructor.

## ◆ SpectrumAccessSqMass() [2/4]

SpectrumAccessSqMass | ( | const OpenMS::Internal::MzMLSqliteHandler & | handler,
|  | const std::vector< int > & | indices
| ) |  |

## ◆ SpectrumAccessSqMass() [3/4]

SpectrumAccessSqMass | ( | const SpectrumAccessSqMass & | sp,
|  | const std::vector< int > & | indices
| ) |  |

## ◆ ~SpectrumAccessSqMass()

~SpectrumAccessSqMass | ( |  | ) |

override

Destructor.

## ◆ SpectrumAccessSqMass() [4/4]

SpectrumAccessSqMass | ( | const SpectrumAccessSqMass & | rhs | ) |

Copy constructor.

## Member Function Documentation

## ◆ getAllSpectra()

void getAllSpectra | ( | std::vector< OpenSwath::SpectrumPtr > & | spectra,
|  | std::vector< OpenSwath::SpectrumMeta > & | spectra_meta
| ) |  | const

Load all spectra from the underlying sqMass file into memory.

## ◆ getChromatogramById()

OpenSwath::ChromatogramPtr getChromatogramById | ( | int | id | ) |

override virtual

Return a pointer to a chromatogram at the given id.

Implements ISpectrumAccess.

## ◆ getChromatogramNativeID()

std::string getChromatogramNativeID | ( | int | id | ) | const

override virtual

Returns the native id of the chromatogram at the given id.

Implements ISpectrumAccess.

## ◆ getNrChromatograms()

size_t getNrChromatograms | ( |  | ) | const

override virtual

Returns the number of chromatograms available.

Implements ISpectrumAccess.

## ◆ getNrSpectra()

size_t getNrSpectra | ( |  | ) | const

override virtual

Returns the number of spectra available.

Implements ISpectrumAccess.

## ◆ getSpectraByRT()

std::vector<std::size_t> getSpectraByRT | ( | double | RT,
|  | double | deltaRT
| ) |  | const

override virtual

Return a vector of ids of spectra that are within RT +/- deltaRT.

Implements ISpectrumAccess.

## ◆ getSpectrumById()

OpenSwath::SpectrumPtr getSpectrumById | ( | int | id | ) |

override virtual

Return a pointer to a spectrum at the given id.

Implements ISpectrumAccess.

## ◆ getSpectrumMetaById()

OpenSwath::SpectrumMeta getSpectrumMetaById | ( | int | id | ) | const

override virtual

Returns the meta information for a spectrum.

Implements ISpectrumAccess.

## ◆ lightClone()

boost::shared_ptr<OpenSwath::ISpectrumAccess> lightClone | ( |  | ) | const

override virtual

Light clone operator (actual data will not get copied)

Implements ISpectrumAccess.

## Member Data Documentation

## ◆ handler_

OpenMS::Internal::MzMLSqliteHandler handler_

private

Access to underlying sqMass file.

## ◆ sidx_

std::vector<int> sidx_

private

Optional subset of spectral indices.