| OpenMS 2.5.0

MzQuantMLHandler.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-2020.
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: Mathias Walzer $
32 // $Authors: Mathias Walzer $
33 // --------------------------------------------------------------------------
34
35 #pragma once
36
37 #include <OpenMS/FORMAT/HANDLERS/XMLHandler.h>
38 #include <OpenMS/FORMAT/ControlledVocabulary.h>
39 #include <OpenMS/METADATA/MSQuantifications.h>
40
41 namespace OpenMS
42 {
43 class ProgressLogger;
44
45 namespace Internal
46 {
47
53 class OPENMS_DLLAPI MzQuantMLHandler :
54 public XMLHandler
55 {
56 public:
59 MzQuantMLHandler(const MSQuantifications & msq, const String & filename, const String & version, const ProgressLogger & logger);
61
63 MzQuantMLHandler(MSQuantifications & msq, const String & filename, const String & version, const ProgressLogger & logger);
64
66 ~MzQuantMLHandler() override;
68
69
70 // Docu in base class
71 void endElement(const XMLCh * const /*uri*/, const XMLCh * const /*local_name*/, const XMLCh * const qname) override;
72
73 // Docu in base class
74 void startElement(const XMLCh * const /*uri*/, const XMLCh * const /*local_name*/, const XMLCh * const qname, const xercesc::Attributes & attributes) override;
75
76 // Docu in base class
77 void characters(const XMLCh * const chars, const XMLSize_t length) override;
78
79 //Docu in base class
80 void writeTo(std::ostream & os) override;
81
82 protected:
83
85 const ProgressLogger & logger_;
86
88 ControlledVocabulary cv_;
89
90 String tag_;
91
92 MSQuantifications * msq_;
93
94 const MSQuantifications * cmsq_;
95
97 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 = "");
98
100 void handleUserParam_(const String & parent_parent_tag, const String & parent_tag, const String & name, const String & type, const String & value);
101
103 //~ TODO rewirte writeCVParams_ in baseclass to be more convenient
104 //~ void MzQuantMLHandler::writeCVParams_(std::ostream& os, const Map< String, std::vector < CVTerm > > & , UInt indent);
105 void writeCVParams_(String & s, const Map<String, std::vector<CVTerm> > &, UInt indent);
106
108 void writeUserParams_(std::ostream & os, const MetaInfoInterface & meta, UInt indent);
109 void writeUserParams_(String & s, const MetaInfoInterface & meta, UInt indent);
110
112 ControlledVocabulary::CVTerm getChildWithName_(const String & parent_accession, const String & name) const;
113
114
116 void writeFeature_(String & feature_xml, const std::vector<FeatureMap >& fm, UInt indentation_level);
117
119 //void writeSourceFile_(std::ostream& os, const String& id, const SourceFile& software);
120
121
122 private:
123 MzQuantMLHandler();
124 MzQuantMLHandler(const MzQuantMLHandler & rhs);
125 MzQuantMLHandler & operator=(const MzQuantMLHandler & rhs);
126
127 std::map<String, std::vector<ExperimentalSettings> > current_files_;
128 String current_id_;
129 String current_cf_id_;
130 Size current_count_;
131
132 std::vector<MetaInfo> up_stack_;
133 std::vector<CVTerm> cvp_stack_;
134 MSQuantifications::Assay current_assay_;
135
136 std::multimap<String, String> cm_cf_ids_;
137 std::map<String, String> f_cf_ids_;
138 std::map<String, ConsensusFeature> cf_cf_obj_;
139 std::map<String, FeatureHandle> f_f_obj_;
140 std::map<String, ConsensusFeature::Ratio> r_rtemp_;
141 std::map<String, String> numden_r_ids_;
142 std::map<String, ConsensusFeature::Ratio> r_r_obj_;
143
144 //~ Software current_sw_;
145 std::map<String, Software> current_sws_;
146 std::map<int, DataProcessing> current_orderedps_;
147 std::pair<int, DataProcessing> current_dp_;
148 std::set<DataProcessing::ProcessingAction> current_pas_;
149
150 std::vector<String> current_col_types_;
151 std::vector<double> current_dm_values_;
152 std::vector<double> current_row_;
153
154 };
155 } // namespace Internal
156 } // namespace OpenMS
157
OpenMS::Internal::MzQuantMLHandler::current_pas_
std::set< DataProcessing::ProcessingAction > current_pas_
Definition: MzQuantMLHandler.h:148
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::Internal::MzQuantMLHandler::current_col_types_
std::vector< String > current_col_types_
Definition: MzQuantMLHandler.h:150
OpenMS::Internal::MzQuantMLHandler::current_id_
String current_id_
Definition: MzQuantMLHandler.h:128
OpenMS::Internal::MzQuantMLHandler::cvp_stack_
std::vector< CVTerm > cvp_stack_
Definition: MzQuantMLHandler.h:133
OpenMS::Internal::MzQuantMLHandler::logger_
const ProgressLogger & logger_
Progress logger.
Definition: MzQuantMLHandler.h:85
XMLHandler.h
OpenMS::Internal::MzQuantMLHandler::current_row_
std::vector< double > current_row_
Definition: MzQuantMLHandler.h:152
OpenMS::MSQuantifications
Definition: MSQuantifications.h:52
OpenMS::Internal::MzQuantMLHandler::current_cf_id_
String current_cf_id_
Definition: MzQuantMLHandler.h:129
ControlledVocabulary.h
OpenMS::Internal::MzQuantMLHandler::tag_
String tag_
Definition: MzQuantMLHandler.h:90
OpenMS::MSQuantifications::Assay
Definition: MSQuantifications.h:128
OpenMS::Map
Map class based on the STL map (containing several convenience functions)
Definition: Map.h:50
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::Internal::MzQuantMLHandler::cf_cf_obj_
std::map< String, ConsensusFeature > cf_cf_obj_
Definition: MzQuantMLHandler.h:138
OpenMS::Internal::MzQuantMLHandler::f_cf_ids_
std::map< String, String > f_cf_ids_
Definition: MzQuantMLHandler.h:137
OpenMS::Internal::MzQuantMLHandler::numden_r_ids_
std::map< String, String > numden_r_ids_
Definition: MzQuantMLHandler.h:141
OpenMS::ProgressLogger
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:54
OpenMS::Internal::MzQuantMLHandler::current_dm_values_
std::vector< double > current_dm_values_
Definition: MzQuantMLHandler.h:151
OpenMS::Internal::MzQuantMLHandler::current_orderedps_
std::map< int, DataProcessing > current_orderedps_
Definition: MzQuantMLHandler.h:146
MSQuantifications.h
OpenMS::UInt
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
OpenMS::Internal::MzQuantMLHandler
XML handler for MzQuantMLFile.
Definition: MzQuantMLHandler.h:53
OpenMS::Internal::MzQuantMLHandler::r_rtemp_
std::map< String, ConsensusFeature::Ratio > r_rtemp_
Definition: MzQuantMLHandler.h:140
OpenMS::Internal::MzQuantMLHandler::current_sws_
std::map< String, Software > current_sws_
Definition: MzQuantMLHandler.h:145
OpenMS::ControlledVocabulary::CVTerm
Representation of a CV term.
Definition: ControlledVocabulary.h:60
OpenMS::Internal::MzQuantMLHandler::cmsq_
const MSQuantifications * cmsq_
Definition: MzQuantMLHandler.h:94
OpenMS::Internal::MzQuantMLHandler::current_dp_
std::pair< int, DataProcessing > current_dp_
Definition: MzQuantMLHandler.h:147
OpenMS::Internal::MzQuantMLHandler::cm_cf_ids_
std::multimap< String, String > cm_cf_ids_
Definition: MzQuantMLHandler.h:136
OpenMS::ControlledVocabulary
Representation of a controlled vocabulary.
Definition: ControlledVocabulary.h:54
OpenMS::Internal::MzQuantMLHandler::cv_
ControlledVocabulary cv_
Controlled vocabulary (hopefully the psi-pi from OpenMS/share/OpenMS/CV/psi-pi.obo) ...
Definition: MzQuantMLHandler.h:88
OpenMS::Internal::MzQuantMLHandler::current_assay_
MSQuantifications::Assay current_assay_
Definition: MzQuantMLHandler.h:134
OpenMS::Internal::XMLHandler
Base class for XML handlers.
Definition: XMLHandler.h:151
OpenMS::Internal::MzQuantMLHandler::msq_
MSQuantifications * msq_
Definition: MzQuantMLHandler.h:92
OpenMS::Internal::MzQuantMLHandler::up_stack_
std::vector< MetaInfo > up_stack_
Definition: MzQuantMLHandler.h:132
OpenMS::Internal::MzQuantMLHandler::f_f_obj_
std::map< String, FeatureHandle > f_f_obj_
Definition: MzQuantMLHandler.h:139
OpenMS::MetaInfoInterface
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:60
OpenMS::Size
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
OpenMS::Internal::MzQuantMLHandler::current_count_
Size current_count_
Definition: MzQuantMLHandler.h:130
OpenMS::Internal::MzQuantMLHandler::r_r_obj_
std::map< String, ConsensusFeature::Ratio > r_r_obj_
Definition: MzQuantMLHandler.h:142
OpenMS::Internal::MzQuantMLHandler::current_files_
std::map< String, std::vector< ExperimentalSettings > > current_files_
1.rawfilesgroup_ref 2.inputfiles for each assay as ExperimentalSettings
Definition: MzQuantMLHandler.h:127