Bio.PDB.Atom module

Atom class, used in Structure objects.

class Bio.PDB.Atom.Atom(name, coord, bfactor, occupancy, altloc, fullname, serial_number, element=None, pqr_charge=None, radius=None)

Bases: object

Define Atom class.

The Atom object stores atom name (both with and without spaces), coordinates, B factor, occupancy, alternative location specifier and (optionally) anisotropic B factor and standard deviations of B factor and positions.

In the case of PQR files, B factor and occupancy are replaced by atomic charge and radius.

__init__(self, name, coord, bfactor, occupancy, altloc, fullname, serial_number, element=None, pqr_charge=None, radius=None)

Initialize Atom object.

Parameters
  • name (string) – atom name (eg. “CA”). Note that spaces are normally stripped.

  • coord (Numeric array (Float0, size 3)) – atomic coordinates (x,y,z)

  • bfactor (number) – isotropic B factor

  • occupancy (number) – occupancy (0.0-1.0)

  • altloc (string) – alternative location specifier for disordered atoms

  • fullname (string) – full atom name, including spaces, e.g. ” CA “. Normally these spaces are stripped from the atom name.

  • element (uppercase string (or None if unknown)) – atom element, e.g. “C” for Carbon, “HG” for mercury,

  • pqr_charge (number) – atom charge

  • radius (number) – atom radius

__eq__(self, other)

Test equality.

__ne__(self, other)

Test inequality.

__gt__(self, other)

Test greater than.

__ge__(self, other)

Test greater or equal.

__lt__(self, other)

Test less than.

__le__(self, other)

Test less or equal.

__hash__(self)

Return atom full identifier.

__repr__(self)

Print Atom object as <Atom atom_name>.

__sub__(self, other)

Calculate distance between two atoms.

Parameters

other (L{Atom}) – the other atom

Examples

This is an incomplete but illustrative example:

distance = atom1 - atom2
set_serial_number(self, n)

Set serial number.

set_bfactor(self, bfactor)

Set isotroptic B factor.

set_coord(self, coord)

Set coordinates.

set_altloc(self, altloc)

Set alternative location specifier.

set_occupancy(self, occupancy)

Set occupancy.

set_sigatm(self, sigatm_array)

Set standard deviation of atomic parameters.

The standard deviation of atomic parameters consists of 3 positional, 1 B factor and 1 occupancy standard deviation.

Parameters

sigatm_array (Numeric array (length 5)) – standard deviations of atomic parameters.

set_siguij(self, siguij_array)

Set standard deviations of anisotropic temperature factors.

Parameters

siguij_array (Numeric array (length 6)) – standard deviations of anisotropic temperature factors.

set_anisou(self, anisou_array)

Set anisotropic B factor.

Parameters

anisou_array (Numeric array (length 6)) – anisotropic B factor.

set_charge(self, pqr_charge)

Set charge.

set_radius(self, radius)

Set radius.

flag_disorder(self)

Set the disordered flag to 1.

The disordered flag indicates whether the atom is disordered or not.

is_disordered(self)

Return the disordered flag (1 if disordered, 0 otherwise).

set_parent(self, parent)

Set the parent residue.

Arguments:
  • parent - Residue object

detach_parent(self)

Remove reference to parent.

get_sigatm(self)

Return standard deviation of atomic parameters.

get_siguij(self)

Return standard deviations of anisotropic temperature factors.

get_anisou(self)

Return anisotropic B factor.

get_parent(self)

Return parent residue.

get_serial_number(self)

Return the serial number.

get_name(self)

Return atom name.

get_id(self)

Return the id of the atom (which is its atom name).

get_full_id(self)

Return the full id of the atom.

The full id of an atom is a tuple used to uniquely identify the atom and consists of the following elements: (structure id, model id, chain id, residue id, atom name, altloc)

get_coord(self)

Return atomic coordinates.

get_bfactor(self)

Return B factor.

get_occupancy(self)

Return occupancy.

get_fullname(self)

Return the atom name, including leading and trailing spaces.

get_altloc(self)

Return alternative location specifier.

get_level(self)

Return level.

get_charge(self)

Return charge.

get_radius(self)

Return radius.

transform(self, rot, tran)

Apply rotation and translation to the atomic coordinates.

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

  • tran (size 3 Numeric 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')
atom.transform(rotation, translation)
get_vector(self)

Return coordinates as Vector.

Returns

coordinates as 3D vector

Return type

Bio.PDB.Vector class

copy(self)

Create a copy of the Atom.

Parent information is lost.

class Bio.PDB.Atom.DisorderedAtom(id)

Bases: Bio.PDB.Entity.DisorderedEntityWrapper

Contains all Atom objects that represent the same disordered atom.

One of these atoms is “selected” and all method calls not caught by DisorderedAtom are forwarded to the selected Atom object. In that way, a DisorderedAtom behaves exactly like a normal Atom. By default, the selected Atom object represents the Atom object with the highest occupancy, but a different Atom object can be selected by using the disordered_select(altloc) method.

__init__(self, id)

Create DisorderedAtom.

Arguments:
  • id - string, atom name

__iter__(self)

Iterate through disordered atoms.

__repr__(self)

Return disordered atom identifier.

disordered_add(self, atom)

Add a disordered atom.