OpenMS  2.8.0
List of all members
CachedmzML Class Reference

An class that uses on-disk caching to read and write spectra and chromatograms. More...

#include <OpenMS/FORMAT/CachedMzML.h>

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

Constructors and Destructor

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_
 
 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
 
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...
 
void load_ (const String &filename)
 

Detailed Description

An class that uses on-disk caching to read and write spectra and chromatograms.

This class provides functions to read and write spectra and chromatograms to disk using a time-efficient format. Reading the data items from disk can be very fast and done in random order (once the in-memory index is built for the file).

Constructor & Destructor Documentation

◆ CachedmzML() [1/3]

Default constructor.

◆ CachedmzML() [2/3]

CachedmzML ( const String filename)

◆ CachedmzML() [3/3]

CachedmzML ( const CachedmzML rhs)

Copy constructor.

◆ ~CachedmzML()

~CachedmzML ( )

Default destructor.

Member Function Documentation

◆ getChromatogram()

MSChromatogram getChromatogram ( Size  id)

◆ getMetaData()

const MSExperiment& getMetaData ( ) const
inline

◆ getNrChromatograms()

size_t getNrChromatograms ( ) const

◆ getNrSpectra()

size_t getNrSpectra ( ) const

◆ getSpectrum()

MSSpectrum getSpectrum ( Size  id)

◆ load()

static void load ( const String filename,
CachedmzML map 
)
static

Loads a map from a cached MzML file.

filename The data location (ends in .mzML, expects an adjacent .mzML.cached file) map A CachedmzML result object

Exceptions
Exception::FileNotFoundis thrown if the file could not be opened
Exception::ParseErroris thrown if an error occurs during parsing

◆ load_()

void load_ ( const String filename)
protected

◆ store()

static void store ( const String filename,
const PeakMap map 
)
static

Stores a map in a cached MzML file.

filename The data location (ends in .mzML) map has to be an MSExperiment or have the same interface.

Exceptions
Exception::UnableToCreateFileis thrown if the file could not be created

Member Data Documentation

◆ chrom_index_

std::vector<std::streampos> chrom_index_
protected

◆ filename_

String filename_
protected

Name of the mzML file.

◆ filename_cached_

String filename_cached_
protected

Name of the cached mzML file.

◆ ifs_

std::ifstream ifs_
protected

Internal filestream.

◆ meta_ms_experiment_

MSExperiment meta_ms_experiment_
protected

Meta data.

◆ spectra_index_

std::vector<std::streampos> spectra_index_
protected

Indices.