00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef OPENMS_FORMAT_HANDLERS_MZQUANTMLHANDLER_H
00036 #define OPENMS_FORMAT_HANDLERS_MZQUANTMLHANDLER_H
00037
00038 #include <OpenMS/FORMAT/HANDLERS/XMLHandler.h>
00039 #include <OpenMS/FORMAT/ControlledVocabulary.h>
00040 #include <OpenMS/CONCEPT/UniqueIdGenerator.h>
00041 #include <OpenMS/METADATA/MSQuantifications.h>
00042
00043 namespace OpenMS
00044 {
00045 class ProgressLogger;
00046
00047 namespace Internal
00048 {
00049
00055 class OPENMS_DLLAPI MzQuantMLHandler :
00056 public XMLHandler
00057 {
00058 public:
00061
00062 MzQuantMLHandler(const MSQuantifications & msq, const String & filename, const String & version, const ProgressLogger & logger);
00063
00065 MzQuantMLHandler(MSQuantifications & msq, const String & filename, const String & version, const ProgressLogger & logger);
00066
00068 virtual ~MzQuantMLHandler();
00070
00071
00072
00073 virtual void endElement(const XMLCh * const , const XMLCh * const , const XMLCh * const qname);
00074
00075
00076 virtual void startElement(const XMLCh * const , const XMLCh * const , const XMLCh * const qname, const xercesc::Attributes & attributes);
00077
00078
00079 virtual void characters(const XMLCh * const chars, const XMLSize_t length);
00080
00081
00082 virtual void writeTo(std::ostream & os);
00083
00084 protected:
00085
00087 const ProgressLogger & logger_;
00088
00090 ControlledVocabulary cv_;
00091
00092 String tag_;
00093
00094 MSQuantifications * msq_;
00095
00096 const MSQuantifications * cmsq_;
00097
00099 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 = "");
00100
00102 void handleUserParam_(const String & parent_parent_tag, const String & parent_tag, const String & name, const String & type, const String & value);
00103
00105
00106
00107 void writeCVParams_(String & s, const Map<String, std::vector<CVTerm> > &, UInt indent);
00108
00110 void writeUserParams_(std::ostream & os, const MetaInfoInterface & meta, UInt indent);
00111 void writeUserParams_(String & s, const MetaInfoInterface & meta, UInt indent);
00112
00114 ControlledVocabulary::CVTerm getChildWithName_(const String & parent_accession, const String & name) const;
00115
00116
00118 void writeFeature_(std::ostream & os, const String & identifier_prefix, UInt64 identifier, UInt indentation_level);
00119
00121
00122
00123
00124 private:
00125 MzQuantMLHandler();
00126 MzQuantMLHandler(const MzQuantMLHandler & rhs);
00127 MzQuantMLHandler & operator=(const MzQuantMLHandler & rhs);
00128
00129 std::map<String, std::vector<ExperimentalSettings> > current_files_;
00130 String current_id_;
00131 String current_cf_id_;
00132 Size current_count_;
00133
00134 std::vector<MetaInfo> up_stack_;
00135 std::vector<CVTerm> cvp_stack_;
00136 MSQuantifications::Assay current_assay_;
00137
00138 std::multimap<String, String> cm_cf_ids_;
00139 std::map<String, String> f_cf_ids_;
00140 std::map<String, ConsensusFeature> cf_cf_obj_;
00141 std::map<String, FeatureHandle> f_f_obj_;
00142 std::map<String, ConsensusFeature::Ratio> r_rtemp_;
00143 std::map<String, String> numden_r_ids_;
00144 std::map<String, ConsensusFeature::Ratio> r_r_obj_;
00145
00146
00147 std::map<String, Software> current_sws_;
00148 std::map<int, DataProcessing> current_orderedps_;
00149 std::pair<int, DataProcessing> current_dp_;
00150 std::set<DataProcessing::ProcessingAction> current_pas_;
00151
00152 std::vector<String> current_col_types_;
00153 std::vector<DoubleReal> current_dm_values_;
00154 std::vector<DoubleReal> current_row_;
00155
00156 };
00157 }
00158 }
00159
00160 #endif