OpenMS
|
An class that uses on-disk caching to read and write spectra and chromatograms. More...
#include <OpenMS/FORMAT/HANDLERS/CachedMzMLHandler.h>
Public Types | |
typedef PeakMap | MapType |
typedef MSSpectrum | SpectrumType |
typedef MSChromatogram | ChromatogramType |
typedef double | DatumSingleton |
typedef std::vector< DatumSingleton > | Datavector |
Public Types inherited from ProgressLogger | |
enum | LogType { CMD , GUI , NONE } |
Possible log types. More... | |
Public Member Functions | |
Constructors and Destructor | |
CachedMzMLHandler () | |
Default constructor. More... | |
~CachedMzMLHandler () override | |
Default destructor. More... | |
CachedMzMLHandler & | operator= (const CachedMzMLHandler &rhs) |
Assignment operator. More... | |
Read / Write a complete mass spectrometric experiment (or its meta data) | |
void | writeMemdump (const MapType &exp, const String &out) const |
Write complete spectra as a dump to the disk. More... | |
void | writeMetadata (MapType exp, const String &out_meta, bool addCacheMetaValue=false) |
Write only the meta data of an MSExperiment. More... | |
void | writeMetadata_x (const MapType &exp, const String &out_meta, bool addCacheMetaValue=false) |
Write only the meta data of an MSExperiment. More... | |
void | readMemdump (MapType &exp_reading, const String &filename) const |
Read all spectra from a dump from the disk. More... | |
Access and creation of the binary indices | |
void | createMemdumpIndex (const 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... | |
virtual | ~ProgressLogger () |
Destructor. More... | |
ProgressLogger (const ProgressLogger &other) | |
Copy constructor. More... | |
ProgressLogger & | operator= (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 | setLogger (ProgressLoggerImpl *logger) |
Sets the logger to be used for progress logging. 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 (UInt64 bytes_processed=0) const |
void | nextProgress () const |
increment progress by 1 (according to range begin-end) More... | |
Private Types | |
typedef int | IntType |
typedef double | DoubleType |
Direct access to a single Spectrum or Chromatogram | |
std::vector< std::streampos > | spectra_index_ |
Members. More... | |
std::vector< std::streampos > | chrom_index_ |
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 std::vector< OpenSwath::BinaryDataArrayPtr > | readSpectrumFast (std::ifstream &ifs, int &ms_level, double &rt) |
Fast access to a spectrum. More... | |
static void | readChromatogramFast (OpenSwath::BinaryDataArrayPtr &data1, OpenSwath::BinaryDataArrayPtr &data2, std::ifstream &ifs) |
Fast access to a chromatogram. More... | |
static std::vector< OpenSwath::BinaryDataArrayPtr > | readChromatogramFast (std::ifstream &ifs) |
Fast access to a chromatogram. More... | |
static void | readSpectrum (SpectrumType &spectrum, std::ifstream &ifs) |
Read a single spectrum directly into an OpenMS MSSpectrum (assuming file is already at the correct position) More... | |
static void | readChromatogram (ChromatogramType &chromatogram, std::ifstream &ifs) |
Read a single chromatogram directly into an OpenMS MSChromatogram (assuming file is already at the correct position) More... | |
void | writeSpectrum_ (const SpectrumType &spectrum, std::ofstream &ofs) const |
write a single spectrum to filestream More... | |
void | writeChromatogram_ (const ChromatogramType &chromatogram, std::ofstream &ofs) const |
write a single chromatogram to filestream More... | |
static void | readDataFast_ (std::ifstream &ifs, std::vector< OpenSwath::BinaryDataArrayPtr > &data, const Size &data_size, const Size &nr_float_arrays) |
helper method for fast reading of spectra and chromatograms More... | |
Additional Inherited Members | |
Protected Attributes inherited from ProgressLogger | |
LogType | type_ |
time_t | last_invoke_ |
ProgressLoggerImpl * | current_logger_ |
Static Protected Attributes inherited from ProgressLogger | |
static int | recursion_depth_ |
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).
typedef MSChromatogram ChromatogramType |
typedef std::vector<DatumSingleton> Datavector |
typedef double DatumSingleton |
|
private |
|
private |
typedef MSSpectrum SpectrumType |
Default constructor.
|
override |
Default destructor.
void createMemdumpIndex | ( | const String & | filename | ) |
Create an index on the location of all the spectra and chromatograms.
const std::vector<std::streampos>& getChromatogramIndex | ( | ) | const |
Access to a constant copy of the binary chromatogram index.
const std::vector<std::streampos>& getSpectraIndex | ( | ) | const |
Access to a constant copy of the binary spectra index.
CachedMzMLHandler& operator= | ( | const CachedMzMLHandler & | rhs | ) |
Assignment operator.
|
static |
Read a single chromatogram directly into an OpenMS MSChromatogram (assuming file is already at the correct position)
chromatogram | Output chromatogram |
ifs | Input file stream (moved to the correct position) |
Exception::ParseError | is thrown if the chromatogram size cannot be read |
|
inlinestatic |
Fast access to a chromatogram.
data1 | First data array (RT) |
data2 | Second data array (Intensity) |
ifs | Input file stream (moved to the correct position) |
Exception::ParseError | is thrown if the chromatogram size cannot be read |
|
static |
Fast access to a chromatogram.
ifs | Input file stream (moved to the correct position) |
Exception::ParseError | is thrown if the chromatogram size cannot be read |
|
inlinestaticprotected |
helper method for fast reading of spectra and chromatograms
Read all spectra from a dump from the disk.
|
static |
Read a single spectrum directly into an OpenMS MSSpectrum (assuming file is already at the correct position)
spectrum | Output spectrum |
ifs | Input file stream (moved to the correct position) |
Exception::ParseError | is thrown if the chromatogram size cannot be read |
|
inlinestatic |
fast access to a spectrum (a direct copy of the data into the provided arrays)
[out] | data1 | First data array (m/z) |
[out] | data2 | Second data array (Intensity) |
ifs | Input file stream (moved to the correct position) | |
[out] | ms_level | Output parameter to store the MS level of the spectrum (1, 2, 3 ...) |
[out] | rt | Output parameter to store the retention time of the spectrum |
Exception::ParseError | is thrown if the spectrum cannot be read |
|
static |
Fast access to a spectrum.
ifs | Input file stream (moved to the correct position) |
ms_level | Output parameter to store the MS level of the spectrum (1, 2, 3 ...) |
rt | Output parameter to store the retention time of the spectrum |
Exception::ParseError | is thrown if the spectrum cannot be read |
|
protected |
write a single chromatogram to filestream
Write complete spectra as a dump to the disk.
Write only the meta data of an MSExperiment.
Referenced by CachedSwathFileConsumer::ensureMapsAreFilled_().
void writeMetadata_x | ( | const MapType & | exp, |
const String & | out_meta, | ||
bool | addCacheMetaValue = false |
||
) |
Write only the meta data of an MSExperiment.
|
protected |
write a single spectrum to filestream
|
protected |
|
protected |
Members.