TEMPy.protein package

Submodules

TEMPy.protein.prot_rep_biopy module

class BioPyAtom(atom)

Bases: object

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

change_init_position()

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

Return:

new initial position co-ordinates of atom.

copy()
Return:

Copy of the Atom instance.

distance_from_atom(atom)
Return:

Distance from another atom.

distance_from_init_position()
Return:

Distance from initial position.

get_id_no()
Return:

string of atom serial number.

get_mass()
Return:

Atom mass.

get_name()

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

Return:

atom name.

get_pos_mass()
Return:

An array containing Vector instances containing 3D coordinates of the atom and and its corresponding mass.

get_pos_vector()
Return:

Vector instance containing 3D coordinates of the atom.

get_res()
Return:

three letter residue code corresponding to the atom (i.e ‘ARG’).

get_res_no()
Return:

residue number corresponding to the atom.

get_x()
Return:

x co-ordinate of atom.

get_y()
Return:

y co-ordinate of atom.

get_z()
Return:

z co-ordinate of atom.

map_grid_position(densMap)
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)

Transform atom using a 3x3 matrix

Arguments:
rot_mat

a 3x3 matrix instance.

Return:

Transformed position of atom object

reset_position()

Translate atom back in its initial position.

Return:

initial position co-ordinates of atom.

rotate_by_quaternion(q_param)
set_x(mod)

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

Arguments:
mod

float value

Return:

new x co-ordinate

set_y(mod)

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

Arguments:
mod

float value

Return:

new y co-ordinate

set_z(mod)

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)

Translate the atom.

Arguments:
x, y, z

distance in Angstroms in respective directions to move atom.

Return:

Translate atom object.

write_to_PDB()

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

class BioPy_Structure(atomList, filename='Unknown', header='', footer='')

Bases: object

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

RMSD_from_init_position(CA=False)

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)

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='')

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()
Return:

Center of mass of structure as a Vector instance.

calculate_centroid()

Return centre of mass of structure as a Vector instance.

change_init_position()

Change initial position of structure to current position.

combine_SSE_structures(structList)

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)

Add a list of Structure instance to the existing structure.

Arguments:
structList

list of Structure instance

Return:

New Structure Instance

copy()
Return:

Copy of Structure instance.

find_same_atom(atom_index, otherStruct)

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()
Return:

Structure instance with only the backbone atoms in structure.

get_atom(index)

Return specific atom in Structure instance.

Arguments:
index

Index of the atom

Return:

Returns an Atom instance.

get_atom_list()
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()
Return:

Structure instance with only the backbone atoms in structure.

get_chain(chainID)
Return:

New Structure instance with only the requested chain.

get_chain_ca(chainID)
get_chain_list()
Return:

A list of chain ID.

get_dict_str()
get_extreme_values()
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()
Return:

Array containing Vector instances of positions of all atoms and mass.

get_prot_mass_from_atoms()

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)

# ADD by IF 22-4-2013 #from Harpal code calculation of mass from seq. Calculates Mass (kDa) of the Structure instance, from average mass #based on http://web.expasy.org/findmod/findmod_masses.html

get_residue(resNo)

Get the residue corresponding to the residue number.

Arguments:
resNo

Residues number

Return:

Returns a Residues instance.

get_rgyration()
get_selection(startRes, finishRes, chain='')

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)

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)

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()
Return:

List of torsion angles in Structure instance.

get_vector_list()
Return:

Array containing 3D Vector instances of positions of all atoms.

matrix_transform(matrix)

Transform Structure using a 3x3 transformation matrix

Arguments:
rot_mat

a 3x3 matrix instance.

Return:

Transformed position of Structure object

no_of_chains()
Return:

the number of chains in the Structure object

randomise_position(max_trans, max_rot, v_grain=30, rad=False, verbose=False)

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)

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)

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

renumber_residues(startRes=1, missingRes=[])

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()

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

reset_position()

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)

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)

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)
split_into_chains()

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

translate(x, y, z)

Translate the structure.

Arguments:
x, y, z

distance in Angstroms in respective directions to move structure.

Return:

Translated Structure instance

vectorise()
write_to_PDB(filename, hetatom=False)

Write Structure instance to PDB file.

Arguments:
filename

output filename.

