Skip to content
Snippets Groups Projects
Commit 7b009741 authored by marco's avatar marco
Browse files

documentation update for entity and related classes

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2395 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent d1f19aff
Branches
Tags
No related merge requests found
...@@ -164,7 +164,6 @@ html_static_path = ['_static'] ...@@ -164,7 +164,6 @@ html_static_path = ['_static']
# Output file base name for HTML help builder. # Output file base name for HTML help builder.
htmlhelp_basename = 'openstructure-doc' htmlhelp_basename = 'openstructure-doc'
# -- Options for LaTeX output -------------------------------------------------- # -- Options for LaTeX output --------------------------------------------------
# The paper size ('letter' or 'a4'). # The paper size ('letter' or 'a4').
......
...@@ -4,7 +4,10 @@ Storing Custom Data ...@@ -4,7 +4,10 @@ Storing Custom Data
Introduction Introduction
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
It is often very convenient to store any arbitrary data inside an Entity. A few examples are: .. currentmodule:: ost
It is often very convenient to store any arbitrary data inside an Entity. A few
examples are:
* calculated properties of atoms * calculated properties of atoms
* sequence conservation of a residue * sequence conservation of a residue
...@@ -12,27 +15,29 @@ It is often very convenient to store any arbitrary data inside an Entity. A few ...@@ -12,27 +15,29 @@ It is often very convenient to store any arbitrary data inside an Entity. A few
* fit of a fragment inside an electron density map * fit of a fragment inside an electron density map
In OpenStructure this is supported by the use of generic properties. Most In OpenStructure this is supported by the use of generic properties. Most
building blocks are derived from :class:`GenericPropertyContainer`, meaning that building blocks are derived from :class:`~ost.GenericPropertyContainer`, meaning
arbitrary key-value pairs can be stored in them. In essence, the following that arbitrary key-value pairs can be stored in them. In essence, the following
classes support generic properties: classes support generic properties:
* :class:`~mol.EntityHandle` and :class:`~mol.EntityView` * :class:`~ost.mol.EntityHandle` and :class:`~ost.mol.EntityView`
* :class:`~mol.ChainHandle` and :class:`~mol.ChainView` * :class:`~ost.mol.ChainHandle` and :class:`~ost.mol.ChainView`
* :class:`~ResidueHandle` and :class:`~mol.ResidueView` * :class:`~ost.mol.ResidueHandle` and :class:`~ost.mol.ResidueView`
* :class:`~mol.AtomHandle` and :class:`~mol.AtomView` * :class:`~ost.mol.AtomHandle` and :class:`~ost.mol.AtomView`
* :class:`~mol.BondHandle` * :class:`~ost.mol.BondHandle`
* :class:`~seq.SequenceHandle` and :class:`~seq.AlignmentHandle` * :class:`~ost.seq.SequenceHandle` and :class:`~ost.seq.AlignmentHandle`
The view variants will reflect the generic properties of the handle variants. The view variants will reflect the generic properties of the handle variants.
A generic property key is always a string, and a value can be one of string, float, int or bool. For each of these data types, methods to retrieve and store values are available both in Python and C++. A generic property key is always a string, and a value can be one of string,
float, int or bool. For each of these data types, methods to retrieve and store
values are available both in Python and C++.
Storing and Accessing Data Storing and Accessing Data
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
All OpenStructure building blocks that are :class:`GenericPropContainers`, have All OpenStructure building blocks that are :class:`~ost.GenericPropContainers`,
four different methods to store generic data, depending on the data type (i.e. have four different methods to store generic data, depending on the data type
string, float, int or bool). (i.e. string, float, int or bool).
To store a float value with the key 'myfloatprop' in all atoms of an entity: To store a float value with the key 'myfloatprop' in all atoms of an entity:
...@@ -53,7 +58,7 @@ already exists, it will be overwritten. To check if it exists, use: ...@@ -53,7 +58,7 @@ already exists, it will be overwritten. To check if it exists, use:
To access the value of a generic property, we first check if the property exists To access the value of a generic property, we first check if the property exists
and then access it, using the method suitable for the data type of the property. and then access it, using the method suitable for the data type of the property.
For the previously set property "myfloatprop" of the data type real, at the atom For the previously set property `myfloatprop` of the data type real, at the atom
level: level:
.. code-block:: python .. code-block:: python
...@@ -82,12 +87,12 @@ to access a property of a different data type, e.g.: ...@@ -82,12 +87,12 @@ to access a property of a different data type, e.g.:
Use of Generic Properties in Queries Use of Generic Properties in Queries
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
The :doc:`../mol/base/query` can also be used for numeric generic properties (i.e. bool, The :doc:`../mol/base/query` can also be used for numeric generic properties
int, float), but the syntax is slightly different. To access any generic (i.e. bool, int, float), but the syntax is slightly different. To access any
properties, it needs to be specified that they are generic and at which level generic properties, it needs to be specified that they are generic and at which
they are defined. Therefore, all generic properties start with a 'g', followed level (chain, residue, atom) they are defined. Therefore, all generic properties
by an 'a', 'r' or 'c' for atom, residue or chain level respectively. For more start with a 'g', followed by an 'a', 'r' or 'c' for atom, residue or chain
details see :doc:`../mol/base/query`. level respectively. For more details see :doc:`../mol/base/query`.
API documentation API documentation
......
This diff is collapsed.
...@@ -79,6 +79,7 @@ void export_Atom() ...@@ -79,6 +79,7 @@ void export_Atom()
.def("Apply", &AtomHandle::Apply, args("visitor")) .def("Apply", &AtomHandle::Apply, args("visitor"))
.def("GetBondList", &AtomHandle::GetBondList) .def("GetBondList", &AtomHandle::GetBondList)
.def("GetBondCount", &AtomHandle::GetBondCount) .def("GetBondCount", &AtomHandle::GetBondCount)
.add_property("valid", &AtomHandle::IsValid)
.def("GetEntity", &AtomHandle::GetEntity) .def("GetEntity", &AtomHandle::GetEntity)
.def("GetHandle", &AtomHandle::GetHandle) .def("GetHandle", &AtomHandle::GetHandle)
.add_property("handle", &AtomHandle::GetHandle) .add_property("handle", &AtomHandle::GetHandle)
......
...@@ -42,6 +42,7 @@ void export_AtomView() ...@@ -42,6 +42,7 @@ void export_AtomView()
.def("RemoveBonds", &AtomView::RemoveBonds) .def("RemoveBonds", &AtomView::RemoveBonds)
.def("GetHandle", &AtomView::GetHandle) .def("GetHandle", &AtomView::GetHandle)
.def("GetBondCount", &AtomView::GetBondCount) .def("GetBondCount", &AtomView::GetBondCount)
.add_property("valid", &AtomView::IsValid)
.def("GetBondList", &AtomView::GetBondList) .def("GetBondList", &AtomView::GetBondList)
.def("GetHashCode", &AtomView::GetHashCode) .def("GetHashCode", &AtomView::GetHashCode)
.def("__hash__", &AtomView::GetHashCode) .def("__hash__", &AtomView::GetHashCode)
......
...@@ -86,6 +86,11 @@ void export_Chain() ...@@ -86,6 +86,11 @@ void export_Chain()
.def("GetCenterOfAtoms", &ChainHandle::GetCenterOfAtoms) .def("GetCenterOfAtoms", &ChainHandle::GetCenterOfAtoms)
.def("GetGeometricCenter", &ChainHandle::GetGeometricCenter) .def("GetGeometricCenter", &ChainHandle::GetGeometricCenter)
.add_property("geometric_center", &ChainHandle::GetGeometricCenter) .add_property("geometric_center", &ChainHandle::GetGeometricCenter)
.add_property("mass", &ChainHandle::GetMass)
.add_property("center_of_mass", &ChainHandle::GetCenterOfMass)
.add_property("center_of_atoms", &ChainHandle::GetCenterOfAtoms)
.add_property("in_sequence", &ChainHandle::InSequence)
.add_property("valid", &ChainHandle::IsValid)
.def("GetGeometricStart", &ChainHandle::GetGeometricStart) .def("GetGeometricStart", &ChainHandle::GetGeometricStart)
.def("GetGeometricEnd", &ChainHandle::GetGeometricEnd) .def("GetGeometricEnd", &ChainHandle::GetGeometricEnd)
; ;
......
...@@ -99,6 +99,11 @@ void export_ChainView() ...@@ -99,6 +99,11 @@ void export_ChainView()
.def("GetCenterOfAtoms", &ChainView::GetCenterOfAtoms) .def("GetCenterOfAtoms", &ChainView::GetCenterOfAtoms)
.def("GetGeometricCenter", &ChainView::GetGeometricCenter) .def("GetGeometricCenter", &ChainView::GetGeometricCenter)
.add_property("geometric_center", &ChainView::GetGeometricCenter) .add_property("geometric_center", &ChainView::GetGeometricCenter)
.add_property("mass", &ChainView::GetMass)
.add_property("center_of_mass", &ChainView::GetCenterOfMass)
.add_property("center_of_atoms", &ChainView::GetCenterOfAtoms)
.add_property("valid", &ChainView::IsValid)
.add_property("in_sequence", &ChainView::InSequence)
.def("GetGeometricStart", &ChainView::GetGeometricStart) .def("GetGeometricStart", &ChainView::GetGeometricStart)
.def("GetGeometricEnd", &ChainView::GetGeometricEnd) .def("GetGeometricEnd", &ChainView::GetGeometricEnd)
; ;
......
...@@ -95,6 +95,9 @@ void export_Entity() ...@@ -95,6 +95,9 @@ void export_Entity()
.add_property("chain_count", &EntityHandle::GetChainCount) .add_property("chain_count", &EntityHandle::GetChainCount)
.add_property("residue_count", &EntityHandle::GetResidueCount) .add_property("residue_count", &EntityHandle::GetResidueCount)
.add_property("atom_count", &EntityHandle::GetAtomCount) .add_property("atom_count", &EntityHandle::GetAtomCount)
.add_property("mass", &EntityHandle::GetMass)
.add_property("center_of_mass", &EntityHandle::GetCenterOfMass)
.add_property("center_of_atoms", &EntityHandle::GetCenterOfAtoms)
.def("FindWithin", &EntityHandle::FindWithin) .def("FindWithin", &EntityHandle::FindWithin)
.def("GetAngle", get_angle1) .def("GetAngle", get_angle1)
.def("GetAngle", get_angle2) .def("GetAngle", get_angle2)
...@@ -108,6 +111,7 @@ void export_Entity() ...@@ -108,6 +111,7 @@ void export_Entity()
.add_property("atoms", &EntityHandle::GetAtomList) .add_property("atoms", &EntityHandle::GetAtomList)
.add_property("chains", &EntityHandle::GetChainList) .add_property("chains", &EntityHandle::GetChainList)
.add_property("bonds", &EntityHandle::GetBondList) .add_property("bonds", &EntityHandle::GetBondList)
.add_property("valid", &EntityHandle::IsValid)
.def("GetTransformationMatrix", &EntityHandle::GetTransformationMatrix, .def("GetTransformationMatrix", &EntityHandle::GetTransformationMatrix,
return_value_policy<copy_const_reference>()) return_value_policy<copy_const_reference>())
.add_property("transform", .add_property("transform",
......
...@@ -119,6 +119,10 @@ void export_EntityView() ...@@ -119,6 +119,10 @@ void export_EntityView()
.add_property("residue_count", &EntityView::GetResidueCount) .add_property("residue_count", &EntityView::GetResidueCount)
.add_property("atom_count", &EntityView::GetAtomCount) .add_property("atom_count", &EntityView::GetAtomCount)
.add_property("bond_count", &EntityView::GetBondCount) .add_property("bond_count", &EntityView::GetBondCount)
.add_property("mass", &EntityView::GetMass)
.add_property("center_of_mass", &EntityView::GetCenterOfMass)
.add_property("center_of_atoms", &EntityView::GetCenterOfAtoms)
.add_property("valid", &EntityView::IsValid)
.def("GetResidueList", &EntityView::GetResidueList) .def("GetResidueList", &EntityView::GetResidueList)
.def("GetAtomList", &EntityView::GetAtomList) .def("GetAtomList", &EntityView::GetAtomList)
.add_property("atoms", &EntityView::GetAtomList) .add_property("atoms", &EntityView::GetAtomList)
......
...@@ -109,6 +109,8 @@ void export_Residue() ...@@ -109,6 +109,8 @@ void export_Residue()
&ResidueBase::SetOneLetterCode) &ResidueBase::SetOneLetterCode)
.def("GetQualifedName", &ResidueBase::GetQualifiedName) .def("GetQualifedName", &ResidueBase::GetQualifiedName)
.def("IsPeptideLinking", &ResidueBase::IsPeptideLinking) .def("IsPeptideLinking", &ResidueBase::IsPeptideLinking)
.add_property("peptide_linking", &ResidueBase::IsPeptideLinking)
.def("GetKey", &ResidueBase::GetKey, .def("GetKey", &ResidueBase::GetKey,
return_value_policy<copy_const_reference>()) return_value_policy<copy_const_reference>())
.def("GetName", &ResidueBase::GetName, .def("GetName", &ResidueBase::GetName,
...@@ -165,7 +167,14 @@ void export_Residue() ...@@ -165,7 +167,14 @@ void export_Residue()
.def("GetCenterOfMass", &ResidueHandle::GetCenterOfMass) .def("GetCenterOfMass", &ResidueHandle::GetCenterOfMass)
.def("GetCenterOfAtoms", &ResidueHandle::GetCenterOfAtoms) .def("GetCenterOfAtoms", &ResidueHandle::GetCenterOfAtoms)
.def("GetGeometricCenter", &ResidueHandle::GetGeometricCenter) .def("GetGeometricCenter", &ResidueHandle::GetGeometricCenter)
.add_property("mass", &ResidueHandle::GetMass)
.add_property("center_of_mass", &ResidueHandle::GetCenterOfMass)
.add_property("center_of_atoms", &ResidueHandle::GetCenterOfAtoms)
.add_property("geometric_center", &ResidueHandle::GetGeometricCenter) .add_property("geometric_center", &ResidueHandle::GetGeometricCenter)
.add_property("phi_torsion", &ResidueHandle::GetPhiTorsion)
.add_property("psi_torsion", &ResidueHandle::GetPsiTorsion)
.add_property("omega_torsion", &ResidueHandle::GetOmegaTorsion)
.add_property("valid", &ResidueHandle::IsValid)
.def("GetGeometricStart", &ResidueHandle::GetGeometricStart) .def("GetGeometricStart", &ResidueHandle::GetGeometricStart)
.def("GetGeometricEnd", &ResidueHandle::GetGeometricEnd) .def("GetGeometricEnd", &ResidueHandle::GetGeometricEnd)
.def(self==self) .def(self==self)
......
...@@ -69,7 +69,7 @@ void export_ResidueView() ...@@ -69,7 +69,7 @@ void export_ResidueView()
.def("IsAtomIncluded", &ResidueView::IsAtomIncluded, args("atom_handle")) .def("IsAtomIncluded", &ResidueView::IsAtomIncluded, args("atom_handle"))
.def("Apply", apply1, args("visitor")) .def("Apply", apply1, args("visitor"))
.def("Apply", apply2, args("visitor")) .def("Apply", apply2, args("visitor"))
.def("GetIndex", &ResidueView::GetIndex) .def("GetIndex", &ResidueView::GetIndex)
.add_property("chain", &ResidueView::GetChain) .add_property("chain", &ResidueView::GetChain)
.add_property("entity", &ResidueView::GetEntity) .add_property("entity", &ResidueView::GetEntity)
.add_property("index", &ResidueView::GetIndex) .add_property("index", &ResidueView::GetIndex)
...@@ -85,7 +85,11 @@ void export_ResidueView() ...@@ -85,7 +85,11 @@ void export_ResidueView()
.def("GetCenterOfMass", &ResidueView::GetCenterOfMass) .def("GetCenterOfMass", &ResidueView::GetCenterOfMass)
.def("GetCenterOfAtoms", &ResidueView::GetCenterOfAtoms) .def("GetCenterOfAtoms", &ResidueView::GetCenterOfAtoms)
.def("GetGeometricCenter", &ResidueView::GetGeometricCenter) .def("GetGeometricCenter", &ResidueView::GetGeometricCenter)
.add_property("mass", &ResidueView::GetMass)
.add_property("center_of_mass", &ResidueView::GetCenterOfMass)
.add_property("center_of_atoms", &ResidueView::GetCenterOfAtoms)
.add_property("geometric_center", &ResidueView::GetGeometricCenter) .add_property("geometric_center", &ResidueView::GetGeometricCenter)
.add_property("valid", &ResidueView::IsValid)
.def("GetGeometricStart", &ResidueView::GetGeometricStart) .def("GetGeometricStart", &ResidueView::GetGeometricStart)
.def("GetGeometricEnd", &ResidueView::GetGeometricEnd) .def("GetGeometricEnd", &ResidueView::GetGeometricEnd)
; ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment