OpenMS
MzQuantMLHandler.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: Mathias Walzer $
6 // $Authors: Mathias Walzer $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
14 
15 #include <map>
16 
17 namespace OpenMS
18 {
19  class ProgressLogger;
20 
21  namespace Internal
22  {
23 
29  class OPENMS_DLLAPI MzQuantMLHandler :
30  public XMLHandler
31  {
32 public:
36  MzQuantMLHandler(const MSQuantifications & msq, const String & filename, const String & version, const ProgressLogger & logger);
37 
39  MzQuantMLHandler(MSQuantifications & msq, const String & filename, const String & version, const ProgressLogger & logger);
40 
42  ~MzQuantMLHandler() override;
44 
45 
46  // Docu in base class
47  void endElement(const XMLCh * const /*uri*/, const XMLCh * const /*local_name*/, const XMLCh * const qname) override;
48 
49  // Docu in base class
50  void startElement(const XMLCh * const /*uri*/, const XMLCh * const /*local_name*/, const XMLCh * const qname, const xercesc::Attributes & attributes) override;
51 
52  // Docu in base class
53  void characters(const XMLCh * const chars, const XMLSize_t length) override;
54 
55  //Docu in base class
56  void writeTo(std::ostream & os) override;
57 
58 protected:
59 
62 
65 
67 
69 
71 
73  void handleCVParam_(const String & parent_parent_tag, const String & parent_tag, const String & accession, const String & name, const String & value, const xercesc::Attributes & attributes, const String & cv_ref, const String & unit_accession = "");
74 
76  void handleUserParam_(const String & parent_parent_tag, const String & parent_tag, const String & name, const String & type, const String & value);
77 
79  //~ TODO rewirte writeCVParams_ in baseclass to be more convenient
80  //~ void MzQuantMLHandler::writeCVParams_(std::ostream& os, const Map< String, std::vector < CVTerm > > & , UInt indent);
81  void writeCVParams_(String & s, const std::map<String, std::vector<CVTerm> > &, UInt indent);
82 
84  void writeUserParams_(std::ostream & os, const MetaInfoInterface & meta, UInt indent);
85  void writeUserParams_(String & s, const MetaInfoInterface & meta, UInt indent);
86 
88  ControlledVocabulary::CVTerm getChildWithName_(const String & parent_accession, const String & name) const;
89 
90 
92  void writeFeature_(String & feature_xml, const std::vector<FeatureMap >& fm, UInt indentation_level);
93 
95  //void writeSourceFile_(std::ostream& os, const String& id, const SourceFile& software);
96 
97 
98 private:
102 
103  std::map<String, std::vector<ExperimentalSettings> > current_files_;
107 
108  std::vector<MetaInfo> up_stack_;
109  std::vector<CVTerm> cvp_stack_;
111 
112  std::multimap<String, String> cm_cf_ids_;
113  std::map<String, String> f_cf_ids_;
114  std::map<String, ConsensusFeature> cf_cf_obj_;
115  std::map<String, FeatureHandle> f_f_obj_;
116  std::map<String, ConsensusFeature::Ratio> r_rtemp_;
117  std::map<String, String> numden_r_ids_;
118  std::map<String, ConsensusFeature::Ratio> r_r_obj_;
119 
120  //~ Software current_sw_;
121  std::map<String, Software> current_sws_;
122  std::map<int, DataProcessing> current_orderedps_;
123  std::pair<int, DataProcessing> current_dp_;
124  std::set<DataProcessing::ProcessingAction> current_pas_;
125 
126  std::vector<String> current_col_types_;
127  std::vector<double> current_dm_values_;
128  std::vector<double> current_row_;
129 
130  };
131  } // namespace Internal
132 } // namespace OpenMS
133 
Representation of a controlled vocabulary.
Definition: ControlledVocabulary.h:29
XML handler for MzQuantMLFile.
Definition: MzQuantMLHandler.h:31
ControlledVocabulary::CVTerm getChildWithName_(const String &parent_accession, const String &name) const
Looks up a child CV term of parent_accession with the name name. If no such term is found,...
std::map< String, std::vector< ExperimentalSettings > > current_files_
1.rawfilesgroup_ref 2.inputfiles for each assay as ExperimentalSettings
Definition: MzQuantMLHandler.h:103
void writeFeature_(String &feature_xml, const std::vector< FeatureMap > &fm, UInt indentation_level)
Helper method that writes the featuremaps.
std::map< String, ConsensusFeature::Ratio > r_rtemp_
Definition: MzQuantMLHandler.h:116
std::map< int, DataProcessing > current_orderedps_
Definition: MzQuantMLHandler.h:122
MSQuantifications::Assay current_assay_
Definition: MzQuantMLHandler.h:110
Size current_count_
Definition: MzQuantMLHandler.h:106
MzQuantMLHandler(const MzQuantMLHandler &rhs)
MSQuantifications * msq_
Definition: MzQuantMLHandler.h:68
~MzQuantMLHandler() override
Destructor.
MzQuantMLHandler(const MSQuantifications &msq, const String &filename, const String &version, const ProgressLogger &logger)
Constructor for a write-only handler.
std::map< String, ConsensusFeature::Ratio > r_r_obj_
Definition: MzQuantMLHandler.h:118
std::vector< double > current_row_
Definition: MzQuantMLHandler.h:128
void writeTo(std::ostream &os) override
Writes the contents to a stream.
MzQuantMLHandler(MSQuantifications &msq, const String &filename, const String &version, const ProgressLogger &logger)
Constructor for a read-only handler.
std::vector< String > current_col_types_
Definition: MzQuantMLHandler.h:126
const ProgressLogger & logger_
Progress logger.
Definition: MzQuantMLHandler.h:61
ControlledVocabulary cv_
Controlled vocabulary (hopefully the psi-pi from OpenMS/share/OpenMS/CV/psi-pi.obo)
Definition: MzQuantMLHandler.h:64
String tag_
Definition: MzQuantMLHandler.h:66
std::multimap< String, String > cm_cf_ids_
Definition: MzQuantMLHandler.h:112
String current_cf_id_
Definition: MzQuantMLHandler.h:105
String current_id_
Definition: MzQuantMLHandler.h:104
std::vector< CVTerm > cvp_stack_
Definition: MzQuantMLHandler.h:109
std::vector< MetaInfo > up_stack_
Definition: MzQuantMLHandler.h:108
std::pair< int, DataProcessing > current_dp_
Definition: MzQuantMLHandler.h:123
MzQuantMLHandler()
Helper method that writes a source file.
std::vector< double > current_dm_values_
Definition: MzQuantMLHandler.h:127
void handleCVParam_(const String &parent_parent_tag, const String &parent_tag, const String &accession, const String &name, const String &value, const xercesc::Attributes &attributes, const String &cv_ref, const String &unit_accession="")
Handles CV terms.
std::map< String, Software > current_sws_
Definition: MzQuantMLHandler.h:121
const MSQuantifications * cmsq_
Definition: MzQuantMLHandler.h:70
void writeUserParams_(std::ostream &os, const MetaInfoInterface &meta, UInt indent)
Writes user terms.
std::map< String, String > numden_r_ids_
Definition: MzQuantMLHandler.h:117
std::map< String, ConsensusFeature > cf_cf_obj_
Definition: MzQuantMLHandler.h:114
void startElement(const XMLCh *const, const XMLCh *const, const XMLCh *const qname, const xercesc::Attributes &attributes) override
void writeUserParams_(String &s, const MetaInfoInterface &meta, UInt indent)
std::set< DataProcessing::ProcessingAction > current_pas_
Definition: MzQuantMLHandler.h:124
MzQuantMLHandler & operator=(const MzQuantMLHandler &rhs)
void characters(const XMLCh *const chars, const XMLSize_t length) override
void endElement(const XMLCh *const, const XMLCh *const, const XMLCh *const qname) override
void handleUserParam_(const String &parent_parent_tag, const String &parent_tag, const String &name, const String &type, const String &value)
Handles user terms.
void writeCVParams_(String &s, const std::map< String, std::vector< CVTerm > > &, UInt indent)
Write CV term.
std::map< String, FeatureHandle > f_f_obj_
Definition: MzQuantMLHandler.h:115
std::map< String, String > f_cf_ids_
Definition: MzQuantMLHandler.h:113
Base class for XML handlers.
Definition: XMLHandler.h:300
Definition: MSQuantifications.h:27
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:35
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:27
A more convenient string class.
Definition: String.h:34
unsigned int UInt
Unsigned integer type.
Definition: Types.h:68
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:101
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
Representation of a CV term.
Definition: ControlledVocabulary.h:35
Definition: MSQuantifications.h:84