Protein Data Bank objects (dockerasmus.pdb)

Protein (dockerasmus.pdb.protein)

class dockerasmus.pdb.Protein(id=None, name=None, chains=None)[source]
classmethod from_pdb(handle)[source]

Create a new Protein object from a PDB file handle.

Parameters:handle (file handle) – a file-like object opened in binary read mode (must be line-by-line iterable).
classmethod from_pdb_file(path)[source]

Create a new Protein object from a PDB file.

Parameters:path (str) – the path to a PDB protein file (supports gzipped or plain text PDB files).
mass

The mass of the protein.

Warning

Computed as the sum of the masses of the residues of the chain (it does not take the masses of the atoms in the peptidic bound into account).

mass_center

The position of mass center of the protein.

\[\begin{split}mc &= \sum_{i}{\frac{w_i}{W} \begin{pmatrix} x_i \\ y_i \\ z_i \end{pmatrix} }\end{split}\]

where \(i\) is the index of each atom, \(x_i\) (resp. \(y_i\)) (resp. \(z_i\)) if the abcissa (resp. ordinate) (resp. height) of the atom \(i\) in the worldspace, and \(W = \sum_i{w_i}\) the approximated mass of the whole protein.

Warning

Uses Protein.mass, so only the atoms on the residues of each aminoacid are used for the computation.

radius

The radius of the sphere the protein would fit in.

Equals to the norm of the position of the atom of the protein farthest from its mass center.

atom_charges()[source]

The vector of the charge of each atom of the protein.

atom_pwd()[source]

The vector of the potential well depth of each atom of the protein.

atom_positions()[source]

The matrix of the positions of each atom of the protein.

atom_radius()[source]

The vector of the Van der Waals radius of each atom of the protein.

contact_map(other, mode='nearest')[source]

Return a 2D contact map between residues of self and other.

Parameters:other (Protein) – the other protein with which to create a contact map (chains/residues/atoms must have the same names in both proteins)
Keyword Arguments:
 mode (str) – how to compute the contact map. Available modes are: 'nearest' (the distance between the two closest atoms of the two residues), 'farthest' (the distance between the two farthest atoms of the two residues) or 'mass_center' (the distance between the mass center of the two residues).
atom(atom_id)[source]

Get atom of self with id atom_id.

Raises:KeyError – when no Atom has the given id.
residue(res_id)[source]

Get residue of self with id res_id.

Raises:KeyError – when no Residue has the given id.
copy()[source]

Return a deep copy of self.

iteratoms()[source]

Yield every atom in self.

Yields:Atom – every atom of the protein, ordered by the id of their chain and the id of their residue.
interface(other, distance=4.5)[source]

Return couples of residues of self interfacing with other.

Yields:
tuple - a (Residue, Residue) couple where the first element

is a residue of self and the second a residue of other only if two or more of their respective aminoacids are closer than distance.

nearest_atom(pos)[source]

Return the atom nearest to the position pos.

rmsd(other)[source]

Chain (dockerasmus.pdb.chain)

class dockerasmus.pdb.Chain(id, name=None, residues=None)[source]
mass

The mass of the chain.

Warning

Computed as the sum of the masses of the residues of the chain (it does not take the masses of the atoms in the peptidic bound into account).

Residue (dockerasmus.pdb.residue)

class dockerasmus.pdb.Residue(id, name=None, atoms=None)[source]
mass

The mass of the residue.

Computed as sum of the masses of the non-hydrogen atoms of the residue.

mass_center

The position of the mass center of the residue.

Computed as the barycenter of the positions of the atoms weighted by their atomic masses.

distance_to(other)[source]

The distance of the mass center of the residue to other

rmsd(ref)[source]

The RMSD of the atoms of the residue, with ref as reference.

Parameters:ref (numpy.ndarray or list) – the x,y,z coordinates of the reference position.

Atom (dockerasmus.pdb.atom)

class dockerasmus.pdb.Atom(x, y, z, id, name=None, residue=None)[source]
charge

The electrostatic charge of the atom.

pwd

The well depth of the Lennard-Jones potential of the atom.

mass

The mass of the atom.

pos

The position of the atom.

radius

The optimal Van der Waals radius of the atom (empirical).

distance_to(other)[source]

Computes the distance to other.

Parameters:

other (numpy.ndarray) – the position to compute the distance to (must be array-like of dimension 3)

Raises:
nearest(other_atom)[source]

The nearest other_atom in self.residue.

Parameters:other_atom (str) – the name of the other atom to find (can be a generic atom such as ‘C’, ‘O’, ‘N’, etc. or a specific atom such as ‘CA’, ‘OH1’, etc.).
Example: Carbon atom nearest to the oxygen atom in an arginine
>>> oxygen = arginine["O"]
>>> oxygen.nearest("C")
Atom 36(13.559, 86.257, 95.222)
>>> arginine["C"]
Atom 36(13.559, 86.257, 95.222)
Raises:ValueError – when no residue is set or when other_atom cannot be found in the residue.