Skip to content
Snippets Groups Projects
Commit 9ae8c88c authored by B13nch3n's avatar B13nch3n
Browse files

SCHWED-4847: Export the MMCifInfoEntityBranch class to Python.

parent f77fe6bf
No related branches found
No related tags found
No related merge requests found
...@@ -332,6 +332,19 @@ void export_mmcif_io() ...@@ -332,6 +332,19 @@ void export_mmcif_io()
.add_property("first_release", &MMCifInfoRevisions::GetFirstRelease) .add_property("first_release", &MMCifInfoRevisions::GetFirstRelease)
; ;
class_<MMCifInfoEntityBranch>("MMCifInfoEntityBranch", init<mol::AtomHandle,
mol::AtomHandle>())
.def("GetAtom1", &MMCifInfoEntityBranch::GetAtom1)
.def("GetAtom2", &MMCifInfoEntityBranch::GetAtom2)
.def("ConnectBranchLink", &MMCifInfoEntityBranch::ConnectBranchLink)
.def("SetAtom1", &MMCifInfoEntityBranch::SetAtom1)
.def("SetAtom2", &MMCifInfoEntityBranch::SetAtom2)
.add_property("atom1", &MMCifInfoEntityBranch::GetAtom1,
&MMCifInfoEntityBranch::SetAtom1)
.add_property("atom2", &MMCifInfoEntityBranch::GetAtom2,
&MMCifInfoEntityBranch::SetAtom2)
;
class_<MMCifInfo>("MMCifInfo", init<>()) class_<MMCifInfo>("MMCifInfo", init<>())
.def("AddCitation", &MMCifInfo::AddCitation) .def("AddCitation", &MMCifInfo::AddCitation)
.def("GetCitations", make_function(&MMCifInfo::GetCitations, .def("GetCitations", make_function(&MMCifInfo::GetCitations,
......
...@@ -927,6 +927,8 @@ public: ...@@ -927,6 +927,8 @@ public:
atom1_(atom1), atom2_(atom2) {} atom1_(atom1), atom2_(atom2) {}
mol::AtomHandle GetAtom1() const { return atom1_;} mol::AtomHandle GetAtom1() const { return atom1_;}
mol::AtomHandle GetAtom2() const { return atom2_; } mol::AtomHandle GetAtom2() const { return atom2_; }
void SetAtom1(mol::AtomHandle atom) { atom1_ = atom; }
void SetAtom2(mol::AtomHandle atom) { atom2_ = atom; }
void ConnectBranchLink(mol::XCSEditor editor) void ConnectBranchLink(mol::XCSEditor editor)
{ {
editor.Connect(atom1_, atom2_); editor.Connect(atom1_, atom2_);
......
...@@ -263,6 +263,21 @@ class TestMMCifInfo(unittest.TestCase): ...@@ -263,6 +263,21 @@ class TestMMCifInfo(unittest.TestCase):
self.assertEqual(len(crambin_pdb.residues), 46) self.assertEqual(len(crambin_pdb.residues), 46)
self.assertEqual(len(crambin_pdb.atoms), 327) self.assertEqual(len(crambin_pdb.atoms), 327)
def test_mmcifinfo_entitybranch(self):
# create dummy atoms
eh = mol.CreateEntity()
editor = eh.EditXCS();
ch = editor.InsertChain("A");
res1 = editor.AppendResidue(ch, "BMA");
res2 = editor.AppendResidue(ch, "MAN");
atom1 = editor.InsertAtom(res2, "C1", geom.Vec3());
atom2 = editor.InsertAtom(res1, "O3", geom.Vec3());
branch = io.MMCifInfoEntityBranch(atom1, atom2)
self.assertEqual(branch.atom1.qualified_name, "A.MAN2.C1")
branch.ConnectBranchLink(editor)
self.assertEqual(atom2.GetBondPartners()[0].qualified_name, "A.MAN2.C1")
if __name__== '__main__': if __name__== '__main__':
from ost import testutils from ost import testutils
testutils.RunTests() testutils.RunTests()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment