6 #ifndef BALL_FORMAT_DOCKRESULTFILE_H
7 #define BALL_FORMAT_DOCKRESULTFILE_H
14 #include <QtXml/QXmlDefaultHandler>
15 #include <QtXml/QXmlStreamReader>
16 #include <QtXml/QXmlStreamWriter>
17 #include <QtCore/QFile>
18 #include <QtCore/QTemporaryFile>
38 virtual ~DockResultFile() throw();
43 Receptor* readReceptor() throw(Exception::ParseError);
53 Ligand* readLigand() throw(Exception::ParseError);
58 bool writeLigand(
Ligand* lig);
63 void writeResult(
Result* res);
68 void writeResults(vector<
Result*>& res);
73 vector<
Result*> readResults() throw(Exception::ParseError);
78 const vector<
Result*>* getResults();
79 void addResult(
Result* res);
82 Size countConformations();
88 Molecule* read() throw (Exception::ParseError);
91 void setOutputParameters(
Result::Method,
String property_name,
String& receptor_conf_UID,
String method_description="");
93 void setToolInfo(const
String& toolinfo, const
String& timestamp);
95 void setInputParameters(list<
Size>& selected_results);
97 void selectAllResultsForInput();
100 void disableAutomaticResultCreation();
111 static const
String VERSION;
125 static
bool gmf_new_ligand_read_;
127 String gmf_property_name_;
130 Result::Method gmf_result_method_;
131 String gmf_result_description_;
132 String gmf_receptor_conf_UID_;
133 bool gmf_result_creation_disabled_;
139 QXmlStreamReader* xmlIn_;
143 QTemporaryFile* resultfileTmp_;
144 QTemporaryFile* ligandfileTmp_;
145 QTemporaryFile* receptorfileTmp_;
148 QFile* receptorfile_;
149 QXmlStreamWriter* xmlOutReceptor_;
150 QXmlStreamWriter* xmlOutLigand_;
151 QXmlStreamWriter* xmlOutResult_;
159 Chain* current_chain_;
162 vector<
PDBAtom*> current_PDB_atoms_;
169 String current_ligand_id_;
170 String current_receptor_id_;
172 String current_molecule_id_;
173 String current_conformation_id_;
174 String current_molecule_name_;
175 String current_protein_name_;
178 vector<
Atom*> current_atoms_;
179 vector<
int> bonds_from_;
180 vector<
int> bonds_to_;
181 vector<
int> bonds_order_;
186 String current_Result_InputPoseId_;
189 void addLigand(
Ligand* lig);
192 void writeReceptors(QXmlStreamWriter &out);
193 void writeReceptor(
Receptor* recep, QXmlStreamWriter &out);
194 void writeProtein(
Protein* prot, QXmlStreamWriter &out);
195 void writeResidue(
Residue* res, QXmlStreamWriter &out);
196 void writePDBAtom(
PDBAtom* at, QXmlStreamWriter &out);
197 void writePDBAtom(
Atom* at, QXmlStreamWriter &out);
198 void writeConformation(
Conformation* conf, QXmlStreamWriter &out);
199 void writeFlexibility(const
FlexDefinition &fd, QXmlStreamWriter &out);
200 void writeRotamericFlexibleResidue(
Position idx, QXmlStreamWriter &out);
201 void writeFullyFlexibleResidue(
Position idx, QXmlStreamWriter &out);
203 bool readReceptors_() throw(Exception::ParseError);
204 bool readReceptor_() throw(Exception::ParseError);
205 bool readProtein() throw(Exception::ParseError);
206 bool readResidue() throw(Exception::ParseError);
207 bool readPDBAtom() throw(Exception::ParseError);
209 bool readResults_() throw(Exception::ParseError);
210 bool readResult() throw(Exception::ParseError);
211 bool readSubResult() throw(Exception::ParseError);
212 bool readEntry() throw(Exception::ParseError);
214 void writeResults(QXmlStreamWriter &out);
215 void writeResult(
Result* result, QXmlStreamWriter &out);
216 void writeResultData(const
Result::ResultData &rd, QXmlStreamWriter &out);
218 void writeLigands(QXmlStreamWriter &out);
219 bool writeLigand(
Ligand* lig, QXmlStreamWriter &out);
220 void writeMolecule(
Molecule* mol, QXmlStreamWriter &out);
221 void writeAtom(
Atom* at, QXmlStreamWriter &out);
222 void writeBond(
Bond* b, QXmlStreamWriter &out);
224 bool readLigands() throw(Exception::ParseError);
225 bool readLigand_() throw(Exception::ParseError);
226 bool readMolecule() throw(Exception::ParseError);
227 bool readConformations(
FlexibleMolecule* target) throw(Exception::ParseError);
228 bool readConformation(
Conformation* conformation) throw(Exception::ParseError);
229 bool readCoordinates() throw(Exception::ParseError);
230 bool readFlexibility() throw(Exception::ParseError);
231 bool readFlexibilities() throw(Exception::ParseError);
232 bool readFullFlexResidue() throw(Exception::ParseError);
233 bool readRotamericResidue() throw(Exception::ParseError);
234 bool readAtoms() throw(Exception::ParseError);
235 bool readAtom() throw(Exception::ParseError);
236 bool readBonds() throw(Exception::ParseError);
237 bool readBond() throw(Exception::ParseError);
240 void buildLigand() throw(Exception::ParseError);
241 void buildMolecule() throw(Exception::ParseError);
242 void buildReceptor() throw(Exception::ParseError);
243 void buildProtein() throw(Exception::ParseError);
244 void buildResidue() throw(Exception::ParseError);
247 bool retrieveInt(const String& s,
int &out);
248 bool retrieveFloat(const String& s,
float &out);
249 void setElement(
Atom* at, String symbol);
250 bool setCoordinate(const
int& idx , const String& coord);
251 static String fromQString(const QString &s);
252 static QString toQString(const String &s);
253 static
void attributesToHashMap(const QXmlAttributes& attributes,
HashMap<String,String>& map);
254 static
void attributesToHashMap(const QXmlStreamAttributes& attributes,
HashMap<String,String>& map);
255 static
bool isAminoAcid(String s);
258 DockResultFile(const DockResultFile &df);
260 DockResultFile& operator=(const DockResultFile &df);
263 static String ROOTTAG;
264 static String RECEPTORSTAG;
265 static String RECEPTORTAG;
266 static String RECEPTOR_A_ID;
267 static String PROTEINTAG;
268 static String PROTEIN_A_NAME;
269 static String CONFORMATIONSTAG;
270 static String CONFORMATIONTAG;
271 static String CONFORMATION_A_ID;
272 static String FLEXIBILITIESTAG;
273 static String FLEXIBILITYTAG;
274 static String RESIDUETAG;
275 static String RESIDUE_A_NAME;
276 static String RESIDUE_A_IDX;
277 static String PDBATOMTAG;
278 static String PDBATOM_A_NAME;
280 static String RESULTSTAG;
281 static String RESULTTAG;
282 static String RESULT_A_METHOD;
283 static String RESULT_A_METHODSTRING;
284 static String SUBRESULTTAG;
285 static String SUBRESULT_A_LIGCONFID;
286 static String RESULTDATATAG;
287 static String POSEDATATAG;
288 static String RESULTDATA_A_ENERGY;
289 static String RESULTDATA_A_CONFID;
290 static String RESULTDATA_A_LIGID;
291 static String RESULTDATA_A_METHOD;
293 static String LIGANDSTAG;
294 static String LIGANDTAG;
295 static String LIGAND_A_ID;
296 static String MOLECULETAG;
297 static String MOLECULE_A_NAME;
298 static String ATOMTAG;
299 static String ATOM_A_ELEMENT;
300 static String ATOMSTAG;
301 static String BONDSTAG;
302 static String BONDTAG;
303 static String BOND_A_FROM;
304 static String BOND_A_TO;
305 static String BOND_A_ORDER;
#define BALL_CREATE(name)
std::ios::openmode OpenMode
static bool SHOW_IDENTICAL_LIGANDS_WARNING
HashMap class based on the STL map (containing serveral convenience functions)