00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_CONOP_PROCESSOR_HH
00020 #define OST_CONOP_PROCESSOR_HH
00021
00022 #include <ost/mol/entity_handle.hh>
00023 #include "module_config.hh"
00024 #include "diag.hh"
00025 #include "compound.hh"
00026 namespace ost { namespace conop {
00027
00028 typedef enum {
00029 PDB_DIALECT,
00030 CHARMM_DIALECT
00031 } Dialect;
00032
00033 enum ConopAction {
00034 CONOP_WARN = 0,
00035 CONOP_SILENT,
00036 CONOP_REMOVE,
00037 CONOP_REMOVE_ATOM,
00038 CONOP_REMOVE_RESIDUE,
00039 CONOP_FATAL
00040 };
00041
00042 class Processor;
00043 typedef boost::shared_ptr<Processor> ProcessorPtr;
00044
00045 class DLLEXPORT_OST_CONOP Processor {
00046 public:
00047 DiagnosticsPtr Process(mol::EntityHandle ent, bool log_diags=true) const;
00048 virtual ProcessorPtr Copy() const = 0;
00049 virtual ~Processor() {}
00050 protected:
00051 virtual void DoProcess(DiagnosticsPtr diags,
00052 mol::EntityHandle ent) const = 0;
00053 virtual bool BeginProcessing(DiagnosticsPtr diags,
00054 mol::EntityHandle ent) const { return true; }
00055 virtual bool EndProcessing(DiagnosticsPtr diags,
00056 mol::EntityHandle ent) const { return true; }
00057 bool HasUnknownAtoms(mol::ResidueHandle residue, CompoundPtr compound,
00058 bool strict_hydrogens) const;
00059 void ReorderAtoms(mol::ResidueHandle residue, CompoundPtr compound,
00060 bool fix_element) const;
00061 void FillResidueProps(mol::ResidueHandle residue, CompoundPtr compound) const;
00062 void ConnectAtomsOfResidue(mol::ResidueHandle residue,
00063 CompoundPtr compound, bool strict_hydrogens) const;
00064 void ConnectResidues(mol::ResidueHandle residue, mol::ResidueHandle next) const;
00065 static bool AreResiduesConsecutive(mol::ResidueHandle a, mol::ResidueHandle b);
00066 void DistanceBasedConnect(mol::AtomHandle atom) const;
00067 mol::AtomHandle LocateAtom(const mol::AtomHandleList&, int ordinal) const;
00068 public:
00069 Processor(bool bf, bool at, bool cn, bool aa, ConopAction zo): check_bond_feasibility_(bf),
00070 assign_torsions_(at), connect_(cn), connect_aa_(aa),
00071 zero_occ_treatment_(zo) {}
00072 Processor(): check_bond_feasibility_(false),
00073 assign_torsions_(true), connect_(true), connect_aa_(true),
00074 zero_occ_treatment_(CONOP_SILENT) {}
00075 void SetConnect(bool connect) {
00076 connect_ = connect;
00077 }
00078
00079 bool GetConnect() const {
00080 return connect_;
00081 }
00082 void SetAssignTorsions(bool flag) {
00083 assign_torsions_ = flag;
00084 }
00085 bool GetAssignTorsions() const {
00086 return assign_torsions_;
00087 }
00088
00089 bool GetConnectAminoAcids() const {
00090 return connect_aa_;
00091 }
00092 void SetConnectAminoAcids(bool c) {
00093 connect_aa_ = c;
00094 }
00095 bool GetCheckBondFeasibility() const {
00096 return check_bond_feasibility_;
00097 }
00098
00099
00100 void SetCheckBondFeasibility(bool flag) {
00101 check_bond_feasibility_ = flag;
00102 }
00103
00104
00105 ConopAction GetZeroOccTreatment() const {
00106 return zero_occ_treatment_;
00107 }
00108
00109 void SetZeroOccTreatment(ConopAction action) {
00110 zero_occ_treatment_ = action;
00111 }
00112 virtual String ToString() const = 0;
00113 protected:
00114 String OptionsToString() const;
00115 private:
00116 bool check_bond_feasibility_;
00117 bool assign_torsions_;
00118 bool connect_;
00119 bool connect_aa_;
00120 ConopAction zero_occ_treatment_;
00121 };
00122
00123 ConopAction DLLEXPORT_OST_CONOP ConopActionFromString(const String& name);
00124
00125 String DLLEXPORT_OST_CONOP StringFromConopAction(ConopAction action);
00126
00127
00129 String DLLEXPORT_OST_CONOP GuessAtomElement(const String& atom_name, bool hetatm,
00130 int atom_count);
00131
00133 mol::ChemClass DLLEXPORT_OST_CONOP GuessChemClass(mol::ResidueHandle res);
00134
00139 void DLLEXPORT_OST_CONOP AssignBackboneTorsions(mol::ChainHandle chain);
00140 void DLLEXPORT_OST_CONOP AssignBackboneTorsions(mol::ResidueHandleList residues);
00141 void DLLEXPORT_OST_CONOP AssignBackboneTorsions(mol::ResidueHandle prev,
00142 mol::ResidueHandle res,
00143 mol::ResidueHandle next);
00144
00145 bool DLLEXPORT_OST_CONOP IsBondFeasible(const mol::AtomHandle&,
00146 const mol::AtomHandle&);
00147 mol::AtomHandleList DLLEXPORT_OST_CONOP
00148 GetUnknownAtomsOfResidue(mol::ResidueHandle residue,
00149 CompoundPtr compound,
00150 bool strict_hydrogens=false);
00151 }}
00152
00153 #endif