TEMPy.protein.structure_blurrer

All functions used to generate simulated maps from protein models, and to generate other 3D volumes, such as masks are found in TEMPy.protein.structure_blurrer.

TEMPy contains multiple methods for generating (or blurring) simulated maps. Most of these methods generate simulated maps by modelling density around each atom as a 3D gaussian; a simulated map is generated by summing the guassians for all atoms in a model. This calculation can be done in fourier space using gaussian_blur , or in real space using gaussian_blur_real_space.

Note on real space blurring:

All real space blurring functions require a sigma_coeff argument, that defines the width of the Gaussian (multiplied by the map resolution) for each atom. In TEMPy, there are multiple options for the sigma_coeff value, each derived from a specific publication.

Available sigma_coeff values:

  • 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).

class TEMPy.protein.structure_blurrer.StructureBlurrer(with_vc=False, locres=None)[source]

A class to generate density maps using structure instances.

Parameters:

use_vc – If True, use an accelerated algorithm to calculate the map density when calling gaussian_blur_real_space.

Returns:

A structure blurring object.

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

Returns a Map instance based on a Gaussian blurring of a protein.

The convolution of atomic gaussians is done in reciprocal space.

Parameters:
  • prot – the Structure instance to be blurred.

  • resolution – The resolution, in Angstroms, to blur the protein to.

  • densMap – A map instance to use as a template, which sets the boxsize, pixel size and origin. If False, a Map with dimensions based on the protein is generated.

  • sigma_coeff – Parameter need for Structure Blurrer. Full explanation here

  • filename – Output name of the map file, if saved.

Return type:

Map instance

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

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

Parameters:
  • 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 – Parameter need for Structure Blurrer. Full explanation here

  • filename – Output name of the map file, if saved.

Return type:

Map instance

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

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

Parameters:
  • prot – the Structure instance to be blurred.

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

  • densMap – A map instance to use as a template, which sets the boxsize, pixel size and origin. If False, a Map with dimensions based on the protein is generated.

  • sigma_coeff – Parameter need for Structure Blurrer. Full explanation here

  • filename – Output name of the map file, if saved.

Return type:

Map instance

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

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

Parameters:
  • 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 – Parameter need for Structure Blurrer. Full explanation here

  • filename – output name of the map file, if saved.

Return type:

Map instance

get_coordinates(structure_instance)[source]

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

Parameters:

structure_instance* – Structure instance of the model.

Returns:

Something

get_indices(structure_instance, emmap, res_map, sim_sigma_coeff=0.187, sigma_thr=2.0, atom_sel=None, atom_centre='CA')[source]

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

Parameters:
  • 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 – Parameter need for Structure Blurrer. Full explanation here

Return type:

Dictionaries

get_indices_aj(structure_instance, emmap, res_map, sim_sigma_coeff=0.187, sigma_thr=2.0, atom_sel=None, atom_centre='CA')[source]

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

Parameters:
  • 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 – Parameter need for Structure Blurrer. Full explanation here

  • sigma_thr

  • atom_sel

  • atom_centre

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

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

Parameters:
  • prot – The Structure instance to be blurred.

  • resolution – The resolution, in Angstroms, to blur the protein to.

  • densMap – A map instance to use as a template, which sets the boxsize, pixel size and origin. If False, a Map with dimensions based on the protein is generated.

  • normalise – Normalise the densities in the Map instance to 0 mean using Map.normalise

  • filename – Output name of the map file, if saved.

Return type:

Map instance

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

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

Parameters:
  • 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.

Return type:

Map instance

make_atom_overlay_map(densMap, prot)[source]

Returns a Map instance with atom masses superposed on it.

Parameters:
  • densMap – An empty (all densities zero) Map instance to superpose the atoms onto

  • prot – Model structure instance.

Returns:

Map instance, where Map.fullMap is a 3D grid with the atom masses superposed.

Return type:

Map instance

make_atom_overlay_map1(densMap, prot)[source]

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

Parameters:
  • densMap – An empty (all densities zero) Map instance to superpose the atoms onto

  • prot – Model structure instance.

Returns:

Map instance, where Map.fullMap is a 3D grid with the atom masses superposed.

Return type:

Map instance

make_atom_overlay_mapB(densMap, prot)[source]

Returns a Map instance with atom masses superposed on it.

Parameters:
  • densMap – An empty (all densities zero) Map instance to superpose the atoms onto

  • prot – Model structure instance.

Returns:

Map instance, where Map.fullMap is a 3D grid with the atom masses superposed.

Return type:

Map instance

mapGridPosition(densMap, atom)[source]

Finds the index of an atom in a Map instance, and the atom’s mass.

Parameters:
  • densMapMap instance the atom is to be placed on.

  • atomAtom instance.

Returns:

x, y, z index for atom and its mass.

Return type:

int, int, int, float

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

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

Parameters:
  • *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)[source]

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

Parameters:
  • *densMap* – Map instance the atom is to be placed on.

  • *atom* – Atom instance.

maptree(densMap, strmap=None)[source]

Returns the KDTree of coordinates from a map grid.

Parameters:

*densMap* – Map instance the atom is to be placed on.

model_tree(list_coord1, distpot=6.0, list_coord2=None)[source]

Finds neighbouring points Returns

old_get_indices(structure_instance, emmap, res_map, sim_sigma_coeff=0.187, sigma_thr=2.0, atom_sel=None)[source]

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

Parameters:
  • 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 – Parameter need for Structure Blurrer. Full explanation here

Return type:

Dictionaries

protMap(struct, apix, resolution=None, filename='None')[source]

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

Parameters:
  • struct – Model structure instance.

  • apix – Angstroms per pixel for the output Map.

  • resolution – Target resolution of the output Map.

  • filename – Filename for Map instance - if it is saved.

Returns:

Map full of zeros with a shape sufficient to encompass the protein in struct.

Return type:

Map instance

protMapBox(struct, apix, resolution, box_size_x, box_size_y, box_size_z, filename)[source]

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

Parameters:
  • struct – model 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, if it is saved.

Returns:

Empty map (full of zeros) with size as specified and origin centred on the protein model in struct.

Return type:

Map instance