Skip to content
Snippets Groups Projects
Commit 7d6fdf3a authored by Marco Biasini's avatar Marco Biasini
Browse files

added RuleBasedBuilder::GetUnknownAtoms

parent fa7a8d57
No related branches found
No related tags found
No related merge requests found
......@@ -250,4 +250,11 @@ The RuleBasedBuilder class
:param atom: The missing atom's name
:type atom: string
.. method:: GetUnknownAtoms(residue)
Returns the unknown atoms of this residue, that is all atoms that
are not part of the compound lib definition.
:rtype: list of :class:`~ost.mol.AtomHandle` instances
......@@ -55,5 +55,6 @@ void export_Builder() {
class_<RuleBasedBuilder, bases<Builder> >("RuleBasedBuilder",
init<const CompoundLibPtr&>())
.add_property("compound_lib", &RuleBasedBuilder::GetCompoundLib)
.def("GetUnknownAtoms", &RuleBasedBuilder::GetUnknownAtoms)
;
}
......@@ -80,7 +80,9 @@ int main(int argc, char const *argv[])
PrintUsage();
return 0;
}
if (!compound_lib) {
return 0;
}
assert(compound_lib);
conop::CompoundLibPtr in_mem_lib=compound_lib->Copy(":memory:");
compound_lib.reset();
......
......@@ -82,6 +82,30 @@ bool RuleBasedBuilder::HasUnknownAtoms(mol::ResidueHandle res)
return false;
}
mol::AtomHandleList RuleBasedBuilder::GetUnknownAtoms(mol::ResidueHandle res)
{
mol::AtomHandleList unknown;
this->LookupCompound(res);
if (!last_compound_) {
return unknown;
}
this->ReorderAtoms(res, last_compound_);
AtomSpecList::const_iterator j=last_compound_->GetAtomSpecs().begin();
mol::AtomHandleList atoms=res.GetAtomList();
mol::AtomHandleList::iterator i=atoms.begin();
for (mol::AtomHandleList::iterator
i=atoms.begin(), e=atoms.end(); i!=e; ++i) {
if ((*i).Impl()->GetState()==std::numeric_limits<unsigned int>::max()) {
if (((*i).GetElement()=="H" || (*i).GetElement()=="D") &&
this->GetStrictHydrogenMode()==false) {
continue;
}
unknown.push_back(*i);
}
}
return unknown;
}
void RuleBasedBuilder::FillAtomProps(mol::AtomHandle atom, const AtomSpec& spec)
{
Conopology& conop_inst=Conopology::Instance();
......
......@@ -117,7 +117,10 @@ public:
virtual void FillResidueProps(mol::ResidueHandle residue);
/// \brief whether the residue has unknown atoms
bool HasUnknownAtoms(mol::ResidueHandle res);
bool HasUnknownAtoms(mol::ResidueHandle res);
mol::AtomHandleList GetUnknownAtoms(mol::ResidueHandle res);
/// \brief Check whether the residue has all required atoms. This does not
/// include hydrogens and leaving atoms such as the terminal OXT.
virtual bool IsResidueComplete(const mol::ResidueHandle& residue);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment