diff --git a/modules/conop/pymod/export_compound.cc b/modules/conop/pymod/export_compound.cc index 33cbe0536ae7490f14edc9116ef2ea25adf4d430..4ed7248f4f5fed2399b29221f5e3db399695ecad 100644 --- a/modules/conop/pymod/export_compound.cc +++ b/modules/conop/pymod/export_compound.cc @@ -135,6 +135,9 @@ void export_Compound() { .def("Load", &CompoundLib::Load, arg("readonly")=true).staticmethod("Load") .def("FindCompound", &find_compound, (arg("tlc"), arg("dialect")="PDB")) + .def("IsResidueComplete",&CompoundLib::IsResidueComplete, (arg("residue"), + arg("check_hydrogens")=false, + arg("dialect")="PDB")) .def("ClearCache", &CompoundLib::ClearCache) .def("GetOSTVersionUsed", &CompoundLib::GetOSTVersionUsed) .def("GetCreationDate", &get_creation_date, (arg("comp_lib"))) diff --git a/modules/conop/src/compound_lib_base.cc b/modules/conop/src/compound_lib_base.cc index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..b5071e00fdc48f62f4cd8475b9589f5c67e8de19 100644 --- a/modules/conop/src/compound_lib_base.cc +++ b/modules/conop/src/compound_lib_base.cc @@ -0,0 +1,26 @@ +#include "compound_lib_base.hh" + +namespace ost { namespace conop { + +bool CompoundLibBase::IsResidueComplete(const ost::mol::ResidueHandle& res, bool check_hydrogens, Compound::Dialect dialect) const{ + + CompoundPtr compound = this->FindCompound(res.GetName(), dialect); + + AtomSpecList a_spec = compound->GetAtomSpecs(); + + for(AtomSpecList::const_iterator it=a_spec.begin(); it!=a_spec.end();++it){ + if(it->element=="H" || it->element=="D"){ + if(check_hydrogens){ + if(!res.FindAtom(it->name).IsValid()){ + return false; + } + } + } + if(!res.FindAtom(it->name).IsValid()){ + return false; + } + } + return true; +} + +}}//namespace diff --git a/modules/conop/src/compound_lib_base.hh b/modules/conop/src/compound_lib_base.hh index 350307eb52eb441aff4c4bac875a4344bbf5a319..aee5215b944597bc0a4a621af137118a8824da75 100644 --- a/modules/conop/src/compound_lib_base.hh +++ b/modules/conop/src/compound_lib_base.hh @@ -2,6 +2,7 @@ #define OST_CONOP_COMPOUND_LIB_BASE_HH #include "compound.hh" +#include <ost/mol/residue_handle.hh> namespace ost { namespace conop { @@ -13,6 +14,10 @@ public: virtual ~CompoundLibBase() {} virtual CompoundPtr FindCompound(const String& id, Compound::Dialect dialect) const = 0; + + bool IsResidueComplete(const ost::mol::ResidueHandle& res, + bool check_hydrogens, + Compound::Dialect) const; }; }}