Class to define and manipulate protein structures

class ProtRep_Biopy.BioPyAtom(atom)[source]

A class representing an atom, as read from a PDB file using Biopython.

change_init_position()[source]

Change initial position co-ordinates of atom to current position.

Return:
new initial position co-ordinates of atom.
copy()[source]
Return:
Copy of the Atom instance.
distance_from_atom(atom)[source]
Return:
Distance from another atom.
distance_from_init_position()[source]
Return:
Distance from initial position.
get_id_no()[source]
Return:
string of atom serial number.
get_mass()[source]
Return:
Atom mass.
get_name()[source]

atom name (ie. ‘CA’ or ‘O’)

Return:
atom name.
get_pos_mass()[source]
Return:
An array containing Vector instances containing 3D coordinates of the atom and and its corresponding mass.
get_pos_vector()[source]
Return:
Vector instance containing 3D coordinates of the atom.
get_res()[source]
Return:
three letter residue code corresponding to the atom (i.e ‘ARG’).
get_res_no()[source]
Return:
residue number corresponding to the atom.
get_x()[source]
Return:
x co-ordinate of atom.
get_y()[source]
Return:
y co-ordinate of atom.
get_z()[source]
Return:
z co-ordinate of atom.
map_grid_position(densMap)[source]
Arguments:
densMap
EM map object consisting the 3D grid of density values.
Return:
The co-ordinates and density value of the grid point in a density map closest to this atom. Return 0 if atom is outside of map.
matrix_transform(rot_mat)[source]

Transform atom using a 3x3 matrix

Arguments:
rot_mat
a 3x3 matrix instance.
Return:
Transformed position of atom object
reset_position()[source]

Translate atom back in its initial position.

Return:
initial position co-ordinates of atom.
rotate_by_quaternion(q_param)[source]
set_x(mod)[source]

Change the x co-ordinate of an atom based on the argument.

Arguments:
mod
float value
Return:
new x co-ordinate
set_y(mod)[source]

Change the y co-ordinate of an atom based on the argument.

Arguments:
mod
float value
Return:
new y co-ordinate
set_z(mod)[source]

Change the z co-ordinate of an atom based on the argument.

Arguments:
mod
float value
Return:
new x co-ordinate
translate(x, y, z)[source]

Translate the atom.

Arguments:

x, y, z
distance in Angstroms in respective directions to move atom.
Return:
Translate atom object.
write_to_PDB()[source]

Writes a PDB ATOM record based in the atom attributes to a file.

class ProtRep_Biopy.BioPy_Structure(atomList, filename='Unknown', header='', footer='')[source]

A class representing a bjectStructure o, as read from a PDB file using Bio.PDB in Biopython.

RMSD_from_init_position(CA=False)[source]

Return RMSD of structure from initial position after translation.

Arguments:
CA
True will consider only CA atoms. False will consider all atoms.
Return:
RMSD in angstrom
RMSD_from_same_structure(otherStruct, CA=False, write=True)[source]

Return the RMSD between two structure instances.

Arguments:
otherStruct
Structure instance to compare, containing the same number of atoms as the target instance.
CA
True will consider only CA atoms. False will consider all atoms.
Return:
RMSD in angstrom
break_into_segments(rigid_list, chain='')[source]

Return a list of Structure instance based on the rigid body list.

Arguments:

rigid list

list of rigid body defined as:

[[riA,rfA],..,[riB,rfB]]

where :

riA is the starting residues number of segment A. rfA is the final residues number of segment A.
Return:
List of TEMPy Structure instance
calculate_centre_of_mass()[source]
Return:
Center of mass of structure as a Vector instance.
calculate_centroid()[source]

Return centre of mass of structure as a Vector instance.

change_init_position()[source]

Change initial position of structure to current position.

combine_SSE_structures(structList)[source]

Combine a list of Structure instance into one and return a new Structure instance.

Arguments:
structList
list of Structure instance
Return:
New Structure Instance
combine_structures(structList)[source]

Add a list of Structure instance to the existing structure.

Arguments:
structList
list of Structure instance
Return:
New Structure Instance
copy()[source]
Return:
Copy of Structure instance.
find_same_atom(atom_index, otherStruct)[source]

Find if an atom exists in the compared structure, based on atom index.

Arguments:
atom_index
atom number
otherStruct
a structure object to compare
Return:
If a match is found, it returns the atom object; else it returns a string reporting the mismatch.
get_CAonly()[source]
Return:
Structure instance with only the backbone atoms in structure.
get_atom(index)[source]

Return specific atom in Structure instance.

