OpenMS
LayerStoreData.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2023.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Chris Bielow $
32 // $Authors: Chris Bielow $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 // OpenMS_GUI config
38 
46 
47 
48 namespace OpenMS
49 {
50 
54  class OPENMS_GUI_DLLAPI LayerStoreData
55  {
56  public:
57  LayerStoreData(FileTypeList supported_storage_formats) :
58  storage_formats_(supported_storage_formats)
59  {
60  }
61 
63  virtual ~LayerStoreData() = default;
64 
67  {
68  return storage_formats_;
69  }
70 
76  virtual void saveToFile(const String& filename, const ProgressLogger::LogType lt) const = 0;
77 
78  protected:
79 
82 
84  };
85 
89  class OPENMS_GUI_DLLAPI LayerStoreDataPeakMapVisible
90  : public LayerStoreData
91  {
92  public:
95  {}
96 
97  // docu in base class
98  void saveToFile(const String& filename, const ProgressLogger::LogType lt) const override;
99 
106  void storeVisibleSpectrum(const MSSpectrum& spec, const RangeAllType& visible_range, const DataFilters& layer_filters);
113  void storeVisibleChromatogram(const MSChromatogram& chrom, const RangeAllType& visible_range, const DataFilters& layer_filters);
114 
116  void storeVisibleExperiment(const PeakMap& exp, const RangeAllType& visible_range, const DataFilters& layer_filters);
117 
118  private:
120  };
121 
127  class OPENMS_GUI_DLLAPI LayerStoreDataPeakMapAll : public LayerStoreData
128  {
129  public:
131  {
132  }
133 
134  // docu in base class
135  void saveToFile(const String& filename, const ProgressLogger::LogType lt) const override;
136 
137  void storeFullExperiment(const PeakMap& exp);
138 
139  private:
140  const PeakMap* full_exp_ = nullptr;
141  };
142 
146  class OPENMS_GUI_DLLAPI LayerStoreDataFeatureMapVisible : public LayerStoreData
147  {
148  public:
150  {
151  }
152 
153  // docu in base class
154  void saveToFile(const String& filename, const ProgressLogger::LogType lt) const override;
155 
156  void storeVisibleFM(const FeatureMap& fm, const RangeAllType& visible_range, const DataFilters& layer_filters);
157 
158  private:
160  };
161 
167  class OPENMS_GUI_DLLAPI LayerStoreDataFeatureMapAll : public LayerStoreData
168  {
169  public:
171  {
172  }
173 
174  // docu in base class
175  void saveToFile(const String& filename, const ProgressLogger::LogType lt) const override;
176 
177  void storeFullFM(const FeatureMap& fm);
178 
179  private:
180  const FeatureMap* full_fm_ = nullptr;
181  };
182 
186  class OPENMS_GUI_DLLAPI LayerStoreDataConsensusMapVisible : public LayerStoreData
187  {
188  public:
190  {
191  }
192 
193  // docu in base class
194  void saveToFile(const String& filename, const ProgressLogger::LogType lt) const override;
195 
196  void storeVisibleCM(const ConsensusMap& cm, const RangeAllType& visible_range, const DataFilters& layer_filters);
197 
198  private:
200  };
201 
207  class OPENMS_GUI_DLLAPI LayerStoreDataConsensusMapAll : public LayerStoreData
208  {
209  public:
211  {
212  }
213 
214  // docu in base class
215  void saveToFile(const String& filename, const ProgressLogger::LogType lt) const override;
216 
217  void storeFullCM(const ConsensusMap& cm);
218 
219  private:
220  const ConsensusMap* full_cm_ = nullptr;
221  };
222 
223 
224 
228  class OPENMS_GUI_DLLAPI LayerStoreDataIdentVisible : public LayerStoreData
229  {
230  public:
232  {
233  }
234 
235  // docu in base class
236  void saveToFile(const String& filename, const ProgressLogger::LogType lt) const override;
237 
238  void storeVisibleIdent(const IPeptideIds::PepIds& ids, const RangeAllType& visible_range, const DataFilters& layer_filters);
239 
240  private:
242  };
243 
249  class OPENMS_GUI_DLLAPI LayerStoreDataIdentAll : public LayerStoreData
250  {
251  public:
253  {
254  }
255 
256  // docu in base class
257  void saveToFile(const String& filename, const ProgressLogger::LogType lt) const override;
258 
260 
261  private:
262  const IPeptideIds::PepIds* full_ids_ = nullptr;
263  };
264 
265 } // namespace OpenMS
A container for consensus elements.
Definition: ConsensusMap.h:92
DataFilter array providing some convenience functions.
Definition: DataFilters.h:53
A container for features.
Definition: FeatureMap.h:106
holds a vector of known file types, e.g. as a way to specify supported input formats
Definition: FileTypes.h:150
std::vector< PeptideIdentification > PepIds
Definition: IPeptideIds.h:51
Visitor which can save a full ConsensusMap; subsequently the data can be stored to a file.
Definition: LayerStoreData.h:208
LayerStoreDataConsensusMapAll()
Definition: LayerStoreData.h:210
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:187
ConsensusMap cm_
the filtered data; used when saveToFile() is called
Definition: LayerStoreData.h:199
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:189
Visitor which can save a full FeatureMap; subsequently the data can be stored to a file.
Definition: LayerStoreData.h:168
void storeFullFM(const FeatureMap &fm)
void saveToFile(const String &filename, const ProgressLogger::LogType lt) const override
LayerStoreDataFeatureMapAll()
Definition: LayerStoreData.h:170
Visitor which can save a visible piece of data; subsequently the data can be stored to a file.
Definition: LayerStoreData.h:147
void storeVisibleFM(const FeatureMap &fm, const RangeAllType &visible_range, const DataFilters &layer_filters)
LayerStoreDataFeatureMapVisible()
Definition: LayerStoreData.h:149
void saveToFile(const String &filename, const ProgressLogger::LogType lt) const override
FeatureMap fm_
the filtered data; used when saveToFile() is called
Definition: LayerStoreData.h:159
Visitor which can save a full set of Identifications; subsequently the data can be stored to a file.
Definition: LayerStoreData.h:250
void storeFullIdent(const IPeptideIds::PepIds &ids)
LayerStoreDataIdentAll()
Definition: LayerStoreData.h:252
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:229
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:231
IPeptideIds::PepIds ids_
the filtered data; used when saveToFile() is called
Definition: LayerStoreData.h:241
Visitor which can save a full experiment; subsequently the data can be stored to a file.
Definition: LayerStoreData.h:128
void saveToFile(const String &filename, const ProgressLogger::LogType lt) const override
void storeFullExperiment(const PeakMap &exp)
LayerStoreDataPeakMapAll()
Definition: LayerStoreData.h:130
Visitor which can save a visible piece of data; subsequently the data can be stored to a file.
Definition: LayerStoreData.h:91
LayerStoreDataPeakMapVisible()
Definition: LayerStoreData.h:93
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:119
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:55
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:83
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:66
LayerStoreData(FileTypeList supported_storage_formats)
Definition: LayerStoreData.h:57
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:57
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:72
The representation of a 1D spectrum.
Definition: MSSpectrum.h:70
LogType
Possible log types.
Definition: ProgressLogger.h:69
A more convenient string class.
Definition: String.h:60
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48
Type
Actual file types enum.
Definition: FileTypes.h:57
@ CONSENSUSXML
OpenMS consensus map format (.consensusXML)
Definition: FileTypes.h:65
@ FEATUREXML
OpenMS feature file (.featureXML)
Definition: FileTypes.h:63
@ IDXML
OpenMS identification format (.idXML)
Definition: FileTypes.h:64
@ MZML
MzML file (.mzML)
Definition: FileTypes.h:70
@ MZDATA
MzData file (.mzData)
Definition: FileTypes.h:61
@ MZXML
MzXML file (.mzXML)
Definition: FileTypes.h:62