TEMPy.protein.rigid_body_parser module

class RBParser

Bases: object

A class to read Rigid Body files

static RBfileToRBlist(file_in)

Read a rigid body files in Flex-EM format (text file) using residue numbers in a list of segments. Each line describes one rigid body by specifying the initial and final residue of each of the segments in that rigid body (eg, ‘2 6 28 30’ means that residues 2-6 and 28-30 will be included in the same rigid body). We recommend to use the RIBFIND server for accurately identifying Rigid Bodies in a protein structures.

Arguments:
file_in

Rigid Body File in Flex EM format

list_out

Return a list of segments (each line in the file). The list of rigid body is 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.

static get_rigid_body_str_instances(file_in, structure_instance)

Read a rigid body files in Flex-EM format (text file) using residue numbers in a structure instance. Each line describes one rigid body by specifying the initial and final residue of each of the segments in that rigid body (eg, ‘2 6 28 30’ means that residues 2-6 and 28-30 will be included in the same rigid body). We recommend to use the RIBFIND server for accurately identifying Rigid Bodies in a protein structures.

Arguments:
file_in

Rigid Body File in Flex EM format

structure_instance

Structure Instance to manipulate

list_out

True return a list of the Rigid Bodies structure instances (each line in the file). False will print them separately.

static read_FlexEM_RIBFIND_files(file_in, structure_instance, list_out=True)

Read a rigid body files in Flex-EM format (text file) using residue numbers in a structure instance. Each line describes one rigid body by specifying the initial and final residue of each of the segments in that rigid body (eg, ‘2 6 28 30’ means that residues 2-6 and 28-30 will be included in the same rigid body). We recommend to use the RIBFIND server for accurately identifying Rigid Bodies in a protein structures.

Arguments:
file_in

Rigid Body File in Flex EM format

structure_instance

Structure Instance to manipulate

list_out

True return a list of the Rigid Bodies structure instances (each line in the file). False will print them separately.

static read_rigid_body_file(file_in)

Read a rigid body file in Flex-EM format. Each line describes one rigid body by specifying the initial and

final residue of each of the segments in that rigid body

(eg, ‘2:A 6:A 28:A 30:A’ means that residues 2-6 and 28-30 of chain A will be included in the same rigid body).

Arguments:
file_in

Rigid Body File in Flex EM format

static read_rigid_body_file_as_dict(file_in)

Read a rigid body file in Flex-EM format. Each line describes one rigid body by specifying the initial and

final residue of each of the segments in that rigid body

(eg, ‘2:A 6:A 28:A 30:A’ means that residues 2-6 and 28-30 of chain A will be included in the same rigid body).

Arguments:
file_in

Rigid Body File in Flex EM format

TEMPy.protein.scoring_functions module

LJ_(alist, blist)
LJ_score(structList)
LJ_score_VC(structList)
MI_full(p1, p2, bins)
MI_histo(u, v, n1, n2)
NMI_histo(u, v, n1, n2)
class ScoringFunctions

Bases: object

A class implementing various scoring functions used in density fitting. Reference: Vasishtan and Topf (2011) Scoring functions for cryoEM density fitting. J Struct Biol 174:333-343.

CCC(map_target, map_probe)

Calculate cross-correlation between two Map instances.

Arguments:
map_target, map_probe

EMMap instances to compare.

Return:

CCC score

CCC_chimera(map_target, map_probe)

Calculate cross-correlation between two Map instances.

Arguments:
map_target, map_probe

EMMap instances to compare.

Return:

CCC score

CCC_map(map_target, map_probe, map_target_threshold=0.0, map_probe_threshold=0.0, mode=1, meanDist=False, cmode=True)

Calculate cross-correlation between two Map instances, for the overlap (3), contoured (2) or complete map (1).

Arguments:
map_target, map_probe

EMMap instances to compare.

map_target_threshold,map_probe_threshold

EMMap threshold if not given, use calcualte_map_threshold to calculate map_target_threshold and map_probe_threshold

mode

3. calculation on the mask 2. calculation on contoured maps 1. calculation on complete map

meanDist

True if the deviation from mean needs to be calculated

LSF(map_target, map_probe)

Calculate least-squares between two Map instances.

Arguments:
map_target, map_probe

EMMap instances to compare.

