OpenMS
MSPGenericFile.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Douglas McCloskey, Pasquale Domenico Colaianni $
6 // $Authors: Douglas McCloskey, Pasquale Domenico Colaianni $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <OpenMS/config.h> // OPENMS_DLLAPI
15 
16 namespace OpenMS
17 {
41  class OPENMS_DLLAPI MSPGenericFile :
42  public DefaultParamHandler
43  {
44 public:
47 
49  MSPGenericFile(const String& filename, MSExperiment& library);
50 
52  ~MSPGenericFile() override = default;
53 
55  void getDefaultParameters(Param& params);
56 
58  friend class MSPGenericFile_friend;
59 
68  void load(const String& filename, MSExperiment& library);
69 
78  void store(const String& filename, const MSExperiment& library) const;
79 
80  private:
82  void updateMembers_() override;
83 
99  MSSpectrum& spectrum,
100  MSExperiment& library
101  );
102 
104  std::set<String> loaded_spectra_names_;
105 
106  /*
107  The synonyms of a spectrum are collected into this variable and,
108  when `addSpectrumtoLibrary()` is called, the elements are concatenated
109  and the result is saved as a "Synon" metaValue.
110  The synonyms are separated by `synonyms_separator_`.
111  */
112  std::vector<String> synonyms_;
113 
116  };
117 
119  {
120 public:
123 
125  MSSpectrum& spectrum,
126  MSExperiment& library
127  )
128  {
129  return msp_.addSpectrumToLibrary(spectrum, library);
130  }
131 
133  };
134 }
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:66
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:46
Definition: MSPGenericFile.h:119
MSPGenericFile msp_
Definition: MSPGenericFile.h:132
void addSpectrumToLibrary(MSSpectrum &spectrum, MSExperiment &library)
Definition: MSPGenericFile.h:124
Load MSP text file and save it into an MSExperiment
Definition: MSPGenericFile.h:43
MSPGenericFile(const String &filename, MSExperiment &library)
Constructor with filename and output library.
String synonyms_separator_
The separator to be used in "Synon" metaValue.
Definition: MSPGenericFile.h:115
void addSpectrumToLibrary(MSSpectrum &spectrum, MSExperiment &library)
void load(const String &filename, MSExperiment &library)
Load the file's data and metadata, and save it into an MSExperiment.
~MSPGenericFile() override=default
Destructor.
std::vector< String > synonyms_
Definition: MSPGenericFile.h:112
void updateMembers_() override
Overrides DefaultParamHandler's method.
void getDefaultParameters(Param &params)
Get the class' default parameters.
void store(const String &filename, const MSExperiment &library) const
Save data and metadata into a file.
MSPGenericFile()
Default constructor.
std::set< String > loaded_spectra_names_
To keep track of which spectra have already been loaded and avoid duplicates.
Definition: MSPGenericFile.h:104
The representation of a 1D spectrum.
Definition: MSSpectrum.h:44
Management and storage of parameters / INI files.
Definition: Param.h:44
A more convenient string class.
Definition: String.h:34
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19