Bio.PDB.Entity module

Base class for Residue, Chain, Model and Structure classes.

It is a simple container class, with list and dictionary like properties.

class Bio.PDB.Entity.Entity(id)

Bases: object

Basic container object for PDB hierarchy.

Structure, Model, Chain and Residue are subclasses of Entity. It deals with storage and lookup.

__init__(id)

Initialize the class.

__len__()

Return the number of children.

__getitem__(id)

Return the child with given id.

__delitem__(id)

Remove a child.

__contains__(id)

Check if there is a child element with the given id.

__iter__()

Iterate over children.

__eq__(other)

Test for equality. This compares full_id including the IDs of all parents.

__ne__(other)

Test for inequality.

__gt__(other)

Test greater than.

__ge__(other)

Test greater or equal.

__lt__(other)

Test less than.

__le__(other)

Test less or equal.

__hash__()

Hash method to allow uniqueness (set).

property id

Return identifier.

get_level()

Return level in hierarchy.

A - atom R - residue C - chain M - model S - structure

set_parent(entity)

Set the parent Entity object.

detach_parent()

Detach the parent.

detach_child(id)

Remove a child.

add(entity)

Add a child to the Entity.

insert(pos, entity)

Add a child to the Entity at a specified position.

get_iterator()

Return iterator over children.

get_list()

Return a copy of the list of children.

has_id(id)

Check if a child with given id exists.

get_parent()

Return the parent Entity object.

get_id()

Return the id.

get_full_id()

Return the full id.

The full id is a tuple containing all id’s starting from the top object (Structure) down to the current object. A full id for a Residue object e.g. is something like:

(“1abc”, 0, “A”, (” “, 10, “A”))

This corresponds to:

Structure with id “1abc” Model with id 0 Chain with id “A” Residue with id (” “, 10, “A”)

The Residue id indicates that the residue is not a hetero-residue (or a water) because it has a blank hetero field, that its sequence identifier is 10 and its insertion code “A”.

transform(rot, tran)

Apply rotation and translation to the atomic coordinates.

Parameters
  • rot (3x3 NumPy array) – A right multiplying rotation matrix

  • tran (size 3 NumPy array) – the translation vector

Examples

This is an incomplete but illustrative example:

from numpy import pi, array
from Bio.PDB.vectors import Vector, rotmat
rotation = rotmat(pi, Vector(1, 0, 0))
translation = array((0, 0, 1), 'f')
entity.transform(rotation, translation)
center_of_mass(geometric=False)

Return the center of mass of the Entity as a numpy array.

If geometric is True, returns the center of geometry instead.

copy()

Copy entity recursively.

__annotations__ = {}
class Bio.PDB.Entity.DisorderedEntityWrapper(id)

Bases: object

Wrapper class to group equivalent Entities.

This class is a simple wrapper class that groups a number of equivalent Entities and forwards all method calls to one of them (the currently selected object). DisorderedResidue and DisorderedAtom are subclasses of this class.

E.g.: A DisorderedAtom object contains a number of Atom objects, where each Atom object represents a specific position of a disordered atom in the structure.

__init__(id)

Initialize the class.

__getattr__(method)

Forward the method call to the selected child.

__getitem__(id)

Return the child with the given id.

__setitem__(id, child)

Add a child, associated with a certain id.

__contains__(id)

Check if the child has the given id.

__iter__()

Return the number of children.

__len__()

Return the number of children.

__sub__(other)

Subtraction with another object.

__gt__(other)

Return if child is greater than other.

__ge__(other)

Return if child is greater or equal than other.

__lt__(other)

Return if child is less than other.

__le__(other)

Return if child is less or equal than other.

copy()

Copy disorderd entity recursively.

get_id()

Return the id.

disordered_has_id(id)

Check if there is an object present associated with this id.

detach_parent()

Detach the parent.

get_parent()

Return parent.

set_parent(parent)

Set the parent for the object and its children.

disordered_select(id)

Select the object with given id as the currently active object.

Uncaught method calls are forwarded to the selected child object.

disordered_add(child)

Add disordered entry.

This is implemented by DisorderedAtom and DisorderedResidue.

disordered_remove(child)

Remove disordered entry.

This is implemented by DisorderedAtom and DisorderedResidue.

is_disordered()

Return 2, indicating that this Entity is a collection of Entities.

disordered_get_id_list()

Return a list of id’s.

disordered_get(id=None)

Get the child object associated with id.

If id is None, the currently selected child is returned.

__annotations__ = {}
disordered_get_list()

Return list of children.