Return:

least-squares value

MI(map_target, map_probe, map_target_threshold=0.0, map_probe_threshold=0.0, mode=1, layers1=None, layers2=None, weight=False, cmode=True, fun=<function _MI_C_helper_new>)

Calculate the mutual information score between two Map instances.

Arguments:
map_target, map_probe

EMMap instances to compare.

map_target_threshold, map_probe_threshold

Thresholds used for contouring

mode

1. use complete map for calculation 3. use overlap region for calculation

layers1, layers2

Number of layers used to bin the maps. Default calculations is based on Sturges, 1926.

*weight

If True: normalised MI (Studholme et al.) is used to account for overlap of ‘contours’

Return:

MI score

SCCC(map_target, resolution_densMap, sigma_map, structure_instance, rigid_body_structure, write=False, c_mode=False)

Calculate Segment based cross-correlation from Pandurangan et al. 2013,J Struct Biol. 2013 Dec 12 It is a local CCC around a selection of atoms.

Arguments:
map_target

Target Map Instance.

resolution_densMap

Parameter need for Structure Blurrer. Resolution of the target map.

sigma_map

Parameter need for Structure Blurrer. The sigma value (multiplied by the resolution) that controls the width of the Gaussian. Default values is 0.356.

Other values used:

0.187R corresponding with the Gaussian width of the Fourier transform falling to half the maximum at 1/resolution, as used in Situs (Wriggers et al, 1999);

0.356R corresponding to the Gaussian width at 1/e maximum height equaling the resolution, the default in Chimera (Petterson et al, 2004);

0.425R the fullwidth half maximum being equal to the resolution, as used by FlexEM (Topf et al, 2008);

0.5R the distance between the two inflection points being the same length as the resolution, an option in Chimera (Petterson et al, 2004);

1R where the sigma value simply equal to the resolution, as used by NMFF (Tama et al, 2004).

structure_instance

Structure instance to compare

rigid_body_structure

Rigid-body Structure instance.

. Return:

SCCC score

SCCC_LAP(map_target, resolution_densMap, sigma_map, structure_instance, rigid_body_structure, write=False)

Calculate Segment based cross-correlation from Pandurangan et al. 2013,J Struct Biol. 2013 Dec 12 It is a local CCC around a selection of atoms.

Arguments:
map_target

Target Map Instance.

resolution_densMap

Parameter need for Structure Blurrer. Resolution of the target map.

sigma_map

Parameter need for Structure Blurrer. The sigma value (multiplied by the resolution) that controls the width of the Gaussian. Default values is 0.356.

Other values used:

0.187R corresponding with the Gaussian width of the Fourier transform falling to half the maximum at 1/resolution, as used in Situs (Wriggers et al, 1999);

0.356R corresponding to the Gaussian width at 1/e maximum height equaling the resolution, the default in Chimera (Petterson et al, 2004);

0.425R the fullwidth half maximum being equal to the resolution, as used by FlexEM (Topf et al, 2008);

0.5R the distance between the two inflection points being the same length as the resolution, an option in Chimera (Petterson et al, 2004);

1R where the sigma value simply equal to the resolution, as used by NMFF (Tama et al, 2004).

structure_instance

Structure instance to compare

rigid_body_structure

Rigid-body Structure instance.

. Return:

SCCC score

SCCC_MI(map_target, resolution_densMap, sigma_map, structure_instance, rigid_body_structure, write=False)

Calculate Segment based cross-correlation from Pandurangan et al. 2013,J Struct Biol. 2013 Dec 12 It is a local CCC around a selection of atoms.

Arguments:
map_target

Target Map Instance.

resolution_densMap

Parameter need for Structure Blurrer. Resolution of the target map.

sigma_map

Parameter need for Structure Blurrer. The sigma value (multiplied by the resolution) that controls the width of the Gaussian. Default values is 0.356.

Other values used :

0.187R corresponding with the Gaussian width of the Fourier transform falling to half the maximum at 1/resolution, as used in Situs (Wriggers et al, 1999);

0.356R corresponding to the Gaussian width at 1/e maximum height equaling the resolution, the default in Chimera (Petterson et al, 2004);

0.425R the fullwidth half maximum being equal to the resolution, as used by FlexEM (Topf et al, 2008);

