diff --git a/modules/io/pymod/export_mmcif_io.cc b/modules/io/pymod/export_mmcif_io.cc index fa63ed2448bf4fad6dc88fb9751bb74ec0ebf9aa..9c860b596d51f834bf230e5d94884fe69ac840e9 100644 --- a/modules/io/pymod/export_mmcif_io.cc +++ b/modules/io/pymod/export_mmcif_io.cc @@ -332,6 +332,19 @@ void export_mmcif_io() .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<>()) .def("AddCitation", &MMCifInfo::AddCitation) .def("GetCitations", make_function(&MMCifInfo::GetCitations, diff --git a/modules/io/src/mol/mmcif_info.hh b/modules/io/src/mol/mmcif_info.hh index 8da038933d23174b3e14b520e0d9a7b7145d2dd9..17c60b673c999961cbd30a55ac80f8d8d0fbeff4 100644 --- a/modules/io/src/mol/mmcif_info.hh +++ b/modules/io/src/mol/mmcif_info.hh @@ -927,6 +927,8 @@ public: atom1_(atom1), atom2_(atom2) {} mol::AtomHandle GetAtom1() const { return atom1_;} 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) { editor.Connect(atom1_, atom2_); diff --git a/modules/io/tests/test_io_mmcif.py b/modules/io/tests/test_io_mmcif.py index cfa10798c248f5d58385fcee070088ea138f0566..bdad1139236c14527a2afc4324cfcddb7761b08a 100644 --- a/modules/io/tests/test_io_mmcif.py +++ b/modules/io/tests/test_io_mmcif.py @@ -263,6 +263,21 @@ class TestMMCifInfo(unittest.TestCase): self.assertEqual(len(crambin_pdb.residues), 46) 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__': from ost import testutils testutils.RunTests()