OpenMS
MRMFeatureQCFile.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: Douglas McCloskey, Pasquale Domenico Colaianni $
6 // $Authors: Douglas McCloskey, Pasquale Domenico Colaianni $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <OpenMS/FORMAT/CsvFile.h>
15 
16 namespace OpenMS
17 {
25  class OPENMS_DLLAPI MRMFeatureQCFile :
26  private CsvFile,
27  public ProgressLogger
28  {
29 public:
31  MRMFeatureQCFile() = default;
33  ~MRMFeatureQCFile() override = default;
34 
45  void load(const String& filename, MRMFeatureQC& mrmfqc, const bool is_component_group) const;
46 
47  /*
48  @brief Stores an MRMFeatureQC file.
49 
50  @exception Exception::UnableToCreateFile is thrown if the file could not be created
51 
52  @param[in] filename The path to the input file
53  @param[in] mrmfqc The output class which will contain the criteria
54  @param[in] is_component_group true if the user intends to store ComponentGroupQCs data, false otherwise
55  */
56  void store(const String& filename, const MRMFeatureQC& mrmfqc, const bool is_component_group);
57 protected:
68  const StringList& line,
69  const std::map<String, Size>& headers,
70  std::vector<MRMFeatureQC::ComponentQCs>& c_qcs
71  ) const;
72 
83  const StringList& line,
84  const std::map<String, Size>& headers,
85  std::vector<MRMFeatureQC::ComponentGroupQCs>& cg_qcs
86  ) const;
87 
103  const String& key,
104  const String& value,
105  const String& boundary,
106  std::map<String, std::pair<double,double>>& meta_values_qc
107  ) const;
108 
124  const std::map<String, Size>& headers,
125  const StringList& line,
126  const String& header,
127  const Int default_value
128  ) const;
129 
145  const std::map<String, Size>& headers,
146  const StringList& line,
147  const String& header,
148  const double default_value
149  ) const;
150 
166  const std::map<String, Size>& headers,
167  const StringList& line,
168  const String& header,
169  const String& default_value
170  ) const;
171 
172  };
173 
174 } // namespace OpenMS
175 
This class handles csv files. Currently only loading is implemented. Does NOT support comment lines!
Definition: CsvFile.h:25
File adapter for MRMFeatureQC files.
Definition: MRMFeatureQCFile.h:28
void load(const String &filename, MRMFeatureQC &mrmfqc, const bool is_component_group) const
Loads an MRMFeatureQC file.
void store(const String &filename, const MRMFeatureQC &mrmfqc, const bool is_component_group)
void pushValuesFromLine_(const StringList &line, const std::map< String, Size > &headers, std::vector< MRMFeatureQC::ComponentQCs > &c_qcs) const
Save values from a line to a `ComponentQCs`.
void pushValuesFromLine_(const StringList &line, const std::map< String, Size > &headers, std::vector< MRMFeatureQC::ComponentGroupQCs > &cg_qcs) const
Save values from a line to a `ComponentGroupQCs`.
MRMFeatureQCFile()=default
Default constructor.
void setPairValue_(const String &key, const String &value, const String &boundary, std::map< String, std::pair< double, double >> &meta_values_qc) const
Set one of the values in a pair.
double getCastValue_(const std::map< String, Size > &headers, const StringList &line, const String &header, const double default_value) const
Extracts a column's value from a line.
~MRMFeatureQCFile() override=default
Destructor.
String getCastValue_(const std::map< String, Size > &headers, const StringList &line, const String &header, const String &default_value) const
Extracts a column's value from a line.
Int getCastValue_(const std::map< String, Size > &headers, const StringList &line, const String &header, const Int default_value) const
Extracts a column's value from a line.
The MRMFeatureQC is a class to handle the parameters and options for MRMFeatureFilter.
Definition: MRMFeatureQC.h:33
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:27
A more convenient string class.
Definition: String.h:34
int Int
Signed integer type.
Definition: Types.h:76
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:44
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22