Hierarchical Views
This module defines HierView class that builds a hierarchical
views of atom groups.
-
class HierView(atoms, **kwargs)[source]
Hierarchical views can be generated for AtomGroup and
Selection instances. Indexing a HierView instance
returns a Chain instance.
Some object methods are customized as follows:
Note that when an AtomGroup instance have distinct segments,
they will be considered when building the hierarchical view.
A Segment instance will be generated for each distinct segment
name. Then, for each segment chains and residues will be evaluated.
Having segments in the structure will not change most behaviors of this
class, except indexing. For example, when indexing a hierarchical view
for chain P in segment PROT needs to be indexed as hv['PROT', 'P'].
-
getAtoms()[source]
Return atoms for which the hierarchical view was built.
-
getChain(chid, segname=None)[source]
Return chain with identifier chid, if it is present.
-
getResidue(chid, resnum, icode=None, segname=None)[source]
Return residue with number resnum and insertion code icode from
the chain with identifier chid in segment with name segname.
-
getSegment(segname)[source]
Return segment with name segname, if it is present.
-
iterChains()[source]
Yield chains.
-
iterResidues()[source]
Yield residues.
-
iterSegments()[source]
Yield segments.
-
numChains()[source]
Return number of chains.
-
numResidues()[source]
Return number of residues.
-
numSegments()[source]
Return number of chains.
-
update(**kwargs)[source]
Update (or build) hierarchical view of atoms. This method is called
at instantiation, but can be used to rebuild the hierarchical view when
attributes of atoms change.