0.5R the distance between the two inflection points being the same length as the resolution, an option in Chimera (Petterson et al, 2004);

1R where the sigma value simply equal to the resolution, as used by NMFF (Tama et al, 2004).

structure_instance

Structure instance to compare

rigid_body_structure

Rigid-body Structure instance.

. Return:

SCCC score

SMOC(map_target, resolution_densMap, structure_instance, win=11, rigid_body_file=None, sigma_map=0.225, write=False, c_mode=True, sigma_thr=2.0)

Calculate Local cross correlation (Mander’s Overlap) It is a local Overlap Coefficient calculated on atoms in sliding residue windows along the chain.

Arguments:
map_target

Target Map Instance.

resolution_densMap

Parameter need for Structure Blurrer. Resolution of the target map.

structure_instance

Model structure instance.

win

Overlapping Window length to calculate the score

rigid_body_file

Rigid-body file.

sigma_map

Parameter need for Structure Blurrer. The sigma value (multiplied by the resolution) that controls the width of the Gaussian. Default values is 0.356. Other values used :

0.187R corresponding with the Gaussian width of the Fourier transform falling to half the maximum at 1/resolution, as used in Situs (Wriggers et al, 1999); 0.356R corresponding to the Gaussian width at 1/e maximum height equaling the resolution, the default in Chimera (Petterson et al, 2004) 0.425R the fullwidth half maximum being equal to the resolution, as used by FlexEM (Topf et al, 2008) 0.5R the distance between the two inflection points being the same length as the resolution, an option in Chimera (Petterson et al, 2004) 1R where the sigma value simply equal to the resolution, as used by NMFF (Tama et al, 2004).

Return:

Dictionary of smoc scores for residues in the chain

calc_moc(indices, map_probe, map_target)
calculate_map_threshold(map_target)
chamfer_distance(map_target, map_probe, primary_boundary, secondary_boundary, kdtree=None)

Calculate the chamfer distance Score between two Map instances. NOT RACCOMANDED.

Arguments:
map_target, map_probe

EMMap instances to compare.

primary_boundary

is the value returned by get_primary_boundary for map_probe

secondary_boundary

is the value returned by get_second_boundary for map_probe

kdtree

If set True it is possible to choose between the option of kdtree in numpy The one that is py-based is a better choice.

envelope_score(map_target, primary_boundary, structure_instance, norm=True)

Calculate the envelope score between a target Map and a Structure Instances.

Arguments:
map_target

Target Map Instance.

primary_boundary

Value specified is calculated with primary_boundary of the map object.

structure_instance

Structure Instance to compare.

Return:

Envelope score

envelope_score_map(map_target, map_probe, map_target_threshold=0, map_probe_threshold=0, norm=True)

Calculate the envelope score between two Map instance using numoy array.

Arguments:
map_target, map_probe

EMMap instances to compare.

map_target_threshold,map_probe_threshold

EMMap threshold use calcualte_map_threshold to calculate map_target_threshold and map_probe_threshold.

Return:

Envelope score

get_clash_map(emmap, apix)
get_overlay_comp_maplist(struct, template_grid)
get_partial_DLSF(num_of_points, map_target, map_probe)

Calculate the DLSF score between two Map instances. The DLSF is similar to the LSF; whereas the LSF compares absolute density values, the DLSF compares the difference between pairs of values.

Arguments:
map_target, map_probe

the two Map instances to compare.

num_of_points

number of significant points.

Return:

DLSF score

get_sccc(map_target, structure_instance, rigid_body_file, resolution, sigma_map=0.187)

read rigid body file and get sccc scores

get_sm_score(struct, ncomp, template_grid, cvol, apix)
laplace_CCC(map_target, map_probe, prefil=False, False)

Calculate Laplacian cross-correlation between two Map instances. Based on (Chacon and Wriggers, 2002).

Arguments:
map_target, map_probe

Map instances to compare.

prefil

2-tuple of boolean values, one for each map respectively. True if Map instance is already Laplacian-filtered. False otherwise.

Return:

Laplacian cross-correlation score

mapComparison(map_target, map_probe)

Compare the properties (sampling rate, box size and origin) of two maps Arguments:

map_target, map_probe

Map instances to compare.

Return:

