Package csb :: Package bio :: Package structure
[frames] | no frames]

Package structure

source code

3D and secondary structure APIs.

This module defines some of the most fundamental abstractions in the library: Structure, Chain, Residue and Atom. Instances of these objects may exist independently and that is perfectly fine, but usually they are part of a Composite aggregation. The root node in this Composite is a Structure (or Ensemble). Structures are composed of Chains, and each Chain is a collection of Residues. The leaf node is Atom.

All of these objects implement the base AbstractEntity interface. Therefore, every node in the Composite can be transformed:

>>> r, t = [rotation matrix], [translation vector]
>>> entity.transform(r, t)

and it knows its immediate children:

>>> entity.items
<iterator>    # over all immediate child entities

If you want to traverse the complete Composite tree, starting at arbitrary level, and down to the lowest level, use one of the CompositeEntityIterators. Or just call AbstractEntity.components:

>>> entity.components()
<iterator>   # over all descendants, of any type, at any level
>>> entity.components(klass=Residue)
<iterator>   # over all Residue descendants

Some of the inner objects in this hierarchy behave just like dictionaries (but are not):

>>> structure.chains['A']       # access chain A by ID
<Chain A: Protein>
>>> structure['A']              # the same
<Chain A: Protein>
>>> residue.atoms['CS']          
<Atom: CA>                      # access an atom by its name
>>> residue.atoms['CS']          
<Atom: CA>                      # the same

Others behave like list collections:

>>> chain.residues[10]               # 1-based access to the residues in the chain
<ProteinResidue [10]: PRO 10>
>>> chain[10]                        # 0-based, list-like access
<ProteinResidue [11]: GLY 11>

Step-wise building of Ensembles, Chains and Residues is supported through a number of append methods, for example:

>>> residue = ProteinResidue(401, ProteinAlphabet.ALA)
>>> s.chains['A'].residues.append(residue)

See EnsembleModelsCollection, StructureChainsTable, ChainResiduesCollection and ResidueAtomsTable for more details.

Some other objects in this module of potential interest are the self-explanatory SecondaryStructure and TorsionAngles.

Classes
  AbstractEntity
Base class for all protein structure entities.
  AlignmentArgumentLengthError
  AngleUnits
Torsion angle unit types
  Atom
Represents a single atom in space.
  AtomNotFoundError
  Broken3DStructureError
  BrokenSecStructureError
  Chain
Represents a polymeric chain.
  ChainNotFoundError
  ChainResiduesCollection
  ChemElements
Periodic table elements
  CompositeEntityIterator
Iterates over composite AbstractEntity hierarchies.
  ConfinedEntityIterator
Iterates over composite AbstractEntity hierarchies, but terminates the traversal of a branch once a specific node type is encountered.
  DisorderedAtom
A wobbling atom, which has alternative locations.
  DuplicateAtomIDError
  DuplicateChainIDError
  DuplicateModelIDError
  DuplicateResidueIDError
  Ensemble
Represents an ensemble of multiple Structure models.
  EnsembleModelsCollection
  EntityIndexError
  EntityNotFoundError
  InvalidOperation
  Missing3DStructureError
  NucleicResidue
Represents a single nucleotide residue.
  ProteinResidue
Represents a single amino acid residue.
  Residue
Base class representing a single residue.
  ResidueAtomsTable
Represents a collection of atoms.
  SecStructures
Secondary structure types
  SecondaryStructure
Describes the secondary structure of a chain.
  SecondaryStructureElement
Describes a Secondary Structure Element.
  Structure
Represents a single model of a PDB 3-Dimensional molecular structure.
  StructureChainsTable
  SuperimposeInfo
Describes a structural alignment result.
  TorsionAngles
Describes a collection of phi, psi and omega backbone torsion angles.
  TorsionAnglesCollection
Describes a collection of torsion angles.
  UnknownResidue
  UnknownSecStructureError
Variables
  __package__ = 'csb.bio.structure'