OpenMS
Loading...
Searching...
No Matches
CachedMzML.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Hannes Roest $
6// $Authors: Hannes Roest $
7// --------------------------------------------------------------------------
8
9#pragma once
10
12
13#include <fstream>
14
15namespace OpenMS
16{
17
31 class OPENMS_DLLAPI CachedmzML
32 {
33
34public:
35
45
55 CachedmzML(const std::string& filename);
56
66 CachedmzML(const CachedmzML & rhs);
67
75
94
107
113 size_t getNrSpectra() const;
114
120 size_t getNrChromatograms() const;
121
132 {
133 return meta_ms_experiment_;
134 }
135
148 static void store(const std::string& filename, const PeakMap& map);
149
164 static void load(const std::string& filename, CachedmzML& map);
165
166protected:
167
168 void load_(const std::string& filename);
169
172
174 std::ifstream ifs_;
175
177 std::string filename_;
178
180 std::string filename_cached_;
181
183 std::vector<std::streampos> spectra_index_;
184 std::vector<std::streampos> chrom_index_;
185
186 };
187}
188
Random-access reader/writer for the OpenMS on-disk cache format.
Definition CachedMzML.h:32
MSSpectrum getSpectrum(Size id)
Read one spectrum from the side-car file.
CachedmzML()
Default constructor.
std::string filename_
Name of the mzML file.
Definition CachedMzML.h:177
static void load(const std::string &filename, CachedmzML &map)
Load a cached .mzML pair into map.
size_t getNrSpectra() const
Number of spectra in the loaded experiment.
std::ifstream ifs_
Internal filestream.
Definition CachedMzML.h:174
CachedmzML(const CachedmzML &rhs)
Copy constructor.
CachedmzML(const std::string &filename)
Construct and load metadata + side-car index from filename in one step.
std::vector< std::streampos > chrom_index_
Definition CachedMzML.h:184
MSChromatogram getChromatogram(Size id)
Read one chromatogram from the side-car file.
std::vector< std::streampos > spectra_index_
Indices.
Definition CachedMzML.h:183
MSExperiment meta_ms_experiment_
Meta data.
Definition CachedMzML.h:171
size_t getNrChromatograms() const
Number of chromatograms in the loaded experiment.
void load_(const std::string &filename)
static void store(const std::string &filename, const PeakMap &map)
Write map to disk as a cached .mzML pair.
const MSExperiment & getMetaData() const
Experiment-level metadata loaded from the .mzML file.
Definition CachedMzML.h:131
std::string filename_cached_
Name of the cached mzML file.
Definition CachedMzML.h:180
~CachedmzML()
Destructor.
The representation of a chromatogram.
Definition MSChromatogram.h:30
In-Memory representation of a mass spectrometry run.
Definition MSExperiment.h:49
The representation of a 1D spectrum.
Definition MSSpectrum.h:44
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19