True if the map properties are the same between two maps, False otherwise.

normal_vector_score(map_target, map_probe, primary_boundary=None, secondary_boundary=0.0, Filter=None)

Calculate the Normal Vector Score between two Map surfaces. Based on 3SOM algorithm (Ceulemans and Russell, 2004).

Arguments:
map_target, map_probe

EMMap instances to compare. map_target is the target map.

primary_boundary, secondary_boundary

If a filter is selected, just input a contour level as primary threshold. Otherwise, need to run get_primary_boundary and get_second_boundary based on map target.

Filter
Filter to use:

i Sobel Filter (Filter==’Sobel’) ii Laplace Filter (Filter==’Laplace’) iii Minimum Filter (Filter==’Minimum’) iv Mean Filter (Filter==’Mean’)

Return:

Normal vector score.

scale_median(arr1, arr2)

Scale one list/array of scores with respect to another based on distribution around median. Arguments:

arr1, arr2

scale an array of scores (arr1) based on another (arr2).

Return:

scaled arr1.

set_score_as_bfactor(structure_instance, dict_scores, default=0.0, outfile='score.pdb')
compute_Hs(u, v, n1, n2)
multi_diff(assembly, ref)

total extra density in new compared to ref, after normalisation :param assembly: :param ref: :return:

TEMPy.protein.structure_blurrer module

class StructureBlurrer

Bases: object

A class to generates a density map from a structure instance.

gaussian_blur(prot, resolution, densMap=False, sigma_coeff=0.356, normalise=True, filename='None')

Returns a Map instance based on a Gaussian blurring of a protein. The convolution of atomic structures is done in reciprocal space.

Arguments:
prot

the Structure instance to be blurred.

resolution

the resolution, in Angstroms, to blur the protein to.

densMap

False to build a Map with dimensions based on the protein, or a Map instance to be used as a template.

sigma_coeff

the sigma value (multiplied by the resolution) that controls the width of the Gaussian. Default values is 0.356.

Other values used :

0.187R corresponding with the Gaussian width of the Fourier transform falling to half the maximum at 1/resolution, as used in Situs (Wriggers et al, 1999);

0.225R which makes the Fourier transform of the distribution fall to 1/e of its maximum value at wavenumber 1/resolution the default in Chimera (Petterson et al, 2004)

0.356R corresponding to the Gaussian width at 1/e maximum height equaling the resolution, an option in Chimera (Petterson et al, 2004);

0.425R the fullwidth half maximum being equal to the resolution, as used by FlexEM (Topf et al, 2008);

0.5R the distance between the two inflection points being the same length as the resolution, an option in Chimera (Petterson et al, 2004);

1R where the sigma value simply equal to the resolution, as used by NMFF (Tama et al, 2004).

filename

output name of the map file.

gaussian_blur_box(prot, resolution, box_size_x, box_size_y, box_size_z, sigma_coeff=0.356, normalise=True, filename='None')

Returns a Map instance based on a Gaussian blurring of a protein. The convolution of atomic structures is done in reciprocal space.

Arguments:
prot

the Structure instance to be blurred.

resolution

the resolution, in Angstroms, to blur the protein to.

box_size_x

x dimension of map box in Angstroms.

box_size_y

y dimension of map box in Angstroms.

box_size_z

z dimension of map box in Angstroms.

sigma_coeff

the sigma value (multiplied by the resolution) that controls the width of the Gaussian. Default values is 0.356.

Other values used :

0.187R corresponding with the Gaussian width of the Fourier transform falling to half the maximum at 1/resolution, as used in Situs (Wriggers et al, 1999);

0.225R which makes the Fourier transform of the distribution fall to 1/e of its maximum value at wavenumber 1/resolution, the default in Chimera (Petterson et al, 2004)

0.356R corresponding to the Gaussian width at 1/e maximum height equaling the resolution, an option in Chimera (Petterson et al, 2004)

0.425R the fullwidth half maximum being equal to the resolution, as used by FlexEM (Topf et al, 2008)

0.5R the distance between the two inflection points being the same length as the resolution, an option in Chimera (Petterson et al, 2004)

1R where the sigma value simply equal to the resolution, as used by NMFF (Tama et al, 2004)

filename

output name of the map file.

