OpenMS
LayerStoreData.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: Chris Bielow $
6 // $Authors: Chris Bielow $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 // OpenMS_GUI config
12 
20 
21 
22 namespace OpenMS
23 {
24 
28  class OPENMS_GUI_DLLAPI LayerStoreData
29  {
30  public:
31  LayerStoreData(FileTypeList supported_storage_formats) :
32  storage_formats_(supported_storage_formats)
33  {
34  }
35 
37  virtual ~LayerStoreData() = default;
38 
41  {
42  return storage_formats_;
43  }
44 
50  virtual void saveToFile(const String& filename, const ProgressLogger::LogType lt) const = 0;
51 
52  protected:
53 
56 
58  };
59 
63  class OPENMS_GUI_DLLAPI LayerStoreDataPeakMapVisible
64  : public LayerStoreData
65  {
66  public:
69  {}
70 
71  // docu in base class
72  void saveToFile(const String& filename, const ProgressLogger::LogType lt) const override;
73 
80  void storeVisibleSpectrum(const MSSpectrum& spec, const RangeAllType& visible_range, const DataFilters& layer_filters);
87  void storeVisibleChromatogram(const MSChromatogram& chrom, const RangeAllType& visible_range, const DataFilters& layer_filters);
88 
90  void storeVisibleExperiment(const PeakMap& exp, const RangeAllType& visible_range, const DataFilters& layer_filters);
91 
92  private:
94  };
95 
101  class OPENMS_GUI_DLLAPI LayerStoreDataPeakMapAll : public LayerStoreData
102  {
103  public:
105  {
106  }
107 
108  // docu in base class
109  void saveToFile(const String& filename, const ProgressLogger::LogType lt) const override;
110 
111  void storeFullExperiment(const PeakMap& exp);
112 
113  private:
114  const PeakMap* full_exp_ = nullptr;
115  };
116 
120  class OPENMS_GUI_DLLAPI LayerStoreDataFeatureMapVisible : public LayerStoreData
121  {
122  public:
124  {
125  }
126 
127  // docu in base class
128  void saveToFile(const String& filename, const ProgressLogger::LogType lt) const override;
129 
130  void storeVisibleFM(const FeatureMap& fm, const RangeAllType& visible_range, const DataFilters& layer_filters);
131 
132  private:
134  };
135 
141  class OPENMS_GUI_DLLAPI LayerStoreDataFeatureMapAll : public LayerStoreData
142  {
143  public:
145  {
146  }
147 
148  // docu in base class
149  void saveToFile(const String& filename, const ProgressLogger::LogType lt) const override;
150 
151  void storeFullFM(const FeatureMap& fm);
152 
153  private:
154  const FeatureMap* full_fm_ = nullptr;
155  };
156 
160  class OPENMS_GUI_DLLAPI LayerStoreDataConsensusMapVisible : public LayerStoreData
161  {
162  public:
164  {
165  }
166 
167  // docu in base class
168  void saveToFile(const String& filename, const ProgressLogger::LogType lt) const override;
169 
170  void storeVisibleCM(const ConsensusMap& cm, const RangeAllType& visible_range, const DataFilters& layer_filters);
171 
172  private:
174  };
175 
181  class OPENMS_GUI_DLLAPI LayerStoreDataConsensusMapAll : public LayerStoreData
182  {
183  public:
185  {
186  }
187 
188  // docu in base class
189  void saveToFile(const String& filename, const ProgressLogger::LogType lt) const override;
190 
191  void storeFullCM(const ConsensusMap& cm);
192 
193  private:
194  const ConsensusMap* full_cm_ = nullptr;
195  };
196 
197 
198 
202  class OPENMS_GUI_DLLAPI LayerStoreDataIdentVisible : public LayerStoreData
203  {
204  public:
206  {
207  }
208 
209  // docu in base class
210  void saveToFile(const String& filename, const ProgressLogger::LogType lt) const override;
211 
212  void storeVisibleIdent(const IPeptideIds::PepIds& ids, const RangeAllType& visible_range, const DataFilters& layer_filters);
213 
214  private:
216  };
217 
223  class OPENMS_GUI_DLLAPI LayerStoreDataIdentAll : public LayerStoreData
224  {
225  public:
227  {
228  }
229 
230  // docu in base class
231  void saveToFile(const String& filename, const ProgressLogger::LogType lt) const override;
232 
234 
235  private:
236  const IPeptideIds::PepIds* full_ids_ = nullptr;
237  };
238 
239 } // namespace OpenMS
A container for consensus elements.
Definition: ConsensusMap.h:66
DataFilter array providing some convenience functions.
Definition: DataFilters.h:27
A container for features.
Definition: FeatureMap.h:80
holds a vector of known file types, e.g. as a way to specify supported input formats
Definition: FileTypes.h:124
std::vector< PeptideIdentification > PepIds
Definition: IPeptideIds.h:25
Visitor which can save a full ConsensusMap; subsequently the data can be stored to a file.
Definition: LayerStoreData.h:182
LayerStoreDataConsensusMapAll()
Definition: LayerStoreData.h:184
void saveToFile(const String &filename, const ProgressLogger::LogType lt) const override
void storeFullCM(const ConsensusMap &cm)
Visitor which can save a visible piece of data; subsequently the data can be stored to a file.
Definition: LayerStoreData.h:161
ConsensusMap cm_
the filtered data; used when saveToFile() is called
Definition: LayerStoreData.h:173
void storeVisibleCM(const ConsensusMap &cm, const RangeAllType &visible_range, const DataFilters &layer_filters)
void saveToFile(const String &filename, const ProgressLogger::LogType lt) const override
LayerStoreDataConsensusMapVisible()
Definition: LayerStoreData.h:163
Visitor which can save a full FeatureMap; subsequently the data can be stored to a file.
Definition: LayerStoreData.h:142
void storeFullFM(const FeatureMap &fm)
void saveToFile(const String &filename, const ProgressLogger::LogType lt) const override
LayerStoreDataFeatureMapAll()
Definition: LayerStoreData.h:144
Visitor which can save a visible piece of data; subsequently the data can be stored to a file.
Definition: LayerStoreData.h:121
void storeVisibleFM(const FeatureMap &fm, const RangeAllType &visible_range, const DataFilters &layer_filters)
LayerStoreDataFeatureMapVisible()
Definition: LayerStoreData.h:123
void saveToFile(const String &filename, const ProgressLogger::LogType lt) const override
FeatureMap fm_
the filtered data; used when saveToFile() is called
Definition: LayerStoreData.h:133
Visitor which can save a full set of Identifications; subsequently the data can be stored to a file.
Definition: LayerStoreData.h:224
void storeFullIdent(const IPeptideIds::PepIds &ids)
LayerStoreDataIdentAll()
Definition: LayerStoreData.h:226
void saveToFile(const String &filename, const ProgressLogger::LogType lt) const override
Visitor which can save a visible piece of data; subsequently the data can be stored to a file.
Definition: LayerStoreData.h:203
void storeVisibleIdent(const IPeptideIds::PepIds &ids, const RangeAllType &visible_range, const DataFilters &layer_filters)
void saveToFile(const String &filename, const ProgressLogger::LogType lt) const override
LayerStoreDataIdentVisible()
Definition: LayerStoreData.h:205
IPeptideIds::PepIds ids_
the filtered data; used when saveToFile() is called
Definition: LayerStoreData.h:215
Visitor which can save a full experiment; subsequently the data can be stored to a file.
Definition: LayerStoreData.h:102
void saveToFile(const String &filename, const ProgressLogger::LogType lt) const override
void storeFullExperiment(const PeakMap &exp)
LayerStoreDataPeakMapAll()
Definition: LayerStoreData.h:104
Visitor which can save a visible piece of data; subsequently the data can be stored to a file.
Definition: LayerStoreData.h:65
LayerStoreDataPeakMapVisible()
Definition: LayerStoreData.h:67
void storeVisibleSpectrum(const MSSpectrum &spec, const RangeAllType &visible_range, const DataFilters &layer_filters)
Stores data from a 1D canvas and remembers the data internally.
void saveToFile(const String &filename, const ProgressLogger::LogType lt) const override
PeakMap pm_
the filtered data; used when saveToFile() is called
Definition: LayerStoreData.h:93
void storeVisibleChromatogram(const MSChromatogram &chrom, const RangeAllType &visible_range, const DataFilters &layer_filters)
Stores data from a 1D canvas and remembers the data internally.
void storeVisibleExperiment(const PeakMap &exp, const RangeAllType &visible_range, const DataFilters &layer_filters)
analog to storeVisibleSpectrum()
Base class to store either the currently visible or all data of a canvas.
Definition: LayerStoreData.h:29
virtual ~LayerStoreData()=default
virtual D'tor for proper cleanup of derived classes' members
FileTypeList storage_formats_
file formats which can hold the data from the layer; The first item should be the preferred/default f...
Definition: LayerStoreData.h:57
virtual void saveToFile(const String &filename, const ProgressLogger::LogType lt) const =0
FileTypeList getSupportedFileFormats() const
Which formats are supported when writing the file?
Definition: LayerStoreData.h:40
LayerStoreData(FileTypeList supported_storage_formats)
Definition: LayerStoreData.h:31
FileTypes::Type getSupportedExtension_(const String &filename) const
extracts the supported extension (converting UNKNOWN to first item in storage_formats_) or throws an ...
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
LogType
Possible log types.
Definition: ProgressLogger.h:43
A more convenient string class.
Definition: String.h:34
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
Type
Actual file types enum.
Definition: FileTypes.h:31
@ CONSENSUSXML
OpenMS consensus map format (.consensusXML)
Definition: FileTypes.h:39
@ FEATUREXML
OpenMS feature file (.featureXML)
Definition: FileTypes.h:37
@ IDXML
OpenMS identification format (.idXML)
Definition: FileTypes.h:38
@ MZML
MzML file (.mzML)
Definition: FileTypes.h:44
@ MZDATA
MzData file (.mzData)
Definition: FileTypes.h:35
@ MZXML
MzXML file (.mzXML)
Definition: FileTypes.h:36