OpenMS
CachedMzML.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- 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 
15 namespace OpenMS
16 {
17 
27  class OPENMS_DLLAPI CachedmzML
28  {
29 
30 public:
31 
37 
38  CachedmzML(const String& filename);
39 
41  CachedmzML(const CachedmzML & rhs);
42 
46 
48 
50 
51  size_t getNrSpectra() const;
52 
53  size_t getNrChromatograms() const;
54 
55  const MSExperiment& getMetaData() const
56  {
57  return meta_ms_experiment_;
58  }
59 
68  static void store(const String& filename, const PeakMap& map);
69 
79  static void load(const String& filename, CachedmzML& map);
80 
81 protected:
82 
83  void load_(const String& filename);
84 
87 
89  std::ifstream ifs_;
90 
93 
96 
98  std::vector<std::streampos> spectra_index_;
99  std::vector<std::streampos> chrom_index_;
100 
101  };
102 }
103 
An class that uses on-disk caching to read and write spectra and chromatograms.
Definition: CachedMzML.h:28
MSSpectrum getSpectrum(Size id)
String filename_cached_
Name of the cached mzML file.
Definition: CachedMzML.h:95
CachedmzML()
Default constructor.
void load_(const String &filename)
size_t getNrSpectra() const
std::ifstream ifs_
Internal filestream.
Definition: CachedMzML.h:89
String filename_
Name of the mzML file.
Definition: CachedMzML.h:92
CachedmzML(const CachedmzML &rhs)
Copy constructor.
std::vector< std::streampos > chrom_index_
Definition: CachedMzML.h:99
CachedmzML(const String &filename)
MSChromatogram getChromatogram(Size id)
std::vector< std::streampos > spectra_index_
Indices.
Definition: CachedMzML.h:98
MSExperiment meta_ms_experiment_
Meta data.
Definition: CachedMzML.h:86
static void store(const String &filename, const PeakMap &map)
Stores a map in a cached MzML file.
const MSExperiment & getMetaData() const
Definition: CachedMzML.h:55
size_t getNrChromatograms() const
static void load(const String &filename, CachedmzML &map)
Loads a map from a cached MzML file.
~CachedmzML()
Default destructor.
The representation of a chromatogram.
Definition: MSChromatogram.h:31
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:46
The representation of a 1D spectrum.
Definition: MSSpectrum.h:44
A more convenient string class.
Definition: String.h:34
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:101
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22