gaussian_blur_real_space(prot, resolution, densMap=False, sigma_coeff=0.356, normalise=True, filename='None')

Returns a Map instance based on a Gaussian blurring of a protein. The convolution of atomic structures is done in real space

Arguments:
prot

the Structure instance to be blurred.

resolution

the resolution, in Angstroms, to blur the protein to.

densMap

False to build a Map with dimensions based on the protein, or a Map instance to be used as a template.

sigma_coeff

the sigma value (multiplied by the resolution) that controls the width of the Gaussian. Default values is 0.356.

Other values used :

0.187R corresponding with the Gaussian width of the Fourier transform falling to half the maximum at 1/resolution, as used in Situs (Wriggers et al, 1999)

0.225R which makes the Fourier transform of the distribution fall to 1/e of its maximum value at wavenumber 1/resolution, the default in Chimera (Petterson et al, 2004)

0.356R corresponding to the Gaussian width at 1/e maximum height equaling the resolution, an option in Chimera (Petterson et al, 2004)

0.425R the fullwidth half maximum being equal to the resolution, as used by FlexEM (Topf et al, 2008)

0.5R the distance between the two inflection points being the same length as the resolution, an option in Chimera (Petterson et al, 2004)

1R where the sigma value simply equal to the resolution, as used by NMFF (Tama et al, 2004)

filename

output name of the map file.

gaussian_blur_real_space_Bfac(prot, resolution, densMap, sigma_coeff=0.356, verbose=False)

Returns a Map instance based on a Gaussian blurring of a protein. The convolution of atomic structures is done in real space

Arguments:
prot

the Structure instance to be blurred.

resolution

the resolution, in Angstroms, to blur the protein to.

densMap

False to build a Map with dimensions based on the protein, or a Map instance to be used as a template.

sigma_coeff

the sigma value (multiplied by the resolution) that controls the width of the Gaussian. Default values is 0.356.

Other values used :

0.187R corresponding with the Gaussian width of the Fourier transform falling to half the maximum at 1/resolution, as used in Situs (Wriggers et al, 1999)

0.225R which makes the Fourier transform of the distribution fall to 1/e of its maximum value at wavenumber 1/resolution, the default in Chimera (Petterson et al, 2004)

0.356R corresponding to the Gaussian width at 1/e maximum height equaling the resolution, an option in Chimera (Petterson et al, 2004)

0.425R the fullwidth half maximum being equal to the resolution, as used by FlexEM (Topf et al, 2008)

0.5R the distance between the two inflection points being the same length as the resolution, an option in Chimera (Petterson et al, 2004)

1R where the sigma value simply equal to the resolution, as used by NMFF (Tama et al, 2004)

filename

output name of the map file.

gaussian_blur_real_space_box(prot, resolution, box_size_x, box_size_y, box_size_z, sigma_coeff=0.356, normalise=True, filename='None')

Returns a Map instance based on a Gaussian blurring of a protein. The convolution of atomic structures is done in real space

Arguments:
prot

the Structure instance to be blurred.

resolution

the resolution, in Angstroms, to blur the protein to.

box_size_x

x dimension of map box in Angstroms.

box_size_y

y dimension of map box in Angstroms.

box_size_z

z dimension of map box in Angstroms.

sigma_coeff

the sigma value (multiplied by the resolution) that controls the width of the Gaussian. Default values is 0.356.

Other values used :

0.187R corresponding with the Gaussian width of the Fourier transform falling to half the maximum at 1/resolution, as used in Situs (Wriggers et al, 1999)

0.225R which makes the Fourier transform of the distribution fall to 1/e of its maximum value at wavenumber 1/resolution, the default in Chimera (Petterson et al, 2004)

0.356R corresponding to the Gaussian width at 1/e maximum height equaling the resolution, an option in Chimera (Petterson et al, 2004)

0.425R the fullwidth half maximum being equal to the resolution, as used by FlexEM (Topf et al, 2008)

0.5R the distance between the two inflection points being the same length as the resolution, an option in Chimera (Petterson et al, 2004)

1R where the sigma value simply equal to the resolution, as used by NMFF (Tama et al, 2004)

filename

output name of the map file.

get_coordinates(structure_instance)

Returns flat indices of the pixels occupied by each residue in a chain.

