Go to the documentation of this file.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_QCMLFILE_H
00036 #define OPENMS_FORMAT_QCMLFILE_H
00037
00038 #include <OpenMS/CONCEPT/ProgressLogger.h>
00039 #include <OpenMS/FORMAT/HANDLERS/XMLHandler.h>
00040 #include <OpenMS/FORMAT/XMLFile.h>
00041 #include <OpenMS/CONCEPT/UniqueIdGenerator.h>
00042
00043 #include <vector>
00044 #include <map>
00045 #include <set>
00046 #include <algorithm>
00047
00048 namespace OpenMS
00049 {
00057 class OPENMS_DLLAPI QcMLFile :
00058 public Internal::XMLHandler,
00059 public Internal::XMLFile,
00060 public ProgressLogger
00061 {
00062 public:
00064 struct OPENMS_DLLAPI QualityParameter
00065 {
00066 String name;
00067 String id;
00068 String value;
00069 String cvRef;
00070 String cvAcc;
00071 String unitRef;
00072 String unitAcc;
00073 String flag;
00074
00076 QualityParameter();
00077
00078 QualityParameter(const QualityParameter& rhs);
00079
00080 QualityParameter& operator=(const QualityParameter& rhs);
00081 bool operator==(const QualityParameter& rhs) const;
00082 bool operator<(const QualityParameter& rhs) const;
00083 bool operator>(const QualityParameter& rhs) const;
00084
00085 String toXMLString(UInt indentation_level) const;
00086 };
00087
00089 struct OPENMS_DLLAPI Attachment
00090 {
00091 String name;
00092 String value;
00093 String cvRef;
00094 String cvAcc;
00095 String unitRef;
00096 String unitAcc;
00097 String binary;
00098 String qualityRef;
00099 std::vector<String> colTypes;
00100 std::vector< std::vector<String> > tableRows;
00101
00102
00104 Attachment();
00105
00106 Attachment(const Attachment& rhs);
00107
00108 Attachment& operator=(const Attachment& rhs);
00109 bool operator==(const Attachment& rhs) const;
00110 bool operator<(const Attachment& rhs) const;
00111 bool operator>(const Attachment& rhs) const;
00112
00113 String toXMLString(UInt indentation_level) const;
00114 String toCSVString(String separator) const;
00115 };
00116
00118 QcMLFile();
00120 ~QcMLFile();
00121
00122 String map2cvs(const std::map< String, std::map<String, String> >& cvs_table, const String& separator) const;
00123 String exportIDstats(const String& filename) const;
00124
00126 void addRunQualityParameter(String r, QualityParameter qp);
00128 void addRunAttachment(String r, Attachment at);
00130 void addSetQualityParameter(String r, QualityParameter qp);
00132 void addSetAttachment(String r, Attachment at);
00134 void removeAttachment(String r, std::vector<String>& ids, String at = "");
00136 void removeAttachment(String r, String at);
00138 void removeAllAttachments(String at);
00140 void removeQualityParameter(String r, std::vector<String>& ids);
00142 void merge(const QcMLFile & addendum, String setname = "");
00144 void collectSetParameter(const String setname, const String qp, std::vector<String>& ret);
00146 String exportAttachment(const String filename, const String qpname) const;
00148 void getRunNames (std::vector<String>& ids) const;
00150 bool existsRun(const String filename) const;
00152 bool existsSet(const String filename) const;
00154 void existsRunQualityParameter(const String filename, const String qpname, std::vector<String>& ids) const;
00156 void existsSetQualityParameter(const String filename, const String qpname, std::vector<String>& ids) const;
00158 void store(const String & filename) const;
00160 void load(const String & filename);
00161
00162
00163
00164 protected:
00165
00166 virtual void endElement(const XMLCh * const , const XMLCh * const , const XMLCh * const qname);
00167
00168
00169 virtual void startElement(const XMLCh * const , const XMLCh * const , const XMLCh * const qname, const xercesc::Attributes & attributes);
00170
00171
00172 virtual void characters(const XMLCh * const chars, const XMLSize_t length);
00173
00174 std::map<String, std::vector< QualityParameter > > runQualityQPs_;
00175 std::map<String, std::vector< Attachment > > runQualityAts_;
00176 std::map<String, std::vector< QualityParameter > > setQualityQPs_;
00177 std::map<String, std::vector< Attachment > > setQualityAts_;
00178 std::map<String, std::set< String > > setQualityQPs_members_;
00179
00180 String tag_;
00181 UInt progress_;
00182 QualityParameter qp_;
00183 Attachment at_;
00184 std::vector<String> row_;
00185 std::vector<String> header_;
00186 String name_;
00187 std::set<String> names_;
00188 std::vector<QualityParameter> qps_;
00189 std::vector<Attachment> ats_;
00190
00191 };
00192
00193 }
00194
00195 #endif // OPENMS_FORMAT_QCMLFILE_H