diff --git a/doc/conf/conf.py b/doc/conf/conf.py index 9e720456c9f9cc6a11c8a6741be2e7ce5ae06d9c..e37ac88a4dba6c8b16869ba1964cb688104aa527 100644 --- a/doc/conf/conf.py +++ b/doc/conf/conf.py @@ -164,7 +164,6 @@ html_static_path = ['_static'] # Output file base name for HTML help builder. htmlhelp_basename = 'openstructure-doc' - # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). diff --git a/modules/base/doc/generic.rst b/modules/base/doc/generic.rst index 6c2cd34cb6d0a29b75a8a8470c6b07a8f7e67d7d..03ed133b561e9f5f892ca33a6e9f6e512c254d0e 100644 --- a/modules/base/doc/generic.rst +++ b/modules/base/doc/generic.rst @@ -4,7 +4,10 @@ Storing Custom Data 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 * sequence conservation of a residue @@ -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 In OpenStructure this is supported by the use of generic properties. Most -building blocks are derived from :class:`GenericPropertyContainer`, meaning that -arbitrary key-value pairs can be stored in them. In essence, the following +building blocks are derived from :class:`~ost.GenericPropertyContainer`, meaning +that arbitrary key-value pairs can be stored in them. In essence, the following classes support generic properties: - * :class:`~mol.EntityHandle` and :class:`~mol.EntityView` - * :class:`~mol.ChainHandle` and :class:`~mol.ChainView` - * :class:`~ResidueHandle` and :class:`~mol.ResidueView` - * :class:`~mol.AtomHandle` and :class:`~mol.AtomView` - * :class:`~mol.BondHandle` - * :class:`~seq.SequenceHandle` and :class:`~seq.AlignmentHandle` + * :class:`~ost.mol.EntityHandle` and :class:`~ost.mol.EntityView` + * :class:`~ost.mol.ChainHandle` and :class:`~ost.mol.ChainView` + * :class:`~ost.mol.ResidueHandle` and :class:`~ost.mol.ResidueView` + * :class:`~ost.mol.AtomHandle` and :class:`~ost.mol.AtomView` + * :class:`~ost.mol.BondHandle` + * :class:`~ost.seq.SequenceHandle` and :class:`~ost.seq.AlignmentHandle` 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 -------------------------------------------------------------------------------- -All OpenStructure building blocks that are :class:`GenericPropContainers`, have -four different methods to store generic data, depending on the data type (i.e. -string, float, int or bool). +All OpenStructure building blocks that are :class:`~ost.GenericPropContainers`, +have four different methods to store generic data, depending on the data type +(i.e. string, float, int or bool). 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: 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. -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: .. code-block:: python @@ -82,12 +87,12 @@ to access a property of a different data type, e.g.: Use of Generic Properties in Queries -------------------------------------------------------------------------------- -The :doc:`../mol/base/query` can also be used for numeric generic properties (i.e. bool, -int, float), but the syntax is slightly different. To access any generic -properties, it needs to be specified that they are generic and at which level -they are defined. Therefore, all generic properties start with a 'g', followed -by an 'a', 'r' or 'c' for atom, residue or chain level respectively. For more -details see :doc:`../mol/base/query`. +The :doc:`../mol/base/query` can also be used for numeric generic properties +(i.e. bool, int, float), but the syntax is slightly different. To access any +generic properties, it needs to be specified that they are generic and at which +level (chain, residue, atom) they are defined. Therefore, all generic properties +start with a 'g', followed by an 'a', 'r' or 'c' for atom, residue or chain +level respectively. For more details see :doc:`../mol/base/query`. API documentation diff --git a/modules/mol/base/doc/entity.rst b/modules/mol/base/doc/entity.rst index 1adcd2de76af8d919b0928bc91b01669912a1a59..529da6ce1a3c801801b1153e4c2ec69ddb60b57f 100644 --- a/modules/mol/base/doc/entity.rst +++ b/modules/mol/base/doc/entity.rst @@ -3,14 +3,16 @@ The Molecular Entity .. currentmodule:: ost.mol -This document describes the :class:`EntityHandle` and related classes. +This document describes the :class:`EntityHandle` and the related classes. +The Handle Classes +-------------------------------------------------------------------------------- .. function:: CreateEntity() Creates a new entity. The created entity is empty, that is, it does not contain any atoms, residues, chains, bonds or torsions. To populate the - entity, use an :doc:`editors`. + entity, use an :doc:`entity editor <editors>`. :returns: The newly created :class:`EntityHandle` @@ -25,132 +27,191 @@ This document describes the :class:`EntityHandle` and related classes. represent a ligand or a collection of water molecules - hence the rather generic name. - .. method:: FindChain(chain_name) - - Get chain by name. See also :meth:`GetChainList` - - :param chain_name: Chain identifier, e.g. "A" - :type chain_name: string - :returns: A valid :class:`ChainHandle`, if the entity contains a - chain with the given name, an invalid - :class:`ChainHandle` otherwise. - - .. method:: GetChainList() - - Get list of all chains of this entity. To access a single chain, use - :meth:`FindChain`. - - :returns: A list of :class:`ChainHandles<ChainHandle>` + .. attribute:: chains - .. method:: FindResidue(chain_name, res_num) - - Get residue by chain name and residue number. See also - :meth:`GetResidueList` - - :param chain_name: Chain identifier, e.g. "A" - :type chain_name: string - :param res_num: residue number - :type res_num: mol.ResNum - - :returns: A valid :class:`ResidueHandle` if the chain exists and - the chain contains a residue of the given residue - number, an invalid :class:`ResidueHandle` otherwise. - - .. method:: GetResidueList() + List of all chains of this entity. The chains are in the same + order they have been added, for example the order they have been listed + in a PDB file. + + Also available as :meth:`GetChainList`. To access a single chain, use + :meth:`FindChain`. + + This property is read-only. + + .. attribute:: residues + + List of all residues of this entity. The returned residues are first + sorted by chain and then from N- to C-terminus. + + This property is read-only. + + **Example usage:** + + .. code-block:: python + + for res in ent.residues: + print res.name, res.atom_count + + Also available as :meth:`GetResidueList`. To access a single residue, use + :meth:`FindResidue`. - Get list of all residues of this entity. To access a single residue, use - :meth:`FindResidue`. + :returns: A list of :class:`residue handles<ResidueHandle>` - :returns: A list of :class:`ResidueHandles<ResidueHandle>` - - .. method:: FindAtom(chain_name, res_num, atom_name) + .. attribute:: atoms - Get atom by chain name, residue number and atom name. See also - :meth:`GetAtomList` + Get list of all atoms of this entity. To access a single atom, use + :meth:`FindAtom`. - :param chain_name: Chain identifier, e.g. "A" - :type chain_name: string - :param res_num: residue number - :type res_num: mol.ResNum - :param atom_name: atom name, e.g. CA - :type atom_name: string + This property is read-only. Also available as :meth:`GetAtomList` + + :type: A list of :class:`atom handles<AtomHandle>` - :returns: A valid :class:`AtomHandle` if an atom matching the - parameters could be found, an invalid - :class:`AtomHandle` otherwise + .. attribute:: mass + + The total mass of the entity in Dalton. Also available as :meth:`GetMass`. + + :type: float - .. method:: GetAtomList() + .. attribute:: center_of_mass - Get list of all atoms of this entity. To access a single atom, use - :meth:`FindAtom` + Center of mass. Also available as :meth:`GetCenterOfMass` + + :type: :class:`~ost.geom.Vec3` + + .. attribute:: center_of_atoms - :returns: A list of :class:`AtomHandles<AtomHandle>` - + Center of atoms (not mass-weighted). Also available as + :meth:`GetCenterOfAtoms`. + + :type: :class:`~ost.geom.Vec3` + + .. method:: FindChain(chain_name) + + Get chain by name. See also :attr:`chains` + + :param chain_name: Chain identifier, e.g. "A" + :type chain_name: str + :returns: A valid :class:`ChainHandle`, if the entity contains a + chain with the given name, an invalid + :class:`ChainHandle` otherwise. + + .. method:: GetChainList() + + See :attr:`chains` + + .. method:: FindResidue(chain_name, res_num) + + Get residue by chain name and residue number. See also + :meth:`GetResidueList` + + :param chain_name: Chain identifier, e.g. "A" + :type chain_name: str + :param res_num: residue number + :type res_num: mol.ResNum + + :returns: A valid :class:`ResidueHandle` if the chain exists and + the chain contains a residue of the given residue + number, an invalid :class:`ResidueHandle` otherwise. + + .. method:: GetResidueList() + + See :attr:`residues` + + .. method:: FindAtom(chain_name, res_num, atom_name) + + Get atom by chain name, residue number and atom name. See also + :attr:`atoms` + + :param chain_name: Chain identifier, e.g. "A" + :type chain_name: str + :param res_num: residue number + :type res_num: mol.ResNum + :param atom_name: atom name, e.g. CA + :type atom_name: str + + :returns: A valid :class:`AtomHandle` if an atom matching the + parameters could be found, an invalid + :class:`AtomHandle` otherwise + + .. method:: GetAtomList() + + See :attr:`atoms` + .. method:: RequestXCSEditor([edit_mode=mol.EditMode.BUFFERED_EDIT]) - - Request :class:`XCSEditor` for editing the external coordinate system. This - call will fail when there are pending changes of the internal coordinate - system. - - :param edit_mode: Must be EditMode.BUFFERED_EDIT or - EditMode.UNBUFFERED_EDIT. For more details, see the - editor documentation. - :type edit_mode: mol.EditMode - - :returns: :class:`XCSEditor` + + Request :class:`XCSEditor` for editing the external coordinate system. This + call will fail when there are pending changes of the internal coordinate + system. + + :param edit_mode: Must be EditMode.BUFFERED_EDIT or + EditMode.UNBUFFERED_EDIT. For more details, see the + editor documentation. + :type edit_mode: mol.EditMode + + :returns: :class:`XCSEditor` + .. method:: RequestICSEditor([edit_mode=mol.EditMode.BUFFERED_EDIT]) - - Request :class:`ICSEditor` for editing the internal coordinate system, such - as torsions, bond lengths and angle between two bonds. This call will fail - when there are pending changes of the external coordinate system. - - :param edit_mode: Must be EditMode.BUFFERED_EDIT or - EditMode.UNBUFFERED_EDIT. For more details, see the - editor documentation. - :type edit_mode: mol.EditMode - - :returns: :class:`ICSEditor` - - .. method:: Select(query, flags) - - Perform a selection on the entity. The result of the selection is an - :class:`EntityView` which contains usually only a subset of chains, - residues, atoms and bonds of the original entity. - - :param query: The query to be executed. See :class:`Query` for details. - :type query: string or :class:`Query` - :param flags: An ORed combination of :class:`QueryFlags`. - :type flags: int - :returns: An :class:`entity view <EntityView>`. - :raises: :class:`QueryError` when the query could not be executed due - to syntactic errors. - + + Request :class:`ICSEditor` for editing the internal coordinate system, such + as torsions, bond lengths and angle between two bonds. This call will fail + when there are pending changes of the external coordinate system. + + :param edit_mode: Must be EditMode.BUFFERED_EDIT or + EditMode.UNBUFFERED_EDIT. For more details, see the + editor documentation. + :type edit_mode: mol.EditMode + + :returns: :class:`ICSEditor` + + .. method:: Select(query, flags=0) + + Perform a selection on the entity. The result of the selection is an + :class:`EntityView` which (usually) contains only a subset of chains, + residues, atoms and bonds of the original entity. + + **Example Usage:** + + .. code-block::python + # select calpha atoms of peptides + calphas=ent.Select('aname=CA and peptide=true') + + # select atoms in a box of size 10, centered at the origin + in_box=ent.Select('x=-5:5 and y=-5:5 and z=-5:5') + + :param query: The query to be executed. See :class:`Query` for details. + :type query: string or :class:`Query` + :param flags: An ORed combination of :class:`QueryFlags`. + :type flags: int + :returns: An :class:`entity view <EntityView>`. + :raises: :class:`QueryError` when the query could not be executed due + to syntactic errors. + .. method:: CreateFullView() - - Creates an entity view containing all chains, residues, atoms and bonds of - this entity. - - .. code-block:: python - - # these two lines are identical - full=ent.Select('') - full=ent.CreateFullView() - - :returns: :class:`EntityView` - + + Creates an entity view containing all chains, residues, atoms and bonds of + this entity. + + .. code-block:: python + + # these two lines are identical + full=ent.Select('') + full=ent.CreateFullView() + + :returns: :class:`EntityView` + .. method:: CreateEmptyView() - - Creates an entity view pointing to this entity, but otherwise empty. This - method is usually the starting point for manual entity view creation, e.g. - - .. code-block:: python - - view=ent.CreateEmtpyView() - for atom in ent.atoms: - if ComplicatedPredicate(atom): - view.AddAtom(atom) - - :returns: :class:`EntityView` + + Creates an entity view pointing to this entity, but otherwise empty. This + method is usually the starting point for manual entity view creation, e.g.: + + .. code-block:: python + + view=ent.CreateEmtpyView() + for atom in ent.atoms: + if ComplicatedPredicate(atom): + view.AddAtom(atom) + + :returns: :class:`EntityView` .. method:: Copy() @@ -167,53 +228,129 @@ This document describes the :class:`EntityHandle` and related classes. Get center of atoms, that is the average atom position of the entity. Use :meth:`GetCenterOfMass` to calculate the mass-weighted center of the entity. - :returns: :class:`geom.Vec3` + :returns: :class:`~ost.geom.Vec3` .. method:: GetCenterOfMass() - - Calculates the center of mass of the entity. Use :meth:`GetCenterOfAtoms` - to calculate the non-mass-weighted center of the entity. - - :returns: :class:`geom.Vec3` - + + Calculates the center of mass of the entity. Use :meth:`GetCenterOfAtoms` + to calculate the non-mass-weighted center of the entity. + + :returns: :class:`~ost.geom.Vec3` + .. method:: GetGeometricCenter() Calculates the mid-point of the axis aligned bounding box of the entity. - :returns: :class:`geom.Vec3` + :returns: :class:`~ost.geom.Vec3` .. method:: GetMass() - Calculates the total mass of the entity by summing up the masses of all - atoms. - - :returns: The mass in Dalton + See :attr:`mass` .. method:: Apply(visitor) + + Apply EntityVisitor to the entity. In Python, you usually don't need this + function bother using. EntityVisitors are mainly used in C++ to implement + algorithms that are able to operate on :class:`EntityViews <EntityView>` + and :class:`entity handles<EntityHandle>` at the same time. + + .. method:: FindWithin(pos, radius) - Apply EntityVisitor to the entity. In Python, you shouldn't bother using - this function. EntityVisitory are mainly used in C++ to implement - algorithms that operate are able to operate on EntityViews or - EntityHandles. + Find all atoms in sphere of given radius centered at *pos*. To turn the + returned list of atoms into an :class:`EntityView`, use + :func:`CreateViewFromAtomList`. + + :param pos: Center of sphere + :type pos: :class:`~ost.geom.Vec3` + :param radius: The radius of the sphere + :type radius: float + + :returns: A list of :class:`atom handles<AtomHandle>` + +.. class:: ChainHandle + + A chain of one or more :class:`residues <ResidueHandle>`. Chains are always + part of an entity. + + .. attribute:: name + + The chain name. The name uniquely identifies the chain in the entity. In + most cases, the chain name is one character. This is restriction of the PDB + file format. However, you are free to use longer names as long as you don't + want to save them as PDB files - .. method:: FindWithin(pos, radius) + This property is read-only. To change the name, use an :class:`XCSEditor`. + + Also available as :meth:`GetName` + + :type: str + + .. attribute:: residues + + List of all residues of this chain. The residues are sorted from N- to + C-terminus. Usually the residue numbers are in ascending order + (see :attr:`in_sequence`). + + This property is read-only. + + **Example usage:** + + .. code-block:: python + + chain=ent.FindChain("A") + for res in chain.residues: + print res.name, res.atom_count + + Also available as :meth:`GetResidueList`. To access a single residue, use + :meth:`FindResidue`. + + :returns: A list of :class:`residue handles<ResidueHandle>` + + .. attribute:: in_sequence - Find all atoms in sphere of given radius centered at *pos*. To turn the - returned list of atoms into an :class:`EntityView`, use - :func:`CreateViewFromAtomList`. + Whether the residue numbers are in ascending order. For example: - :param pos: Center of sphere - :type pos: :class:`geom.Vec3` - :param radius: The radius of the sphere - :type radius: float + .. code-block:: python - :returns: A list of :class:`AtomHandles<AtomHandle>` + chain=ent.FindChain("A") + print chain.residues # [A.GLY1, A.GLY2, A.GLY4A, A.GLY4B] + print chain.in_sequence # prints true + + chain=ent.FindChain("B") + print chain.residues # [B.GLY1, B.GLY4, B.GLY3] + print chain.in_sequence # prints false + + .. attribute:: atoms + + Get list of all atoms of this chain. To access a single atom, use + :meth:`FindAtom`. + + This property is read-only. Also available as :meth:`GetAtomList` + + :type: A list of :class:`atom handles<AtomHandle>` -.. class:: ChainHandle + .. attribute:: mass + + The total mass of this chain in Dalton. Also available as :meth:`GetMass` + + :type: float + .. attribute:: center_of_mass + + Center of mass. Also available as :meth:`GetCenterOfMass` + + :type: :class:`~ost.geom.Vec3` + + .. attribute:: center_of_atoms + + Center of atoms (not mass weighted). Also available as + :meth:`GetCenterOfAtoms`. + + :type: :class:`~ost.geom.Vec3` + .. method:: FindResidue(res_num) - Get residue by residue number. See also :meth:`GetResidueList` + Get residue by residue number. See also :attr:`residues` :param res_num: residue number :type res_num: mol.ResNum @@ -228,52 +365,1095 @@ This document describes the :class:`EntityHandle` and related classes. are usually ordered from N- to C-terminus.To access a single residue, use :meth:`FindResidue`. - :returns: A list of :class:`ResidueHandles<ResidueHandle>` + :returns: A list of :class:`residue handles<ResidueHandle>` .. method:: FindAtom(res_num, atom_name) - Get atom by residue number and atom name. See also :meth:`GetAtomList` + Get atom by residue number and atom name. See also :attr:`atoms` :param res_num: residue number :type res_num: mol.ResNum :param atom_name: atom name, e.g. CA - :type atom_name: string + :type atom_name: str :returns: A valid :class:`AtomHandle` if an atom matching the parameters could be found, an invalid :class:`AtomHandle` otherwise .. method:: GetAtomList() + + See :attr:`atoms` + + .. method:: GetName() + + See :attr:`name` - Get list of all atoms of this chain. To access a single atom, use - :meth:`FindAtom` - - :returns: A list of :class:`AtomHandles<AtomHandle>` .. class:: ResidueHandle + The residue is either used to represent complete molecules or building blocks + in a polymer, e.g. in a protein, DNA or RNA. A residue consists of one or + more :class:`atoms <AtomHandle>`. Residues are always part of a + :class:`ChainHandle`, even if they are ligands or water molecules where the + concept of a chain does not apply. + + .. attribute:: name + + The residue name is usually a str of 3 characters, e.g. `GLY` for + glycine or `ALA` for alanine, but may be shorter, e.g. `G` for guanosine, + or longer for structures loaded from formats other than PDB. + + This property is read-only. To change the name of the residue, use + :meth:`EditorBase.SetResidueName`. + + .. attribute:: number + + The number of this residue. The residue number has a numeric part and an + insertion-code. This property is read-only. Also available as + :meth:`GetNumber`. + + :type: :class:`ResNum` + + .. attribute:: one_letter_code + + For amino acids, and nucleotides the `one_letter_code` is an alpha-numeric + character. For unknown or more *exotic* residues, the one letter code is set + to '?'. + + **Example** + + This code-snippet shows how to get the sequence string from a list of + residues. + + .. code-block:: python + + print ''.join([r.one_letter_code for r in chain.residues]) + + :type: str + + .. attribute:: mass + + The total mass of this residue in Dalton. Also available as :meth:`GetMass`. + + :type: float + + .. attribute:: center_of_mass + + Center of mass. Also available as :meth:`GetCenterOfMass` + + :type: :class:`~ost.geom.Vec3` + + .. attribute:: center_of_atoms + + Center of atoms (not mass weighted). Also available as + :meth:`GetCenterOfAtoms`. + + :type: :class:`~ost.geom.Vec3` + + .. attribute:: chain + + The chain this residue belongs to. Read-only. Also available as + :meth:`GetChain` + + :type: :class:`ChainHandle` + + .. attribute:: phi_torsion + + The PHI dihedral angle between this residue and the next. For residues + that are not amino acids, residues that do not have all atoms required or + residues that do not have bonds between the four atoms involved in the + torsion, the PHI torsion is an invalid handle. + + Read-only. Also available as :meth:`GetPhiTorsion` + + :type: :class:`TorsionHandle` + + .. attribute:: psi_torsion + + The PSI dihedral angle between this residue and the previous. For residues + that are not amino acids, residues that do not have all atoms required or + residues that do not have bonds between the four atoms involved in the + torsion, the PSI torsion is an invalid handle. + + Read-only. Also available as :meth:`GetPsiTorsion` + + :type: :class:`TorsionHandle` + + .. attribute:: chem_class + + The chemical class of a residue is used to broadly categorize residues based + on their chemical properties. For example, peptides belong to the + `LPeptideLinking` or `DPeptideLinking` classes. + + .. attribute:: sec_structure + + The secondary structure of the residue. + .. method:: FindAtom(atom_name) - Get atom by atom name. See also :meth:`GetAtomList` + Get atom by atom name. See also :attr:`atoms` - :param atom_name: atom name, e.g. CA - :type atom_name: string + :param atom_name: atom name, e.g. CA + :type atom_name: str - :returns: A valid :class:`AtomHandle` if an atom with the given - name could be found, an invalid :class:`AtomHandle` - otherwise + :returns: A valid :class:`AtomHandle` if an atom with the given + name could be found, an invalid :class:`AtomHandle` + otherwise .. method:: GetAtomList() - Get list of all atoms of this residue. To access a single atom, use - :meth:`FindAtom`. + Get list of all atoms of this residue. To access a single atom, use + :meth:`FindAtom`. + + .. method:: GetChain() + + See :attr:`chain` + + .. method:: GetCenterOfAtoms() + + See :attr:`center_of_atoms` + + .. method:: GetCenterOfMass() + + See :attr:`center_of_mass` + + .. method:: GetPhiTorsion() + + See :attr:`phi_torsion` + + .. method:: GetPsiTorsion() + + See :attr:`psi_torsion` + + .. class:: AtomHandle -.. class:: EntityView - - Represents a subpart of an :class:`EntityHandle`. - + Represents an atom in a molecular structure. Atoms are always part of a + residue. + + .. attribute:: name + + The atom name, usually a capitalized string consisting of the element and + an position indicator, e.g. `G1`. In general, the atom name uniquely + identifies an atom within a residue. However, this is not enforced and there + may be more than one atoms with the same name. + + :type: str + + .. attribute:: qualified_name + + The qualified name consists of the atom name as well as a unique residue + identifier and chain name. For CA of a glycine with residue number 2 of + chain A, the qualified name is "A.GLY2.CA". + + :type: str + + .. attribute:: element + + The atom's element. Note that this may return an empty string. Also + available as :meth:`GetElement`. Read-only. + + :type: str + + .. attribute:: mass + + The atom's mass in Dalton. Also available as :meth:`GetMass`. Read-only. + + :type: float + + .. attribute:: pos + + The atom's position in global coordinates. Also available as :meth:`GetPos`. + Read-only. + + :type: :class:`~ost.geom.Vec3` + + .. attribute:: radius + + The van-der-Waals radius of the atom. Also available as :meth:`GetRadius`. + Read-only. + + :type: float + + .. attribute:: occupancy + + The atom's occupancy in the range 0 to 1. Also available as + :meth:`GetOccupancy`. Read-only. + + :type: float + .. attribute:: charge + + The atom's charge + + :type: float + + .. attribute:: residue + + The residue this atom belongs to. + + :type: :class:`ResidueHandle` + + .. attribute:: is_hetatm + + Indicates whether this atom is a hetatm. + + .. attribute:: bonds + + List of bonds this atom is involved in. The bonds are in no particular + order. Also available as :meth:`GetBondList`. + + :type: list of :class:`bond handles<BondHandle>` + + .. method:: Apply(visitor) + + Apply an entity visitor to the atom. In Python, you usually don't have to + use this method. It is mainly used in C++ to write algorithms that work on + both :class:`EntityHandle` and :class:`EntityView` at the same time. + + :param visitor: The entity visitor + :type visitor: :class:`EntityVisitor` + + .. method:: FindBondToAtom(other_atom) + + Finds and returns the bond formed between this atom and `other_atom`. If no + bond exists between the two atoms, an invalid :class:`BondHandle` is + returned. + + :param other_atom: The other atom + :type other_atom: :class:`AtomHandle` + :rtype: :class:`BondHandle` + + .. method:: GetAtomProps() + + Get atom properties such as mass, charge, element and occupancy. + + :rtype: :class:`AtomProp` + + .. method:: GetBondCount() + + :rtype: int + + .. method:: GetBondList() + + See :attr:`bonds` + + :rtype: :class:`BondHandleList` + + .. method:: GetBondPartners() + + Get list of atoms this atom is bonded with. This method exists as a shortcut + to determine all the bonding partners of an atom and avoids code like this: + + .. code-block:: python + + bond_parters=[] + for bond in atom.bonds: + if bond.first==atom: + bond_partners.append(bond.second) + else: + bond_partners.append(bond.first) + + :rtype: :class:`AtomHandleList` + + .. method:: GetCharge() + + See :attr:`charge` + + :rtype: float + + .. method:: GetElement() + + See :attr:`element` + + :rtype: str + + .. method:: GetEntity() + + The entity this atom belongs to + + :rtype: :class:`EntityHandle` + + .. method:: GetHashCode() + + Returns a unique identifier for this atom. + :rtype: int + + .. method:: GetIndex() + + Returns the index of the atom. + + :rtype: int + + .. method:: GetMass() + + See :attr:`mass` + + :rtype: float + + .. method:: GetName() + + See :attr:`name` + + :rtype: str + + .. method:: GetOriginalPos() + + :rtype: :class:`~ost.geom.Vec3` + + .. method:: GetPos() + + See :attr:`pos` + + :rtype: :class:`~ost.geom.Vec3` + + .. method:: GetQualifiedName() + + See :attr:`qualified_name` + + :rtype: str + + .. method:: GetRadius() + + See :attr:`radius` + + :rtype: float + + .. method:: GetResidue() + + See :attr:`residue` + + :rtype: :class:`ResidueHandle` + + .. method:: IsHetAtom() + + See :attr:`is_hetatm` + + :rtype: bool + + .. method:: IsValid() + + See :attr:`valid` + + :rtype: bool + +The View Classes +-------------------------------------------------------------------------------- + +.. class:: ResidueView + + .. attribute:: handle + + The residue handle this view points to. Also available as + :meth:`GetHandle`. + + :type: :class:`ResidueHandle` + +.. class:: EntityView + + .. attribute:: chains + + List of all chains of this entity. The chains are in the same + order they have been added. + + Also available as :meth:`GetChainList`. To access a single chain, use + :meth:`FindChain`. + + This property is read-only. + + .. attribute:: residues + + List of all residues of this entity. The returned residues are first + sorted by chain and then from N- to C-terminus. + + This property is read-only. + + **Example usage:** + + .. code-block:: python + + for res in ent.residues: + print res.name, res.atom_count + + Also available as :meth:`GetResidueList`. To access a single residue, use + :meth:`FindResidue`. + + :type: A list of :class:`ResidueViews <ResidueView>` + + .. attribute:: atoms + + Get list of all atoms of this entity. To access a single atom, use + :meth:`FindAtom`. + + This property is read-only. Also available as :meth:`GetAtomList` + + :type: A list of :class:`AtomViews <AtomView>` + + .. attribute:: handle + + The underlying :class:`handle <EntityHandle>` of the entity view. Also + available as :meth:`GetHandle`. + + :type: :class:`EntityHandle` + + .. method:: CreateEmptyView() + + See :meth:`EntityHandle.CreateEmptyView` + + :rtype: EntityView + + .. method:: CreateFullView() + + Returns a copy of this entity. Provided for duck-typing purposes. + + :rtype: EntityView + + .. method:: AddChain(chain_handle[, view_add_flags]) + + Add chain to view. By default, only the chain is added to the view, but not + its residues and atoms. This behaviour can be changed by passing in an + appropriate set of `view_add_flags` + + :param chain_handle: + :type chain_handle: ChainHandle + :param view_add_flags: An ORed together combination of `view_add_flags`. + :type view_add_flags: int + :rtype: class:`ChainView` + + .. method:: AddResidue(residue_handle[, view_add_flags]) + + Add residue to view. If the residue's chain is not already part of the view, + it will be added. By default, only the residue is added, but not its atoms. + This behaviour can be modified by passing in an appropriate combination of + `view_add_flags`. + + :param residue_handle: + :type residue_handle: ResidueHandle + :param view_add_flags: + :type view_add_flags: int + :rtype: class:`ResidueView` + + .. method:: AddAtom(atom_handle[, view_add_flags]) + + Add the atom to view. The chain and residue of the atom are added to the + view if they haven't already been added. + + + :param atom_handle: The atom handle + :type atom_handle: AtomHandle + :param view_add_flags: An ORed together combination of ViewAddFlags + :type view_add_flags: int + :rtype: class:`AtomView` + + .. method:: AddBond(bond_handle) + + Add bond to the view. + + :param bond_handle: Bond to be added + :type bond_handle: BondHandle + :returns: True if the bond has been added, false if the bond was already + present in the view. + :rtype: bool + + .. method:: AddAllInclusiveBonds() + + Convenience method to add all bonds to the view for which both of the bond + partners are in the view. This method is useful when manually assembling + views. + + .. method:: RemoveChain(chain) + + Remove chain and all its residues from the entity view. + + :param chain: The chain to be removed. May be invalid + :type chain: ChainView + + .. method:: RemoveResidue(residue) + + Remove residue from view. + + :param residue: The residue to be removed. May be invalid + + :type residue: ResidueView + + + .. method:: RemoveAtom(atom) + + Remove atom from view + + :param atom: The atom to be removed. May be invalid + + :type atom: AtomView + + .. method:: GetAngle(atom1, atom2, atom3) + + :param atom1: + :type atom1: AtomHandle + :param atom2: + :type atom2: AtomHandle + :param atom3: + :type atom3: AtomHandle + :rtype: float + + .. method:: FindWithin(pos, radius) + + Find all atoms that are within radius of the given position. See + :meth:`EntityHandle.FindWithin`. + + :param pos: + :type pos: :class:`~ost.geom.Vec3` + :param radius: + :type radius: float + :rtype: class:`AtomViewList` + + .. method:: FindChain(chain_name) + + Find chain by name. + + :param chain_name: + :type chain_name: str + :returns: The chain if present in the view, an invalid :class:`ChainView` + otherwise + :rtype: class:`ChainView` + + .. method:: FindResidue(residue) + + Find residue view of pointing to the given handle. + + :param residue: Residue handle + :type residue: ResidueHandle + :returns: The residue view pointing the the handle, or an invalid handle if the residue is not part of the view + :rtype: class:`ResidueView` + + .. method:: FindAtom(chain_name, res_num, atom_name) + + :param chain_name: The chain name + :type chain_name: str + :param res_num: The residue number + :type res_num: ResNum or int + :param atom_name: The name of the atom + :type atom_name: str + :rtype: class:`AtomView` + + .. method:: Select(query[, flags]) + + Perform selection on entity view. See :meth:`EntityHandle.Select`. + + :param query: The query + :type query: (:class:`Query` or str) + :param flags: An ORed together combination of ViewAddFlags + :type flags: int + + :rtype: EntityView + + .. method:: Copy() + + Returns a deep copy of the entity view. The effect is identical to calling + + .. code-block:: python + + the_copy=view.Select(') + + :rtype: EntityView + + .. method:: GetMass() + + Get total mass of view. + :rtype: float + + .. method:: GetCenterOfMass() + + Get the center of mass. For a non-mass-weighted center, see + :meth:`GetCenterOfAtoms`. + + :rtype: :class:`~ost.geom.Vec3` + + .. method:: GetGeometricCenter() + + Get the geometric center, that is the centerof the axis-aligned + bounding box. + + :rtype: :class:`~ost.geom.Vec3` + + .. method:: GetGeometricStart() + + :rtype: :class:`~ost.geom.Vec3` + + + .. attribute:: chain_count + + Number of chains. Read-only. See :meth:`GetChainCount`. + + :type: int + + .. attribute:: residue_count + + Number of residues. Read-only. See :meth:`GetResidueCount`. + + :type: int + + .. attribute:: atom_count + + Number of atoms. Read-only. See :meth:`GetAtomCount`. + + :type: int + + .. method:: GetCenterOfAtoms() + + Calculates the center of atoms. For a mass-weighted center, use + :meth:`GetCenterOfMass`. + + :rtype: :class:`~ost.geom.Vec3` + + .. method:: GetAtomList() + + See :attr:`atoms` + + :rtype: class:`AtomViewList` + + .. method:: GetBondCount() + + Get number of bonds + :rtype: int + + .. method:: GetChainCount() + + Get number chains. See :attr:`chain_count` + + :rtype: int + + .. method:: Apply(visitor) + + Apply entity visitor to view. In Python, you usually don't have to use this + method. See :meth:`EntityHandle.Apply` + + :param visitor: + :type visitor: class:`EntityVisitor` + + .. method:: GetResidueCount() + + See :attr:`residue_count` + + :rtype: int + + .. method:: GetBondList() + + See :attr:`bonds` + + :rtype: :class:`BondHandleList` + + .. method:: GetHandle() + + See :attr:`handle` + + :rtype: class:`EntityHandle` + + .. method:: GetResidueList() + + :rtype: class:`ResidueViewList` + + + .. method:: GetGeometricEnd() + + :rtype: :class:`~ost.geom.Vec3` + + .. method:: GetChainList() + + See :attr:`chains` + + :rtype: class:`ChainViewList` + + .. method:: GetAtomCount() + + Get number of atoms. See :attr`atom_count`. + :rtype: int + +.. class:: ChainView + + + .. attribute:: name + + The chain name. The name uniquely identifies the chain in the entity. In + most cases, the chain name is one character. This is restriction of the PDB + file format. However, you are free to use longer names as long as you don't + want to save them as PDB files + + This property is read-only. To change the name, use an :class:`XCSEditor`. + + Also available as :meth:`GetName` + + :type: str + + .. attribute:: residues + + List of all residues of this chain. The residues are sorted from N- to + C-terminus. Usually the residue numbers are in ascending order + (see :attr:`in_sequence`). + + This property is read-only. + + **Example usage:** + + .. code-block:: python + + chain=ent.FindChain("A") + for res in chain.residues: + print res.name, res.atom_count + + Also available as :meth:`GetResidueList`. To access a single residue, use + :meth:`FindResidue`. + + :type: A list of :class:`residue views<residueView>` + + .. attribute:: in_sequence + + Whether the residue numbers are in ascending order. For example: + + .. code-block:: python + + chain=ent.FindChain("A") + print chain.residues # [A.GLY1, A.GLY2, A.GLY4A, A.GLY4B] + print chain.in_sequence # prints true + + chain=ent.FindChain("B") + print chain.residues # [B.GLY1, B.GLY4, B.GLY3] + print chain.in_sequence # prints false + + .. attribute:: atoms + + Get list of all atoms of this chain. To access a single atom, use + :meth:`FindAtom`. + + This property is read-only. Also available as :meth:`GetAtomList` + + :type: A list of :class:`atom handles<AtomHandle>` + + .. attribute:: mass + + The total mass of this chain in Dalton. Also available as :meth:`GetMass` + + :type: float + + .. attribute:: center_of_mass + + Center of mass. Also available as :meth:`GetCenterOfMass` + + :type: :class:`~ost.geom.Vec3` + + .. attribute:: center_of_atoms + + Center of atoms (not mass weighted). Also available as + :meth:`GetCenterOfAtoms`. + + :type: :class:`~ost.geom.Vec3` + + .. attribute:: handle + + The chain handle this view points to. Also available as :meth:`GetHandle`. + + :type: :class:`ChainHandle` + + .. attribute:: in_sequence + + Whether the residue numbers are in ascending order. Note that the value of + `in_sequence` is independent from the value of + :attr:`ChainHandle.in_sequence`. + + :type: bool + + + .. method:: AddAtom(atom_handle[, view_add_flags]) + + Add atom to the view. If the residue of the atom is not already part of the + view, it will be added. If the atom does not belong to chain, the result is + undefined. + + :param atom_handle: The atom to be added + :type atom_handle: :class:`AtomHandle` + :param view_add_flags: An ORed together combination of ViewAddFlags + :type view_add_flags: int + :rtype: :class:`AtomView` + + .. method:: AddResidue(residue_handle[, view_add_flags]) + + Add residue to the view. If the atom does not belong to chain, the result is + undefined. By default, only the residue, but no atoms are added to the view. + To change the behaviour, pass in a suitable combination of `view_add_flags`. + + :param residue_handle: + :type residue_handle: :class:`ResidueHandle` + :param view_add_flags: + :type view_add_flags: int + :rtype: :class:`ResidueView` + + .. method:: FindAtom(res_num, atom_name) + + Find atom with the given residue number and atom name. + + :param res_num: The residue number + :type res_num: :class:`ResNum` + :param atom_name: The atom name + :type atom_name: str + :returns: The atom view, or an invalid atom view if no atom with the given + parameters is part of the view. + + :rtype: :class:`AtomView` + + .. method:: FindResidue(res_num) + + Find residue by residue number. + + :param res_num: + :type res_num: :class:`ResNum` + :rtype: :class:`ResidueView` + :returns: The residue view, or an invalid residue view if no residue with + the given residue number is in the view. + + + .. method:: GetCenterOfAtoms() + + See :attr:`center_of_atoms` + + .. method:: GetCenterOfMass() + + See :attr:`center_of_mass` + + .. method:: GetEntity() + + See :attr:`entity` + + + .. method:: GetGeometricCenter() + + See :attr:`geometric_center` + + + .. method:: GetHandle() + + See :attr:`handle` + + .. method:: GetMass() + + See :attr:`mass` + + .. method:: GetName() + + See :attr:`name` + + .. method:: GetResidueByIndex(index) + + Returns the residue view at `index`. If index is negative or bigger than + the number of residues minus one, an invalid ResidueView is returned. + + :param index: The index + :type index: int + :rtype: :class:`ResidueView` + + .. method:: GetResidueList() + + See :attr:`residues` + + :rtype: bool + + .. method:: InSequence() + + See :attr:`in_sequence` + + + .. method:: IsValid() + + See :attr:`valid` + + .. method:: RemoveResidue(residue) + + Remove residue from chain. If the residue is not part of the view, the + chain is left unchanged. + + :param residue: The residue view. May be invalid + :type residue: :class:`ResidueView` + :rtype: None + + .. method:: RemoveResidues() + + Remove all residues from this chain view + + .. method:: Select(query[, flags]) + + Perform query on chain. This will return an entity view containing atoms + and bonds of the residue view that match the residue. In case no atom + matches the predicate, an empty view is returned. + + :param query: The query + :type query: :class:`Query` or str + :param flags: An ORed together combination of query flags + :type flags: int + :rtype: :class:`EntityView` + + .. method:: Apply(visitor) + + Apply entity visitor to view. In Python, you usually don't have to use this + method. + + :param visitor: The visitor + :type visitor: :class:`EntityVisitor` + + +.. class:: ResidueView + + .. attribute:: name + + The residue name is usually a str of 3 characters, e.g. `GLY` for + glycine or `ALA` for alanine, but may be shorter, e.g. `G` for guanosine, + or longer for structures loaded from formats other than PDB. + + This property is read-only. To change the name of the residue, use + :meth:`EditorBase.SetResidueName`. + + .. attribute:: number + + The number of this residue. The residue number has a numeric part and an + insertion-code. This property is read-only. Also available as + :meth:`GetNumber`. + + :type: :class:`ResNum` + + .. attribute:: one_letter_code + + For amino acids, and nucleotides the `one_letter_code` is an alpha-numeric + character. For unknown or more *exotic* residues, the one letter code is set + to '?'. + + **Example** + + This code-snippet shows how to get the sequence string from a list of + residues. + + .. code-block:: python + + print ''.join([r.one_letter_code for r in chain.residues]) + + :type: str + + .. attribute:: mass + + The total mass of this residue in Dalton. Also available as :meth:`GetMass`. + + :type: float + + .. attribute:: center_of_mass + + Center of mass. Also available as :meth:`GetCenterOfMass` + + :type: :class:`~ost.geom.Vec3` + + .. attribute:: center_of_atoms + + Center of atoms (not mass weighted). Also available as + :meth:`GetCenterOfAtoms`. + + :type: :class:`~ost.geom.Vec3` + + .. attribute:: chain + + The chain this residue belongs to. Read-only. Also available as + :meth:`GetChain` + + :type: :class:`ChainView` + + .. attribute:: handle + + The residue handle this view points to + + :type: :class:`ResidueHandle` + + .. method:: RemoveAtom(atom_view) + + Remove atom from residue and all associated bonds. If the atom is not part + of the view, the residue view is left unchanged. + + :param atom_view: The atom to be removed. May be an invalid handle + :type atom_view: :class:`AtomView` + :rtype: None + + .. method:: GetHandle() + + See :attr:`handle` + + .. method:: GetMass() + + See :attr:`mass` + + .. method:: GetChain() + + See :attr:`chain` + + .. method:: FindAtom(atom_name) + + Find atom by name. Returns the atom, or an invalid atom if no atoms with + the given name is part of the view. + + :param atom_name: + :type atom_name: str + :rtype: :class:`AtomView` + + .. method:: GetIndex() + + See :attr:`index` + + .. method:: GetCenterOfMass() + + See :attr:`center_of_mass` + + .. method:: IsAtomIncluded(atom_handle) + + Returns true if the given atom is part of the view, false if not. + + :param atom_handle: + :type atom_handle: :class:`AtomHandle` + :rtype: bool + + .. method:: GetGeometricCenter() + + See :attr:`geometric_center` + + .. method:: AddAtom(atom_handle[, flags]) + + Add atom to the view. + :param atom_handle: + :type atom_handle: :class:`AtomHandle` + :param flags: An ORed together combination of ViewAddFlags. + :type flags: int + :rtype: :class:`AtomView` + + .. method:: GetCenterOfAtoms() + + See :attr:`center_of_atoms` + + .. method:: GetAtomList() + + See :attr:`atoms` + + .. method:: Apply(visitor) + + Apply entity visitor to the residue. In Python, you don't have to use this + method. Is is mainly used in C++. + + :param visitor: + :type visitor: :class:`EntityVisitor` + + .. method:: Select(query[, flags]) + + Perform selection on residue view. This method will return an entity view + containing all atoms and bonds of the residue matching the predicate. In + case no atom matches the predicate, this will return an empty view. + + :param query: The query + :type query: :class:`Query` or str + :param flags: An ORed together combination of query flags + :type flags: int + :rtype: :class:`EntityView` + + Functions -------------------------------------------------------------------------------- diff --git a/modules/mol/base/pymod/export_atom.cc b/modules/mol/base/pymod/export_atom.cc index 43e7483a79f7984d348bb85d5bd83be58e785325..90449eda7c904fb671339a83af66929fa375b672 100644 --- a/modules/mol/base/pymod/export_atom.cc +++ b/modules/mol/base/pymod/export_atom.cc @@ -79,6 +79,7 @@ void export_Atom() .def("Apply", &AtomHandle::Apply, args("visitor")) .def("GetBondList", &AtomHandle::GetBondList) .def("GetBondCount", &AtomHandle::GetBondCount) + .add_property("valid", &AtomHandle::IsValid) .def("GetEntity", &AtomHandle::GetEntity) .def("GetHandle", &AtomHandle::GetHandle) .add_property("handle", &AtomHandle::GetHandle) diff --git a/modules/mol/base/pymod/export_atom_view.cc b/modules/mol/base/pymod/export_atom_view.cc index bdee6609db8e34db9a52d055ebeac7a4547d3ae0..3b468326437cef638ccada5e24a831f1fb621256 100644 --- a/modules/mol/base/pymod/export_atom_view.cc +++ b/modules/mol/base/pymod/export_atom_view.cc @@ -42,6 +42,7 @@ void export_AtomView() .def("RemoveBonds", &AtomView::RemoveBonds) .def("GetHandle", &AtomView::GetHandle) .def("GetBondCount", &AtomView::GetBondCount) + .add_property("valid", &AtomView::IsValid) .def("GetBondList", &AtomView::GetBondList) .def("GetHashCode", &AtomView::GetHashCode) .def("__hash__", &AtomView::GetHashCode) diff --git a/modules/mol/base/pymod/export_chain.cc b/modules/mol/base/pymod/export_chain.cc index fe2019d3affbe500583a2873ab17df6f17b3f900..35c6b7acc1fe2677dfa5bfcd1ce65e3958b19986 100644 --- a/modules/mol/base/pymod/export_chain.cc +++ b/modules/mol/base/pymod/export_chain.cc @@ -86,6 +86,11 @@ void export_Chain() .def("GetCenterOfAtoms", &ChainHandle::GetCenterOfAtoms) .def("GetGeometricCenter", &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("GetGeometricEnd", &ChainHandle::GetGeometricEnd) ; diff --git a/modules/mol/base/pymod/export_chain_view.cc b/modules/mol/base/pymod/export_chain_view.cc index fa8446a5057b6140f27b79742b7bc6876ff4fae2..c0c1e732468c37897ee40d9325d2bbc26d74fa41 100644 --- a/modules/mol/base/pymod/export_chain_view.cc +++ b/modules/mol/base/pymod/export_chain_view.cc @@ -99,6 +99,11 @@ void export_ChainView() .def("GetCenterOfAtoms", &ChainView::GetCenterOfAtoms) .def("GetGeometricCenter", &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("GetGeometricEnd", &ChainView::GetGeometricEnd) ; diff --git a/modules/mol/base/pymod/export_entity.cc b/modules/mol/base/pymod/export_entity.cc index 733c867d66e3e3231bda88d8ce9a542596ab2aae..8cda03816c5c82678682645bf4519bd80dea84c7 100644 --- a/modules/mol/base/pymod/export_entity.cc +++ b/modules/mol/base/pymod/export_entity.cc @@ -95,6 +95,9 @@ void export_Entity() .add_property("chain_count", &EntityHandle::GetChainCount) .add_property("residue_count", &EntityHandle::GetResidueCount) .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("GetAngle", get_angle1) .def("GetAngle", get_angle2) @@ -108,6 +111,7 @@ void export_Entity() .add_property("atoms", &EntityHandle::GetAtomList) .add_property("chains", &EntityHandle::GetChainList) .add_property("bonds", &EntityHandle::GetBondList) + .add_property("valid", &EntityHandle::IsValid) .def("GetTransformationMatrix", &EntityHandle::GetTransformationMatrix, return_value_policy<copy_const_reference>()) .add_property("transform", diff --git a/modules/mol/base/pymod/export_entity_view.cc b/modules/mol/base/pymod/export_entity_view.cc index 293401f1c16c211c1155b6f6008f714865a5e42b..0d1da4f85572818b8fa205221fa58a49875db159 100644 --- a/modules/mol/base/pymod/export_entity_view.cc +++ b/modules/mol/base/pymod/export_entity_view.cc @@ -119,6 +119,10 @@ void export_EntityView() .add_property("residue_count", &EntityView::GetResidueCount) .add_property("atom_count", &EntityView::GetAtomCount) .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("GetAtomList", &EntityView::GetAtomList) .add_property("atoms", &EntityView::GetAtomList) diff --git a/modules/mol/base/pymod/export_residue.cc b/modules/mol/base/pymod/export_residue.cc index 0c28df65249210b61a1546f6895f3c343f393f7b..5334fb2baba3f277d0664357894d7e84c03ebadb 100644 --- a/modules/mol/base/pymod/export_residue.cc +++ b/modules/mol/base/pymod/export_residue.cc @@ -109,6 +109,8 @@ void export_Residue() &ResidueBase::SetOneLetterCode) .def("GetQualifedName", &ResidueBase::GetQualifiedName) .def("IsPeptideLinking", &ResidueBase::IsPeptideLinking) + .add_property("peptide_linking", &ResidueBase::IsPeptideLinking) + .def("GetKey", &ResidueBase::GetKey, return_value_policy<copy_const_reference>()) .def("GetName", &ResidueBase::GetName, @@ -165,7 +167,14 @@ void export_Residue() .def("GetCenterOfMass", &ResidueHandle::GetCenterOfMass) .def("GetCenterOfAtoms", &ResidueHandle::GetCenterOfAtoms) .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("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("GetGeometricEnd", &ResidueHandle::GetGeometricEnd) .def(self==self) diff --git a/modules/mol/base/pymod/export_residue_view.cc b/modules/mol/base/pymod/export_residue_view.cc index a23bcf88d418a6110ce291278bdf090272ca29df..13695ba9c5cf11a392ad17853050e18f452a409c 100644 --- a/modules/mol/base/pymod/export_residue_view.cc +++ b/modules/mol/base/pymod/export_residue_view.cc @@ -69,7 +69,7 @@ void export_ResidueView() .def("IsAtomIncluded", &ResidueView::IsAtomIncluded, args("atom_handle")) .def("Apply", apply1, args("visitor")) .def("Apply", apply2, args("visitor")) - .def("GetIndex", &ResidueView::GetIndex) + .def("GetIndex", &ResidueView::GetIndex) .add_property("chain", &ResidueView::GetChain) .add_property("entity", &ResidueView::GetEntity) .add_property("index", &ResidueView::GetIndex) @@ -85,7 +85,11 @@ void export_ResidueView() .def("GetCenterOfMass", &ResidueView::GetCenterOfMass) .def("GetCenterOfAtoms", &ResidueView::GetCenterOfAtoms) .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("valid", &ResidueView::IsValid) .def("GetGeometricStart", &ResidueView::GetGeometricStart) .def("GetGeometricEnd", &ResidueView::GetGeometricEnd) ;