Arguments:
structure_instance

Structure instance of the model.

get_indices(structure_instance, emmap, res_map, sim_sigma_coeff=0.187, sigma_thr=2.0, atom_sel=None)

Returns flat indices of the pixels occupied by each residue in a chain.

Arguments:
structure_instance

Structure instance of the model.

emmap

Map instance the model is to be placed on.

res_map

Resolution of the map

sim_sigma_coeff

Sigma factor used for blurring

hard_sphere(prot, resolution, densMap=False, normalise=True, filename='None')

Returns a Map instance based on a Hard Sphere model of a protein. Usefull for rigid fitting (Topf et al, 2008)

Arguments:
prot

the Structure instance to be blurred.

resolution

the resolution, in Angstroms, to blur the protein to.

densMap

False to build a Map with dimensions based on the protein, or a Map instance to be used as a template.

filename

output name of the map file.

hard_sphere_box(prot, resolution, box_size_x, box_size_y, box_size_z, normalise=True, filename='None')

Returns a Map instance based on a Hard Sphere model of a protein. Usefull for rigid fitting (Topf et al, 2008)

Arguments:
prot

the Structure instance to be blurred.

resolution

the resolution, in Angstroms, to blur the protein to.

box_size_x

x dimension of map box in Angstroms.

box_size_y

y dimension of map box in Angstroms.

box_size_z

z dimension of map box in Angstroms.

filename

output name of the map file.

make_atom_overlay_map(densMap, prot)

Returns a Map instance with atom masses superposed on it.

Arguments:
densMap

an empty (all densities zero) Map instance to superpose the atoms onto

prot

a Structure instance.

make_atom_overlay_map1(densMap, prot)

Returns a Map instance with atom locations recorded on the nearest voxel with a value of 1.

Arguments:
densMap

an empty (all densities zero) Map instance to superpose the atoms onto.

prot

a Structure instance.

make_atom_overlay_mapB(densMap, prot)

Returns a Map instance with atom masses superposed on it.

Arguments:
densMap

an empty (all densities zero) Map instance to superpose the atoms onto.

prot

a Structure instance.

make_model_grid(prot, spacing, ca_only=False, densMap=False)
mapGridPosition(densMap, atom)

Returns the index of the nearest pixel to an atom, and atom mass (4 values in list form).

Arguments:
densMap

Map instance the atom is to be placed on.

atom

Atom instance.

mapGridPositions(densMap, atom, gridtree, res_map, sim_sigma_coeff=0.187, sigma_thr=2.0)

Returns the indices of the nearest pixels to an atom as a list.

Arguments:
densMap

Map instance the atom is to be placed on.

atom

Atom instance.

gridtree

KDTree of the map coordinates (absolute cartesian)

res_map

Map resolution

mapGridPositions_vdw(densMap, atom, gridtree)

Returns the index of the nearest pixel to an atom, and atom mass (4 values in list form).

Arguments:
densMap

Map instance the atom is to be placed on.

atom

Atom instance.

maptree(densMap, strmap=None)

Returns the KDTree of coordinates from a map grid.

Arguments:
densMap

Map instance the atom is to be placed on.

model_tree(list_coord1, distpot=6.0, list_coord2=None)

Returns

protMap(struct, apix, resolution=None, filename='None')

Returns an Map instance sized and centred based on the atomic structure.

Arguments:
apix

Angstroms per pixel for the Map to be outputted.

resolution

Target resolution of the outputted map.

sigma_coeff

Sigma width of the Gaussian used to blur the atomic structure.

filename

output name of the map file.

protMapBox(struct, apix, resolution, box_size_x, box_size_y, box_size_z, filename)

Create a Map instance sized and centered based on the atomic structure.

Arguments:
struct

the Structure instance.

apix

Angstroms per pixel for the output Map.

resolution

the resolution, in Angstroms, to blur the protein to.

box_size_x

x dimension of output map box in Angstroms.

box_size_y

y dimension of output map box in Angstroms.

box_size_z

z dimension of output map box in Angstroms.

filename

output name of the map file.

Return:

A Map instance

refine_Bfac(prot, newMap, refmap, resolution, sigma_coeff=0.356, verbose=False)

Returns a Map instance based on a Gaussian blurring of a protein. The convolution of atomic structures is done in real space

