Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Types | Protected Member Functions | Protected Attributes | Private Attributes | 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:
ProgressLogger MSDataCachedConsumer

Public Types

typedef PeakMap MapType
 
typedef MSSpectrum SpectrumType
 
typedef MSChromatogram ChromatogramType
 
typedef double DatumSingleton
 
typedef std::vector< DatumSingletonDatavector
 
- Public Types inherited from ProgressLogger
enum  LogType { CMD, GUI, NONE }
 Possible log types. More...
 

Public Member Functions

Constructors and Destructor
 CachedmzML ()
 Default constructor. More...
 
 ~CachedmzML ()
 Default destructor. More...
 
CachedmzMLoperator= (const CachedmzML &rhs)
 Assignment operator. More...
 
Read / Write a complete mass spectrometric experiment (or its meta data)
void writeMemdump (MapType &exp, String out)
 Write complete spectra as a dump to the disk. More...
 
void writeMetadata (MapType exp, String out_meta, bool addCacheMetaValue=false)
 Write only the meta data of an MSExperiment. More...
 
void readMemdump (MapType &exp_reading, String filename) const
 Read all spectra from a dump from the disk. More...
 
Access and creation of the binary indices
void createMemdumpIndex (String filename)
 Create an index on the location of all the spectra and chromatograms. More...
 
const std::vector< std::streampos > & getSpectraIndex () const
 Access to a constant copy of the binary spectra index. More...
 
const std::vector< std::streampos > & getChromatogramIndex () const
 Access to a constant copy of the binary chromatogram index. More...
 
- Public Member Functions inherited from ProgressLogger
 ProgressLogger ()
 Constructor. More...
 
 ~ProgressLogger ()
 Destructor. More...
 
 ProgressLogger (const ProgressLogger &other)
 Copy constructor. More...
 
ProgressLoggeroperator= (const ProgressLogger &other)
 Assignment Operator. More...
 
void setLogType (LogType type) const
 Sets the progress log that should be used. The default type is NONE! More...
 
LogType getLogType () const
 Returns the type of progress log being used. More...
 
void startProgress (SignedSize begin, SignedSize end, const String &label) const
 Initializes the progress display. More...
 
void setProgress (SignedSize value) const
 Sets the current progress. More...
 
void endProgress () const
 Ends the progress display. More...
 

Static Public Member Functions

Direct access to a single Spectrum or Chromatogram
static void readSpectrumFast (OpenSwath::BinaryDataArrayPtr data1, OpenSwath::BinaryDataArrayPtr data2, std::ifstream &ifs, int &ms_level, double &rt)
 fast access to a spectrum (a direct copy of the data into the provided arrays) More...
 
static void readChromatogramFast (OpenSwath::BinaryDataArrayPtr data1, OpenSwath::BinaryDataArrayPtr data2, std::ifstream &ifs)
 fast access to a chromatogram (a direct copy of the data into the provided arrays) More...
 

Protected Member Functions

void readSpectrum_ (Datavector &data1, Datavector &data2, std::ifstream &ifs, int &ms_level, double &rt) const
 read a single spectrum directly into a datavector (assuming file is already at the correct position) More...
 
void readChromatogram_ (Datavector &data1, Datavector &data2, std::ifstream &ifs) const
 read a single chromatogram directly into a datavector (assuming file is already at the correct position) More...
 
void readSpectrum_ (SpectrumType &spectrum, std::ifstream &ifs) const
 read a single spectrum directly into an OpenMS MSSpectrum (assuming file is already at the correct position) More...
 
void readChromatogram_ (ChromatogramType &chromatogram, std::ifstream &ifs) const
 read a single chromatogram directly into an OpenMS MSChromatograms (assuming file is already at the correct position) More...
 
void writeSpectrum_ (const SpectrumType &spectrum, std::ofstream &ofs)
 write a single spectrum to filestream More...
 
void writeChromatogram_ (const ChromatogramType &chromatogram, std::ofstream &ofs)
 write a single chromatogram to filestream More...
 

Protected Attributes

std::vector< std::streampos > spectra_index_
 Members. More...
 
std::vector< std::streampos > chrom_index_
 
- Protected Attributes inherited from ProgressLogger
LogType type_
 
