From 2ccbc7c46d835147c265476037f6287e9f34f6d2 Mon Sep 17 00:00:00 2001 From: Xavier Robin <xavier.robin@unibas.ch> Date: Thu, 26 Jan 2023 15:21:55 +0100 Subject: [PATCH] doc: atom_count and bond_count Also export the attributes where needed. --- modules/mol/base/doc/entity.rst | 30 +++++++++++++++++++ modules/mol/base/pymod/export_residue.cc | 1 + modules/mol/base/pymod/export_residue_view.cc | 1 + 3 files changed, 32 insertions(+) diff --git a/modules/mol/base/doc/entity.rst b/modules/mol/base/doc/entity.rst index 8033080bf..45688670e 100644 --- a/modules/mol/base/doc/entity.rst +++ b/modules/mol/base/doc/entity.rst @@ -624,6 +624,18 @@ The Handle Classes :type: :class:`AtomHandleList` (list of :class:`AtomHandle`) + .. attribute:: atom_count + + Number of atoms. Read-only. See :meth:`GetAtomCount`. + + :type: :class:`int` + + .. attribute:: bond_count + + Number of bonds. Read-only. See :meth:`GetBondCount`. + + :type: :class:`int` + .. attribute:: bounds Axis-aligned bounding box of the residue. Read-only. @@ -858,6 +870,14 @@ The Handle Classes See :attr:`atoms` + .. method:: GetAtomCount() + + See :attr:`atom_count` + + .. method:: GetBondCount() + + See :attr:`bond_count` + .. method:: GetBounds() See :attr:`bounds` @@ -1927,6 +1947,12 @@ The View Classes :type: :class:`AtomViewList` (list of :class:`AtomView`) + .. attribute:: atom_count + + Number of atoms included in the view. Read-only. See :meth:`GetAtomCount`. + + :type: :class:`int` + .. attribute:: chain The chain this residue belongs to. Read-only. Also available as @@ -2015,6 +2041,10 @@ The View Classes See :attr:`atoms` + .. method:: GetAtomCount() + + See :attr:`atom_count` + .. method:: GetIndex() See :attr:`index` diff --git a/modules/mol/base/pymod/export_residue.cc b/modules/mol/base/pymod/export_residue.cc index d4b741d3b..40fbfe260 100644 --- a/modules/mol/base/pymod/export_residue.cc +++ b/modules/mol/base/pymod/export_residue.cc @@ -261,6 +261,7 @@ void export_Residue() .def("GetAtomCount", &ResidueHandle::GetAtomCount) .def("GetBondCount", &ResidueHandle::GetBondCount) .add_property("atom_count", &ResidueHandle::GetAtomCount) + .add_property("bond_count", &ResidueHandle::GetBondCount) .add_property("index", &ResidueHandle::GetIndex) .def("Select", select_string, arg("flags")=0) .def("Select", select_query, arg("flags")=0) diff --git a/modules/mol/base/pymod/export_residue_view.cc b/modules/mol/base/pymod/export_residue_view.cc index a3a7f16ea..9d14320de 100644 --- a/modules/mol/base/pymod/export_residue_view.cc +++ b/modules/mol/base/pymod/export_residue_view.cc @@ -64,6 +64,7 @@ void export_ResidueView() .add_property("atoms", make_function(&ResidueView::GetAtomList, return_value_policy<copy_const_reference>())) + .add_property("atom_count", &ResidueView::GetAtomCount) .def("FindAtom", string_find_atom, args("atom_name")) .def("AddAtom", add_atom_handle, X_add_atom_overloads(args("atom_handle", "flags"))) .def("AddAtom", add_atom_view, X_add_atom_overloads(args("atom_view", "flags"))) -- GitLab