Arguments:
prot

the Structure instance to be blurred.

resolution

the resolution, in Angstroms, to blur the protein to.

densMap

False to build a Map with dimensions based on the protein, or a Map instance to be used as a template.

sigma_coeff

the sigma value (multiplied by the resolution) that controls the width of the Gaussian. Default values is 0.356.

Other values used :

0.187R corresponding with the Gaussian width of the Fourier transform falling to half the maximum at 1/resolution, as used in Situs (Wriggers et al, 1999)

0.225R which makes the Fourier transform of the distribution fall to 1/e of its maximum value at wavenumber 1/resolution, the default in Chimera (Petterson et al, 2004)

0.356R corresponding to the Gaussian width at 1/e maximum height equaling the resolution, an option in Chimera (Petterson et al, 2004)

0.425R the fullwidth half maximum being equal to the resolution, as used by FlexEM (Topf et al, 2008)

0.5R the distance between the two inflection points being the same length as the resolution, an option in Chimera (Petterson et al, 2004)

1R where the sigma value simply equal to the resolution, as used by NMFF (Tama et al, 2004)

filename

output name of the map file.

TEMPy.protein.structure_parser module

class PDBParser

Bases: object

A class to read PDB files either directly from the pdb or a structure instance from Biopython

static calc_SA(self, pdbfile, rsa=True, outsafile=None)
static fetch_PDB(structure_id, filename, hetatm=False, water=False)

Fetch PDB file and create Structure instance based upon it.

Argument:
structure_id

structure_id code of pdb file

filename

name of pdb file

hetatm

Boolean representing whether the PDB file contains hetatom.

water

Boolean representing whether to add water to the structure. Default and recommended is False.

Return:

Structure Instance

static fetch_PDB_BioPy(structure_id, filename, hetatm=False, water=False)

Fetch PDB file and create Structure instance based upon it.

Argument:
structure_id

structure_id code of pdb file

filename

name of pdb file

hetatm

Boolean representing whether the PDB file contains hetatom.

water

Boolean representing whether to add water to the structure. Default and recommended is False.

Return:

Structure Instance

static read_PDB_file(structure_id, filename, hetatm=False, water=False, chain=None)

Read PDB file and create Structure instance based upon it.

Argument:
structure_id

structure_id code of pdb file

filename

name of pdb file

hetatm

Boolean representing whether the PDB file contains hetatom.

water

Boolean representing whether to add water to the structure. Default and recommended is False.

Return:

Structure Instance

static read_PDB_file_BioPy(structure_id, filename, hetatm=False, water=False, chain=None)

Read PDB file and create Structure instance based upon it.

Argument:
structure_id

structure_id code of pdb file

filename

name of pdb file

hetatm

Boolean representing whether the PDB file contains hetatom.

water

Boolean representing whether to add water to the structure. Default and recommended is False.

Return:

Structure Instance

static write_sasd_to_pdb(dens_map, sasds, pdb)

Outputs sasds to .pdb file

Arguments:
dens_map

Solvent accessible surface on masked array

sasds

dictionary of sasds

pdb

.pdb file sasds were calculated on

static write_sasd_to_txt(sasds, pdb)

Outputs sasds to .txt file

Arguments:
sasds

dictionary of sasds

pdb

.pdb file sasds were calculated on

class mmCIFParser

Bases: object

A class to read mmCIF files either directly from the mmCIF or a structure instance from Biopython

static fetch_mmCIF(structure_id, filename, hetatm=False, water=False)

Fetch mmCIF file and create Structure instance based upon it.

Argument:
structure_id

structure_id code of mmCIF file

filename

name of mmCIF file

hetatm

Boolean representing whether the mmCIF file contains hetatom.

water

Boolean representing whether to add water to the structure. Default and recommended is False.

Return:

Structure Instance

static read_mmCIF_file(structure_id, filename, hetatm=False, water=False)

Read mmCIF file and create Structure instance based upon it.

Argument:
structure_id

structure_id code of mmCIF file

filename

name of mmCIF file

hetatm

Boolean representing whether the mmCIF file contains hetatom. Default and recommended is False.

water

Boolean representing whether to add water to the structure. Default and recommended is False.

Return:

Structure Instance

Module contents