time_t last_invoke_
 
ProgressLoggerImplcurrent_logger_
 

Private Attributes

int int_field_
 
double dbl_field_
 

Additional Inherited Members

- Static Protected Member Functions inherited from ProgressLogger
static String logTypeToFactoryName_ (LogType type)
 Return the name of the factory product used for this log type. More...
 
- Static Protected Attributes inherited from ProgressLogger
static int recursion_depth_
 

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

Member Typedef Documentation

◆ ChromatogramType

◆ Datavector

typedef std::vector<DatumSingleton> Datavector

◆ DatumSingleton

◆ MapType

typedef PeakMap MapType

◆ SpectrumType

Constructor & Destructor Documentation

◆ CachedmzML()

Default constructor.

◆ ~CachedmzML()

~CachedmzML ( )

Default destructor.

Member Function Documentation

◆ createMemdumpIndex()

void createMemdumpIndex ( String  filename)

Create an index on the location of all the spectra and chromatograms.

◆ getChromatogramIndex()

const std::vector<std::streampos>& getChromatogramIndex ( ) const

Access to a constant copy of the binary chromatogram index.

◆ getSpectraIndex()

const std::vector<std::streampos>& getSpectraIndex ( ) const

Access to a constant copy of the binary spectra index.

◆ operator=()

CachedmzML& operator= ( const CachedmzML rhs)

Assignment operator.

◆ readChromatogram_() [1/2]

void readChromatogram_ ( Datavector data1,
Datavector data2,
std::ifstream &  ifs 
) const
protected

read a single chromatogram directly into a datavector (assuming file is already at the correct position)

◆ readChromatogram_() [2/2]

void readChromatogram_ ( ChromatogramType chromatogram,
std::ifstream &  ifs 
) const
protected

read a single chromatogram directly into an OpenMS MSChromatograms (assuming file is already at the correct position)

◆ readChromatogramFast()

static void readChromatogramFast ( OpenSwath::BinaryDataArrayPtr  data1,
OpenSwath::BinaryDataArrayPtr  data2,
std::ifstream &  ifs 
)
inlinestatic

fast access to a chromatogram (a direct copy of the data into the provided arrays)

Exceptions
Exception::ParseErroris thrown if the chromatogram size cannot be read

◆ readMemdump()

void readMemdump ( MapType exp_reading,
String  filename 
) const

Read all spectra from a dump from the disk.

Referenced by extractCachedMetaFilename().

◆ readSpectrum_() [1/2]

void readSpectrum_ ( Datavector data1,
Datavector data2,
std::ifstream &  ifs,
int &  ms_level,
double rt 
) const
protected

read a single spectrum directly into a datavector (assuming file is already at the correct position)

◆ readSpectrum_() [2/2]

void readSpectrum_ ( SpectrumType spectrum,
std::ifstream &  ifs 
) const
protected

read a single spectrum directly into an OpenMS MSSpectrum (assuming file is already at the correct position)

◆ readSpectrumFast()

static void readSpectrumFast ( OpenSwath::BinaryDataArrayPtr  data1,
OpenSwath::BinaryDataArrayPtr  data2,
std::ifstream &  ifs,
int &  ms_level,
double rt 
)
inlinestatic

fast access to a spectrum (a direct copy of the data into the provided arrays)

Exceptions
Exception::ParseErroris thrown if the spectrum size cannot be read

◆ writeChromatogram_()

void writeChromatogram_ ( const ChromatogramType chromatogram,
std::ofstream &  ofs 
)
protected

write a single chromatogram to filestream

◆ writeMemdump()

void writeMemdump ( MapType exp,
String  out 
)

Write complete spectra as a dump to the disk.

Referenced by extractCachedMetaFilename().

◆ writeMetadata()

void writeMetadata ( MapType  exp,
String  out_meta,
bool  addCacheMetaValue = false 
)

◆ writeSpectrum_()

void writeSpectrum_ ( const SpectrumType spectrum,
std::ofstream &  ofs 
)
protected

write a single spectrum to filestream

Member Data Documentation

◆ chrom_index_

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

◆ dbl_field_

double dbl_field_
private

◆ int_field_

int int_field_
private

◆ spectra_index_

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

Members.


OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:07 using doxygen 1.8.13