Arguments:
index
Index of the atom
Return:
Returns an Atom instance.
get_atom_list()[source]
Return:
An array containing Atom instances of positions of all atoms as: [(RES 1 A: x,y,z), … ,(RES2 1 A: x1,y1,z1)].
get_backbone()[source]
Return:
Structure instance with only the backbone atoms in structure.
get_chain(chainID)[source]
Return:
New Structure instance with only the requested chain.
get_chain_ca(chainID)[source]
get_chain_list()[source]
Return:
A list of chain ID.
get_extreme_values()[source]
Return:
A 6-tuple containing the minimum and maximum of x, y and z co-ordinates of the structure. Given in order (min_x, max_x, min_y, max_y, min_z, max_z).
get_pos_mass_list()[source]
Return:
Array containing Vector instances of positions of all atoms and mass.
get_prot_mass_from_atoms()[source]

Calculates Mass (kDa) of the Structure instance, from average mass. Atoms based use get_prot_mass_from_res is more accurate.

get_prot_mass_from_res(Termini=False)[source]

Calculates Mass (kDa) of the Structure instance, from average mass

get_residue(resNo)[source]

Get the residue corresponding to the residue number.

Arguments:
resNo
Residues number
Return:
Returns a Residues instance.
get_rgyration()[source]
get_selection(startRes, finishRes, chain='')[source]

Get a new Structure instance for the selected residues range without considering residues chain.

Arguments:
startRes
Start residue number
finishRes
End residue number
Return:
New Structure instance
get_selection_less_than(endRes)[source]

Get a Structure instance comprising all residues with their residue numbers less than endRes.

Arguments:
endRes
a residue number
Return:
A Structure instance
get_selection_more_than(startRes)[source]

Get a Structure instance comprising all residues with their residue numbers greater than startRes.

Arguments:
startRes
a residue number
Return:
A Structure instance
get_torsion_angles()[source]
Return:
List of torsion angles in Structure instance.
get_vector_list()[source]
Return:
Array containing 3D Vector instances of positions of all atoms.
matrix_transform(matrix)[source]

Transform Structure using a 3x3 transformation matrix

Arguments:
rot_mat
a 3x3 matrix instance.
Return:
Transformed position of Structure object
no_of_chains()[source]
Return:
the number of chains in the Structure object
randomise_position(max_trans, max_rot, v_grain=30, rad=False, verbose=False)[source]

Randomise the position of the Structure instance using random rotations and translations.

Arguments:
max_trans
Maximum translation permitted
max_rot
Maximum rotation permitted (in degree if rad=False)
v_grain
Graning Level for the generation of random vetors (default=30)
Return:
Transformed position of Structure object
rename_chains(chain_list=False)[source]

Rename chain name based on the list of new chain names

Arguments:
chain_list
List of chain names If False rename in alphabetical order.
renumber_atoms(start_num=1)[source]

Renumber the atoms in the structure. After renumbering the starting atom number will be 1 unless start_num

renumber_residues(startRes=1, missingRes=[])[source]

Renumber the structure starting from startRes. Missing number list to add.

Arguments:
startRes
Starting residue number for renumbering
missingRes
A list of missing residue numbers to add
reorder_residues()[source]

Order residues in atom list by residue number. (NOTE: Does not check for chain information - split by chain first).

reset_position()[source]

Translate structure back into initial position.

rotate_by_axis_angle(x, y, z, turn, x_trans=0, y_trans=0, z_trans=0, rad=False, com=False)[source]

Rotate the Structure instance around its centre.

Arguments:

turn
angle (in radians if rad == True, else in degrees) to rotate map.
x,y,z
axis to rotate about, ie. x,y,z = 0,0,1 rotates the structure round the xy-plane.
x_trans, y_trans, z_trans
extra translational movement if required.
com
centre of mass around which to rotate the structure. If False, rotates around centre of mass of structure.
rotate_by_euler(x_turn, y_turn, z_turn, x_trans=0, y_trans=0, z_trans=0, rad=False, com=False)[source]

Rotate this Structure instance around its centre.

Arguments:
x_turn,y_turn,z_turn
Euler angles (in radians if rad == True, else in degrees) used to rotate structure, in order XYZ.
x_trans, y_trans, z_trans
extra translational movement if required.
com
centre of mass around which to rotate the structure. If False, rotates around centre of mass of structure.
rotate_by_quaternion(q, com=False)[source]
split_into_chains()[source]

Split the structure into separate chains and returns the list of Structure instance for each chain.

translate(x, y, z)[source]

Translate the structure.

Arguments:

x, y, z
distance in Angstroms in respective directions to move structure.
Return:
Translated Structure instance
vectorise()[source]
write_to_PDB(filename, hetatom=False)[source]

Write Structure instance to PDB file.

Arguments:

filename
output filename.