OpenMS
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:
[legend]
Collaboration diagram for SpectrumAccessSqMass:
[legend]

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::ISpectrumAccesslightClone () 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);
swath_maps[k].sptr = sptr;
Sqlite handler for storing spectra and chromatograms in sqMass format.
Definition: MzMLSqliteHandler.h:52
An implementation of the Spectrum Access interface using SQL files.
Definition: SpectrumAccessSqMass.h:61
const double k
Definition: Constants.h:132
boost::shared_ptr< ISpectrumAccess > SpectrumAccessPtr
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:61

Member Typedef Documentation

◆ MSChromatogramType

◆ MSSpectrumType

Constructor & Destructor Documentation

◆ SpectrumAccessSqMass() [1/4]

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]

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)
overridevirtual

Return a pointer to a chromatogram at the given id.

Implements ISpectrumAccess.

◆ getChromatogramNativeID()

std::string getChromatogramNativeID ( int  id) const
overridevirtual

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

Implements ISpectrumAccess.

◆ getNrChromatograms()

size_t getNrChromatograms ( ) const
overridevirtual

Returns the number of chromatograms available.

Implements ISpectrumAccess.

◆ getNrSpectra()

size_t getNrSpectra ( ) const
overridevirtual

Returns the number of spectra available.

Implements ISpectrumAccess.

◆ getSpectraByRT()

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

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

Implements ISpectrumAccess.

◆ getSpectrumById()

OpenSwath::SpectrumPtr getSpectrumById ( int  id)
overridevirtual

Return a pointer to a spectrum at the given id.

Implements ISpectrumAccess.

◆ getSpectrumMetaById()

OpenSwath::SpectrumMeta getSpectrumMetaById ( int  id) const
overridevirtual

Returns the meta information for a spectrum.

Implements ISpectrumAccess.

◆ lightClone()

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

Light clone operator (actual data will not get copied)

Implements ISpectrumAccess.

Member Data Documentation

◆ handler_

Access to underlying sqMass file.

◆ sidx_

std::vector<int> sidx_
private

Optional subset of spectral indices.