00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_CONOP_RULE_BASED_HH
00020 #define OST_CONOP_RULE_BASED_HH
00021
00022 #include <ost/mol/entity_handle.hh>
00023 #include "compound_lib.hh"
00024 #include "diag.hh"
00025 #include "processor.hh"
00026
00027 namespace ost { namespace conop {
00028
00030 mol::AtomHandleList DLLEXPORT_OST_CONOP GetUnknownAtoms(mol::ResidueHandle res,
00031 CompoundPtr compound);
00032
00033 class RuleBasedProcessor;
00034
00035 typedef boost::shared_ptr<RuleBasedProcessor> RuleBasedProcessorPtr;
00036
00037 class DLLEXPORT_OST_CONOP RuleBasedProcessor : public Processor {
00038 public:
00039 RuleBasedProcessor(CompoundLibPtr compound_lib):
00040 lib_(compound_lib), fix_element_(true), strict_hydrogens_(false),
00041 unk_res_treatment_(CONOP_WARN), unk_atom_treatment_(CONOP_WARN)
00042 {
00043 }
00044
00045 RuleBasedProcessor(CompoundLibPtr compound_lib, bool fe, bool sh, ConopAction ur,
00046 ConopAction ua, bool bf, bool at, bool cn, bool aa, ConopAction zo):
00047 Processor(bf, at, cn, aa, zo), lib_(compound_lib), fix_element_(fe),
00048 strict_hydrogens_(sh), unk_res_treatment_(ur),
00049 unk_atom_treatment_(ua) {}
00050 ConopAction GetUnkResidueTreatment() const {
00051 return unk_res_treatment_;
00052 }
00053
00054 ConopAction GetUnkAtomTreatment() const {
00055 return unk_atom_treatment_;
00056 }
00057
00058 bool GetFixElement() const {
00059 return fix_element_;
00060 }
00061 void SetFixElement(bool flag) {
00062 fix_element_ = flag;
00063 }
00064 bool GetStrictHydrogens() const {
00065 return strict_hydrogens_;
00066 }
00067
00068 void SetStrictHydrogens(bool flag) {
00069 strict_hydrogens_ = flag;
00070 }
00071 void SetUnkResidueTreatment(ConopAction action) {
00072 unk_res_treatment_ = action;
00073 }
00074
00075 void SetUnkAtomTreatment(ConopAction action) {
00076 unk_atom_treatment_ = action;
00077 }
00078 virtual ProcessorPtr Copy() const {
00079 return ProcessorPtr(new RuleBasedProcessor(*this));
00080 }
00081
00082 virtual String ToString() const;
00083 protected:
00084 void ProcessUnkResidue(DiagnosticsPtr diags,
00085 mol::ResidueHandle res,
00086 mol::AtomHandleList& remaining) const;
00087 void ProcessUnkAtoms(DiagnosticsPtr diags,
00088 mol::ResidueHandle res,
00089 mol::AtomHandleList unks,
00090 mol::AtomHandleList& remaining) const;
00091 virtual void DoProcess(DiagnosticsPtr diags,
00092 mol::EntityHandle ent) const;
00093 private:
00094 CompoundLibPtr lib_;
00095 bool fix_element_;
00096 bool strict_hydrogens_;
00097 ConopAction unk_res_treatment_;
00098 ConopAction unk_atom_treatment_;
00099 };
00100
00101
00102
00103 }}
00104 #endif
00105