Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Protected Attributes | Private Types | List of all members
MSDataCachedConsumer Class Reference

Transforming and cached writing consumer of MS data. More...

#include <OpenMS/FORMAT/DATAACCESS/MSDataCachedConsumer.h>

Inheritance diagram for MSDataCachedConsumer:
CachedmzML IMSDataConsumer ProgressLogger

Public Member Functions

 MSDataCachedConsumer (String filename, bool clearData=true)
 Constructor. More...
 
 ~MSDataCachedConsumer ()
 Destructor. More...
 
void consumeSpectrum (SpectrumType &s)
 Write a spectrum to the output file. More...
 
void consumeChromatogram (ChromatogramType &c)
 Write a chromatogram to the output file. More...
 
void setExpectedSize (Size, Size)
 Set expected size of spectra and chromatograms to be consumed. More...
 
void setExperimentalSettings (const ExperimentalSettings &)
 Set experimental settings (meta-data) of the data to be consumed. More...
 
- Public Member Functions inherited from CachedmzML
 CachedmzML ()
 Default constructor. More...
 
 ~CachedmzML ()
 Default destructor. More...
 
CachedmzMLoperator= (const CachedmzML &rhs)
 Assignment operator. More...
 
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...
 
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...
 
- Public Member Functions inherited from IMSDataConsumer
virtual ~IMSDataConsumer ()
 

Protected Attributes

std::ofstream ofs_
 
bool clearData_
 
Size spectra_written_
 
Size chromatograms_written_
 
- Protected Attributes inherited from CachedmzML
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 Types

typedef MSSpectrum SpectrumType
 
typedef MSChromatogram ChromatogramType
 

Additional Inherited Members

- Public Types inherited from CachedmzML
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 Types inherited from IMSDataConsumer
typedef MSSpectrum SpectrumType
 
typedef MSChromatogram ChromatogramType
 
- Static Public Member Functions inherited from CachedmzML
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 inherited from CachedmzML
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...
 
- 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

Transforming and cached writing consumer of MS data.

Is able to transform a spectrum on the fly while it is read using a function pointer that can be set on the object. The spectra is then cached to disk using the functions provided in CachedmzML.

Member Typedef Documentation

◆ ChromatogramType

◆ SpectrumType

typedef MSSpectrum SpectrumType
private

Constructor & Destructor Documentation

◆ MSDataCachedConsumer()

MSDataCachedConsumer ( String  filename,
bool  clearData = true 
)
inline

Constructor.

Opens the output file and writes the header.

References CACHED_MZML_FILE_IDENTIFIER.

◆ ~MSDataCachedConsumer()

~MSDataCachedConsumer ( )
inline

Destructor.

Closes the output file and writes the footer.

Member Function Documentation

◆ consumeChromatogram()

void consumeChromatogram ( ChromatogramType c)
inlinevirtual

Write a chromatogram to the output file.

Implements IMSDataConsumer.

References MSChromatogram::clear().

◆ consumeSpectrum()

void consumeSpectrum ( SpectrumType s)
inlinevirtual

Write a spectrum to the output file.

Implements IMSDataConsumer.

References MSSpectrum::clear().

◆ setExpectedSize()

void setExpectedSize ( Size  expectedSpectra,
Size  expectedChromatograms 
)
inlinevirtual

Set expected size of spectra and chromatograms to be consumed.

Some implementations might care about the number of spectra and chromatograms to be consumed and need to be informed about this (usually before consuming starts).

Note
Calling this method is optional but good practice.
Parameters
expectedSpectraNumber of spectra expected
expectedChromatogramsNumber of chromatograms expected

Implements IMSDataConsumer.

Referenced by CachedSwathFileConsumer::addNewSwathMap_().

◆ setExperimentalSettings()

void setExperimentalSettings ( const ExperimentalSettings exp)
inlinevirtual

Set experimental settings (meta-data) of the data to be consumed.

Some implementations might need to know about the meta-data (or the context) of the spectra and chromatograms to be consumed. This method allows them learn this.

Note
Calling this method is optional but good practice.
Parameters
expExperimental settings meta data for the data to be consumed

Implements IMSDataConsumer.

Member Data Documentation

◆ chromatograms_written_

Size chromatograms_written_
protected

◆ clearData_

bool clearData_
protected

◆ ofs_

std::ofstream ofs_
protected

◆ spectra_written_

Size spectra_written_
protected

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