OpenMS
SpectrumAccessOpenMSCached Class Reference

An implementation of the Spectrum Access interface using on-disk caching. More...

#include <OpenMS/ANALYSIS/OPENSWATH/DATAACCESS/SpectrumAccessOpenMSCached.h>

Inheritance diagram for SpectrumAccessOpenMSCached:
[legend]
Collaboration diagram for SpectrumAccessOpenMSCached:
[legend]

Public Types

typedef OpenMS::PeakMap MSExperimentType
 
typedef OpenMS::MSSpectrum MSSpectrumType
 

Public Member Functions

 SpectrumAccessOpenMSCached (const String &filename)
 Constructor, opens the file stream. More...
 
 ~SpectrumAccessOpenMSCached () override
 Destructor. More...
 
 SpectrumAccessOpenMSCached (const SpectrumAccessOpenMSCached &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 id) override
 Return a pointer to a spectrum at the given id. More...
 
OpenSwath::SpectrumMeta getSpectrumMetaById (int id) const override
 Returns the meta information for a spectrum. More...
 
std::vector< std::size_t > getSpectraByRT (double RT, double deltaRT) 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...
 
SpectrumSettings getSpectraMetaInfo (int id) const
 
OpenSwath::ChromatogramPtr getChromatogramById (int id) override
 Return a pointer to a chromatogram at the given id. More...
 
size_t getNrChromatograms () const override
 Returns the number of chromatograms available. More...
 
ChromatogramSettings getChromatogramMetaInfo (int id) const
 
std::string getChromatogramNativeID (int id) const override
 Returns the native id of the chromatogram at the given id. More...
 
- Public Member Functions inherited from ISpectrumAccess
virtual ~ISpectrumAccess ()
 Destructor. More...
 
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. More...
 
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. More...
 
 CachedmzML (const String &filename)
 
 CachedmzML (const CachedmzML &rhs)
 Copy constructor. More...
 
 ~CachedmzML ()
 Default destructor. More...
 
MSSpectrum getSpectrum (Size id)
 
MSChromatogram getChromatogram (Size id)
 
size_t getNrSpectra () const
 
size_t getNrChromatograms () const
 
const MSExperimentgetMetaData () const
 

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 More...
 
- Static Public Member Functions inherited from CachedmzML
static void store (const String &filename, const PeakMap &map)
 Stores a map in a cached MzML file. More...
 
static void load (const String &filename, CachedmzML &map)
 Loads a map from a cached MzML file. More...
 
- Protected Member Functions inherited from CachedmzML
void load_ (const String &filename)
 
- Protected Attributes inherited from CachedmzML
MSExperiment meta_ms_experiment_
 Meta data. More...
 
std::ifstream ifs_
 Internal filestream. More...
 
String filename_
 Name of the mzML file. More...
 
String filename_cached_
 Name of the cached mzML file. More...
 
std::vector< std::streampos > spectra_index_
 Indices. More...
 
std::vector< std::streampos > chrom_index_
 

Detailed Description

An implementation of the Spectrum Access interface using on-disk caching.

This class implements the OpenSWATH Spectrum Access interface (ISpectrumAccess) using the CachedmzML class which is able to read and write a cached mzML file.

Note
This implementation is not thread-safe since it keeps internally a single file access pointer which it moves when accessing a specific data item. The caller is responsible to ensure that access is performed atomically.

Member Typedef Documentation

◆ MSExperimentType

◆ MSSpectrumType

Constructor & Destructor Documentation

◆ SpectrumAccessOpenMSCached() [1/2]

SpectrumAccessOpenMSCached ( const String filename)
explicit

Constructor, opens the file stream.

Parameters
filenameThe filename of the .mzML file (it is assumed a second file .mzML.cached exists).
Exceptions
Exception::FileNotFoundis thrown if the file is not found
Exception::ParseErroris thrown if the file cannot be parsed

◆ ~SpectrumAccessOpenMSCached()

Destructor.

◆ SpectrumAccessOpenMSCached() [2/2]

Copy constructor.

Member Function Documentation

◆ getChromatogramById()

OpenSwath::ChromatogramPtr getChromatogramById ( int  id)
overridevirtual

Return a pointer to a chromatogram at the given id.

Implements ISpectrumAccess.

◆ getChromatogramMetaInfo()

ChromatogramSettings getChromatogramMetaInfo ( int  id) const

◆ 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.

◆ getSpectraMetaInfo()

SpectrumSettings getSpectraMetaInfo ( int  id) const

◆ 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.