OpenMS  2.7.0
MRMFeatureQCFile.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-2021.
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: Douglas McCloskey, Pasquale Domenico Colaianni $
32 // $Authors: Douglas McCloskey, Pasquale Domenico Colaianni $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 #include <OpenMS/FORMAT/CsvFile.h>
41 
42 namespace OpenMS
43 {
51  class OPENMS_DLLAPI MRMFeatureQCFile :
52  private CsvFile,
53  public ProgressLogger
54  {
55 public:
57  MRMFeatureQCFile() = default;
59  ~MRMFeatureQCFile() = default;
60 
71  void load(const String& filename, MRMFeatureQC& mrmfqc, const bool is_component_group) const;
72 
73  /*
74  @brief Stores an MRMFeatureQC file.
75 
76  @exception Exception::UnableToCreateFile is thrown if the file could not be created
77 
78  @param[in] filename The path to the input file
79  @param[in] mrmfqc The output class which will contain the criteria
80  @param[in] is_component_group true if the user intends to store ComponentGroupQCs data, false otherwise
81  */
82  void store(const String& filename, const MRMFeatureQC& mrmfqc, const bool is_component_group);
83 protected:
94  const StringList& line,
95  const std::map<String, Size>& headers,
96  std::vector<MRMFeatureQC::ComponentQCs>& c_qcs
97  ) const;
98 
109  const StringList& line,
110  const std::map<String, Size>& headers,
111  std::vector<MRMFeatureQC::ComponentGroupQCs>& cg_qcs
112  ) const;
113 
129  const String& key,
130  const String& value,
131  const String& boundary,
132  std::map<String, std::pair<double,double>>& meta_values_qc
133  ) const;
134 
150  const std::map<String, Size>& headers,
151  const StringList& line,
152  const String& header,
153  const Int default_value
154  ) const;
155 
171  const std::map<String, Size>& headers,
172  const StringList& line,
173  const String& header,
174  const double default_value
175  ) const;
176 
192  const std::map<String, Size>& headers,
193  const StringList& line,
194  const String& header,
195  const String& default_value
196  ) const;
197 
198  };
199 
200 } // namespace OpenMS
201 
This class handles csv files. Currently only loading is implemented.
Definition: CsvFile.h:51
File adapter for MRMFeatureQC files.
Definition: MRMFeatureQCFile.h:54
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)
~MRMFeatureQCFile()=default
Destructor.
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.
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:61
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:55
A more convenient string class.
Definition: String.h:61
int Int
Signed integer type.
Definition: Types.h:102
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47