Package generic_fns :: Package structure :: Module geometric
[hide private]
[frames] | no frames]

Module geometric

source code

Functions [hide private]
array of float, array of float
angles_regular(inc=None)
Determine the spherical angles for a regular sphere point distribution.
source code
array of float, array of float
angles_uniform(inc=None)
Determine the spherical angles for a uniform sphere point distribution.
source code
float
autoscale_tensor(method='mass')
Automatically determine an appropriate scaling factor for display of the diffusion tensor.
source code
 
cone_edge(mol=None, cone=None, res_name='CON', res_num=None, chain_id='', apex=None, axis=None, R=None, scale=None, inc=None, distribution='uniform', debug=False)
Add a residue to the atomic data representing a cone of the given angle.
source code
 
create_cone_pdb(mol=None, cone=None, start_res=1, apex=None, axis=None, R=None, inc=None, scale=30.0, distribution='regular', file=None, dir=None, force=False)
Create a PDB representation of the given cone object.
source code
 
create_diff_tensor_pdb(scale=1.8e-06, file=None, dir=None, force=False)
Create the PDB representation of the diffusion tensor.
source code
 
create_vector_dist(length=None, symmetry=True, file=None, dir=None, force=False)
Create a PDB representation of the XH vector distribution.
source code
 
generate_vector_dist(mol=None, res_name=None, res_num=None, chain_id='', centre=array([ 0., 0., 0.]), R=array([[ 1., 0., 0..., warp=array([[ 1., 0., 0..., limit_check=None, scale=1.0, inc=20, distribution='uniform', debug=False)
Generate a uniformly distributed distribution of atoms on a warped sphere.
source code
int
generate_vector_residues(mol=None, vector=None, atom_name=None, res_name_vect='AXS', sim_vectors=None, res_name_sim='SIM', chain_id='', res_num=None, origin=None, scale=1.0, label_placement=1.1, neg=False)
Generate residue representations for the vector and the MC simulationed vectors.
source code
str
get_proton_name(atom_num)
Return a valid PDB atom name of <4 characters.
source code
 
stitch_cone_to_edge(mol=None, cone=None, chain_id='', dome_start=None, edge_start=None, scale=1.0, inc=None, distribution='uniform', debug=False)
Function for stitching the cone dome to its edge, in the PDB representations.
source code
list of rank-1, 3D numpy arrays
vect_dist_spherical_angles(inc=20, distribution='uniform')
Create a distribution of vectors on a sphere using a distribution of spherical angles.
source code
Variables [hide private]
  status = Status()
  __package__ = 'generic_fns.structure'

Imports: cos, pi, sin, arccos, array, dot, eye, float64, transpose, zeros, getcwd, ascii_uppercase, warn, exists_mol_res_spin_data, spin_loop, pipes, centre_of_mass, Internal, two_vect_to_R, RelaxError, RelaxNoPdbError, RelaxNoSequenceError, RelaxNoTensorError, RelaxNoVectorsError, get_file_path, open_write_file, RelaxWarning, Status


Function Details [hide private]

angles_regular(inc=None)

source code 

Determine the spherical angles for a regular sphere point distribution.

Parameters:
  • inc (int) - The number of increments in the distribution.
Returns: array of float, array of float
The phi angle array and the theta angle array.

angles_uniform(inc=None)

source code 

Determine the spherical angles for a uniform sphere point distribution.

Parameters:
  • inc (int) - The number of increments in the distribution.
Returns: array of float, array of float
The phi angle array and the theta angle array.

autoscale_tensor(method='mass')

source code 

Automatically determine an appropriate scaling factor for display of the diffusion tensor.

Parameters:
  • method (str) - The method used to determine the scaling of the diffusion tensor object.
Returns: float
The scaling factor.

cone_edge(mol=None, cone=None, res_name='CON', res_num=None, chain_id='', apex=None, axis=None, R=None, scale=None, inc=None, distribution='uniform', debug=False)

source code 

Add a residue to the atomic data representing a cone of the given angle.

A series of vectors totalling the number of increments and starting at the origin are equally spaced around the cone axis. The atoms representing neighbouring vectors will be directly bonded together. This will generate an object representing the outer edge of a cone.

Parameters:
  • mol (MolContainer instance) - The molecule container.
  • cone (class instance) - The cone object. This should provide the limit_check() method with determines the limits of the distribution accepting two arguments, the polar angle phi and the azimuthal angle theta, and return True if the point is in the limits or False if outside. It should also provide the phi_max() method for returning the phi value for the given theta.
  • res_name (str) - The residue name.
  • res_num (int) - The residue number.
  • chain_id (str) - The chain identifier.
  • apex (numpy array, len 3) - The apex of the cone.
  • axis (numpy array, len 3) - The central axis of the cone. If supplied, then this arg will be used to construct the rotation matrix.
  • R (3x3 numpy array) - A 3x3 rotation matrix. If the axis arg supplied, then this matrix will be ignored.
  • scale (float) - The scaling factor to stretch all points by.
  • inc (int) - The number of increments or number of vectors used to generate the outer edge of the cone.
  • distribution (str) - The type of point distribution to use. This can be 'uniform' or 'regular'.

create_cone_pdb(mol=None, cone=None, start_res=1, apex=None, axis=None, R=None, inc=None, scale=30.0, distribution='regular', file=None, dir=None, force=False)

source code 

Create a PDB representation of the given cone object.

Parameters:
  • mol (MolContainer instance) - The molecule container.
  • cone (class instance) - The cone object. This should provide the limit_check() method with determines the limits of the distribution accepting two arguments, the polar angle phi and the azimuthal angle theta, and return True if the point is in the limits or False if outside. It should also provide the theta_max() method for returning the theta value for the given phi, the phi_max() method for returning the phi value for the given theta.
  • start_res (str) - The starting residue number.
  • apex (rank-1, 3D numpy array) - The apex of the cone.
  • axis (rank-1, 3D numpy array) - The central axis of the cone. If not supplied, the z-axis will be used.
  • R (rank-2, 3D numpy array) - The rotation matrix.
  • inc (int) - The increment number used to determine the number of latitude and longitude lines.
  • scale (float) - The scaling factor to stretch the unit cone by.
  • distribution (str) - The type of point distribution to use. This can be 'uniform' or 'regular'.
  • file (str) - The name of the PDB file to create.
  • dir (str) - The name of the directory to place the PDB file into.
  • force (bool) - Flag which if set to True will overwrite any pre-existing file.

create_diff_tensor_pdb(scale=1.8e-06, file=None, dir=None, force=False)

source code 

Create the PDB representation of the diffusion tensor.

Parameters:
  • scale (float) - The scaling factor for the diffusion tensor.
  • file (str) - The name of the PDB file to create.
  • dir (str) - The name of the directory to place the PDB file into.
  • force (bool) - Flag which if set to True will overwrite any pre-existing file.

create_vector_dist(length=None, symmetry=True, file=None, dir=None, force=False)

source code 

Create a PDB representation of the XH vector distribution.

Parameters:
  • length (float) - The length to set the vectors to in the PDB file.
  • symmetry (bool) - The symmetry flag which if set will create a second PDB chain 'B' which is the same as chain 'A' but with the XH vectors reversed.
  • file (str) - The name of the PDB file to create.
  • dir (str) - The name of the directory to place the PDB file into.
  • force (bool) - Flag which if set will overwrite any pre-existing file.

generate_vector_dist(mol=None, res_name=None, res_num=None, chain_id='', centre=array([ 0., 0., 0.]), R=array([[ 1., 0., 0..., warp=array([[ 1., 0., 0..., limit_check=None, scale=1.0, inc=20, distribution='uniform', debug=False)

source code 

Generate a uniformly distributed distribution of atoms on a warped sphere.

The vectors from the function vect_dist_spherical_angles() are used to generate the distribution. These vectors are rotated to the desired frame using the rotation matrix 'R', then each compressed or stretched by the dot product with the 'warp' matrix. Each vector is centred and at the head of the vector, a proton is placed.

Parameters:
  • mol (MolContainer instance) - The molecule container.
  • res_name (str) - The residue name.
  • res_num (int) - The residue number.
  • chain_id (str) - The chain identifier.
  • centre (numpy array, len 3) - The centre of the distribution.
  • R (3x3 numpy array) - The optional 3x3 rotation matrix.
  • warp (3x3 numpy array) - The optional 3x3 warping matrix.
  • limit_check (function) - A function with determines the limits of the distribution. It should accept two arguments, the polar angle phi and the azimuthal angle theta, and return True if the point is in the limits or False if outside.
  • scale (float) - The scaling factor to stretch all rotated and warped vectors by.
  • inc (int) - The number of increments or number of vectors used to generate the outer edge of the cone.
  • distribution (str) - The type of point distribution to use. This can be 'uniform' or 'regular'.

generate_vector_residues(mol=None, vector=None, atom_name=None, res_name_vect='AXS', sim_vectors=None, res_name_sim='SIM', chain_id='', res_num=None, origin=None, scale=1.0, label_placement=1.1, neg=False)

source code 

Generate residue representations for the vector and the MC simulationed vectors.

This is used to create a PDB representation of any vector, including its Monte Carlo simulations.

Parameters:
  • mol (MolContainer instance) - The molecule container.
  • vector (numpy array, len 3) - The vector to be represented in the PDB.
  • atom_name (str) - The atom name used to label the atom representing the head of the vector.
  • res_name_vect (str) - The 3 letter PDB residue code used to represent the vector.
  • sim_vectors (list of numpy array, each len 3) - The optional Monte Carlo simulation vectors to be represented in the PDB.
  • res_name_sim (str) - The 3 letter PDB residue code used to represent the Monte Carlo simulation vectors.
  • chain_id (str) - The chain identification code.
  • res_num (int) - The residue number.
  • origin (numpy array, len 3) - The origin for the axis.
  • scale (float) - The scaling factor to stretch the vectors by.
  • label_placement (float) - A scaling factor to multiply the pre-scaled vector by. This is used to place the vector labels a little further out from the vector itself.
  • neg (bool) - If True, then the negative vector positioned at the origin will also be included.
Returns: int
The new residue number.

get_proton_name(atom_num)

source code 

Return a valid PDB atom name of <4 characters.

Parameters:
  • atom_num (int) - The number of the atom.
Returns: str
The atom name to use in the PDB.

stitch_cone_to_edge(mol=None, cone=None, chain_id='', dome_start=None, edge_start=None, scale=1.0, inc=None, distribution='uniform', debug=False)

source code 

Function for stitching the cone dome to its edge, in the PDB representations.

Parameters:
  • mol (MolContainer instance) - The molecule container.
  • cone (class instance) - The cone object. This should provide the limit_check() method with determines the limits of the distribution accepting two arguments, the polar angle phi and the azimuthal angle theta, and return True if the point is in the limits or False if outside. It should also provide the theta_max() method for returning the theta value for the given phi.
  • chain_id (str) - The chain identifier.
  • dome_start (int) - The starting atom number of the cone dome residue.
  • edge_start (int) - The starting atom number of the cone edge residue.
  • scale (float) - The scaling factor to stretch all points by.
  • inc (int) - The number of increments or number of vectors used to generate the outer edge of the cone.
  • distribution (str) - The type of point distribution to use. This can be 'uniform' or 'regular'.

vect_dist_spherical_angles(inc=20, distribution='uniform')

source code 

Create a distribution of vectors on a sphere using a distribution of spherical angles.

This function returns an array of unit vectors distributed within 3D space. The unit vectors are generated using the equation:

              | cos(theta) * sin(phi) |
   vector  =  | sin(theta) * sin(phi) |.
              |      cos(phi)         |

The vectors of this distribution generate both longitudinal and latitudinal lines.

Parameters:
  • inc (int) - The number of increments in the distribution.
  • distribution (str) - The type of point distribution to use. This can be 'uniform' or 'regular'.
Returns: list of rank-1, 3D numpy arrays
The distribution of vectors on a sphere.