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

Module main

source code

Functions [hide private]
 
add_atom(mol_name=None, atom_name=None, res_name=None, res_num=None, pos=[None, None, None], element=None, atom_num=None, chain_id=None, segment_id=None, pdb_record=None)
Add a new atom to the structural data object.
source code
 
add_model(model_num=None)
Add a new model to the empty structural data object.
source code
 
connect_atom(index1=None, index2=None)
Connect two atoms.
source code
 
delete(atom_id=None)
Delete structural data.
source code
 
displacement(model_from=None, model_to=None, atom_id=None, centroid=None)
Calculate the rotational and translational displacement between two structural models.
source code
 
find_pivot(models=None, atom_id=None, init_pos=None, func_tol=1e-05, box_limit=200)
Superimpose a set of structural models.
source code
 
get_pos(spin_id=None, str_id=None, ave_pos=False)
Load the spins from the structural object into the relax data store.
source code
 
load_spins(spin_id=None, str_id=None, mol_name_target=None, ave_pos=False)
Load the spins from the structural object into the relax data store.
source code
 
read_pdb(file=None, dir=None, read_mol=None, set_mol_name=None, read_model=None, set_model_num=None, parser='internal', alt_loc=None, verbosity=1, merge=False, fail=True)
The PDB loading function.
source code
 
read_xyz(file=None, dir=None, read_mol=None, set_mol_name=None, read_model=None, set_model_num=None, verbosity=1, fail=True)
The XYZ loading function.
source code
float
rmsd(atom_id=None, models=None)
Calculate the RMSD between the loaded models.
source code
 
rotate(R=None, origin=None, model=None, atom_id=None)
Rotate the structural data about the origin by the specified forwards rotation.
source code
 
set_vector(spin=None, xh_vect=None)
Place the XH unit vector into the spin container object.
source code
 
superimpose(models=None, method='fit to mean', atom_id=None, centroid=None)
Superimpose a set of structural models.
source code
 
translate(T=None, model=None, atom_id=None)
Shift the structural data by the specified translation vector.
source code
 
vectors(spin_id1=None, spin_id2=None, model=None, verbosity=1, ave=True, unit=True)
Extract the bond vectors from the loaded structures and store them in the spin container.
source code
 
web_of_motion(file=None, dir=None, models=None, force=False)
Create a PDB representation of the motion between a set of models.
source code
 
write_pdb(file=None, dir=None, model_num=None, compress_type=0, force=False)
The PDB writing function.
source code
Variables [hide private]
  __package__ = 'generic_fns.structure'

Imports: sqrt, generic_minimise, array, dot, float64, ndarray, zeros, norm, F_OK, access, search, sys, warn, molmol, relax_re, interatomic_loop, create_spin, exists_mol_res_spin_data, generate_spin_id_unique, linear_ave, return_molecule, return_residue, return_spin, spin_loop, pipes, Displacements, Internal, Scientific_data, atomic_rmsd, fit_to_first, fit_to_mean, Pivot_finder, RelaxError, RelaxFileError, RelaxNoPdbError, RelaxNoSequenceError, get_file_path, open_write_file, write_data, write_spin_data, RelaxWarning, RelaxNoPDBFileWarning, RelaxZeroVectorWarning


Function Details [hide private]

add_atom(mol_name=None, atom_name=None, res_name=None, res_num=None, pos=[None, None, None], element=None, atom_num=None, chain_id=None, segment_id=None, pdb_record=None)

source code 

Add a new atom to the structural data object.

Parameters:
  • mol_name (str) - The name of the molecule.
  • atom_name (str or None) - The atom name, e.g. 'H1'.
  • res_name (str or None) - The residue name.
  • res_num (int or None) - The residue number.
  • pos (rank-1 or rank-2 array or list of float) - The position vector of coordinates. If a rank-2 array is supplied, the length of the first dimension must match the number of models.
  • element (str or None) - The element symbol.
  • atom_num (int or None) - The atom number.
  • chain_id (str or None) - The chain identifier.
  • segment_id (str or None) - The segment identifier.
  • pdb_record (str or None) - The optional PDB record name, e.g. 'ATOM' or 'HETATM'.

connect_atom(index1=None, index2=None)

source code 

Connect two atoms.

Parameters:
  • index1 (str) - The global index of the first atom.
  • index2 (str) - The global index of the first atom.

delete(atom_id=None)

source code 

Delete structural data.

Parameters:
  • atom_id (str or None) - The molecule, residue, and atom identifier string. This matches the spin ID string format. If not given, then all structural data will be deleted.

displacement(model_from=None, model_to=None, atom_id=None, centroid=None)

source code 

Calculate the rotational and translational displacement between two structural models.

Parameters:
  • model_from (int or None) - The optional model number for the starting position of the displacement.
  • model_to (int or None) - The optional model number for the ending position of the displacement.
  • atom_id (str or None) - The molecule, residue, and atom identifier string. This matches the spin ID string format.
  • centroid (list of float or numpy rank-1, 3D array) - An alternative position of the centroid, used for studying pivoted systems.

find_pivot(models=None, atom_id=None, init_pos=None, func_tol=1e-05, box_limit=200)

source code 

Superimpose a set of structural models.

Parameters:
  • models (list of int or None) - The list of models to use. If set to None, then all models will be used.
  • atom_id (str or None) - The molecule, residue, and atom identifier string. This matches the spin ID string format.
  • init_pos (list of float or numpy rank-1, 3D array) - The starting pivot position for the pivot point optimisation.
  • func_tol (None or float) - The function tolerance which, when reached, terminates optimisation. Setting this to None turns of the check.
  • box_limit (int) - The simplex optimisation used in this function is constrained withing a box of +/- x Angstrom containing the pivot point using the logarithmic barrier function. This argument is the value of x.

get_pos(spin_id=None, str_id=None, ave_pos=False)

source code 

Load the spins from the structural object into the relax data store.

Parameters:
  • spin_id (str) - The molecule, residue, and spin identifier string.
  • str_id (int or str) - The structure identifier. This can be the file name, model number, or structure number.
  • ave_pos (bool) - A flag specifying if the average atom position or the atom position from all loaded structures is loaded into the SpinContainer.

load_spins(spin_id=None, str_id=None, mol_name_target=None, ave_pos=False)

source code 

Load the spins from the structural object into the relax data store.

Parameters:
  • spin_id (str) - The molecule, residue, and spin identifier string.
  • str_id (int or str) - The structure identifier. This can be the file name, model number, or structure number.
  • mol_name (str or None) - The name of target molecule container, overriding the name of the loaded structures
  • ave_pos (bool) - A flag specifying if the average atom position or the atom position from all loaded structures is loaded into the SpinContainer.

read_pdb(file=None, dir=None, read_mol=None, set_mol_name=None, read_model=None, set_model_num=None, parser='internal', alt_loc=None, verbosity=1, merge=False, fail=True)

source code 

The PDB loading function.

Parsers

A number of parsers are available for reading PDB files. These include:

  • 'scientific', the Scientific Python PDB parser.
  • 'internal', a low quality yet fast PDB parser built into relax.
Parameters:
  • file (str) - The name of the PDB file to read.
  • dir (str or None) - The directory where the PDB file is located. If set to None, then the file will be searched for in the current directory.
  • read_mol (None, int, or list of int) - The molecule(s) to read from the file, independent of model. The molecules are determined differently by the different parsers, but are numbered consecutively from 1. If set to None, then all molecules will be loaded.
  • set_mol_name (None, str, or list of str) - Set the names of the molecules which are loaded. If set to None, then the molecules will be automatically labelled based on the file name or other information.
  • read_model (None, int, or list of int) - The PDB model to extract from the file. If set to None, then all models will be loaded.
  • set_model_num (None, int, or list of int) - Set the model number of the loaded molecule. If set to None, then the PDB model numbers will be preserved, if they exist.
  • parser (str) - The parser to be used to read the PDB file.
  • alt_loc (str or None) - The PDB ATOM record 'Alternate location indicator' field value to select which coordinates to use.
  • verbosity (int) - The amount of information to print to screen. Zero corresponds to minimal output while higher values increase the amount of output. The default value is 1.
  • merge (bool) - A flag which if set to True will try to merge the PDB structure into the currently loaded structures.
  • fail (bool) - A flag which, if True, will cause a RelaxError to be raised if the PDB file does not exist. If False, then a RelaxWarning will be trown instead.
Raises:
  • RelaxFileError - If the fail flag is set, then a RelaxError is raised if the PDB file does not exist.

read_xyz(file=None, dir=None, read_mol=None, set_mol_name=None, read_model=None, set_model_num=None, verbosity=1, fail=True)

source code 

The XYZ loading function.

Parameters:
  • file (str) - The name of the XYZ file to read.
  • dir (str or None) - The directory where the XYZ file is located. If set to None, then the file will be searched for in the current directory.
  • read_mol (None, int, or list of int) - The molecule(s) to read from the file, independent of model. If set to None, then all molecules will be loaded.
  • set_mol_name (None, str, or list of str) - Set the names of the molecules which are loaded. If set to None, then the molecules will be automatically labelled based on the file name or other information.
  • read_model (None, int, or list of int) - The XYZ model to extract from the file. If set to None, then all models will be loaded.
  • set_model_num (None, int, or list of int) - Set the model number of the loaded molecule. If set to None, then the XYZ model numbers will be preserved, if they exist.
  • fail (bool) - A flag which, if True, will cause a RelaxError to be raised if the XYZ file does not exist. If False, then a RelaxWarning will be trown instead.
  • verbosity (int) - The amount of information to print to screen. Zero corresponds to minimal output while higher values increase the amount of output. The default value is 1.
Raises:
  • RelaxFileError - If the fail flag is set, then a RelaxError is raised if the XYZ file does not exist.

rmsd(atom_id=None, models=None)

source code 

Calculate the RMSD between the loaded models.

Parameters:
  • atom_id (str or None) - The molecule, residue, and atom identifier string. Only atoms matching this selection will be used.
  • models (list of int or None) - The list of models to calculate the RMDS of. If set to None, then all models will be used.
Returns: float
The RMSD value.

rotate(R=None, origin=None, model=None, atom_id=None)

source code 

Rotate the structural data about the origin by the specified forwards rotation.

Parameters:
  • R (numpy 3D, rank-2 array or a 3x3 list of floats) - The forwards rotation matrix.
  • origin (numpy 3D, rank-1 array or list of len 3 or None) - The origin of the rotation. If not supplied, the origin will be set to [0, 0, 0].
  • model (int) - The model to rotate. If None, all models will be rotated.
  • atom_id (str or None) - The molecule, residue, and atom identifier string. Only atoms matching this selection will be used.

set_vector(spin=None, xh_vect=None)

source code 

Place the XH unit vector into the spin container object.

Parameters:
  • spin (SpinContainer instance) - The spin container object.
  • xh_vect (array of len 3) - The unit vector parallel to the XH bond.

superimpose(models=None, method='fit to mean', atom_id=None, centroid=None)

source code 

Superimpose a set of structural models.

Parameters:
  • models (list of int or None) - The list of models to superimpose. If set to None, then all models will be used.
  • method (str) - The superimposition method. It must be one of 'fit to mean' or 'fit to first'.
  • atom_id (str or None) - The molecule, residue, and atom identifier string. This matches the spin ID string format.
  • centroid (list of float or numpy rank-1, 3D array) - An alternative position of the centroid to allow for different superpositions, for example of pivot point motions.

translate(T=None, model=None, atom_id=None)

source code 

Shift the structural data by the specified translation vector.

Parameters:
  • T (numpy rank-1, 3D array or list of float) - The translation vector.
  • model (int or None) - The model to translate. If None, all models will be rotated.
  • atom_id (str or None) - The molecule, residue, and atom identifier string. Only atoms matching this selection will be used.

vectors(spin_id1=None, spin_id2=None, model=None, verbosity=1, ave=True, unit=True)

source code 

Extract the bond vectors from the loaded structures and store them in the spin container.

Parameters:
  • spin_id1 (str) - The spin identifier string of the first spin of the pair.
  • spin_id2 (str) - The spin identifier string of the second spin of the pair.
  • model (str) - The model to extract the vector from. If None, all vectors will be extracted.
  • verbosity (int) - The higher the value, the more information is printed to screen.
  • ave (bool) - A flag which if True will cause the average of all vectors to be extracted.
  • unit (bool) - A flag which if True will cause the function to calculate the unit vectors.

web_of_motion(file=None, dir=None, models=None, force=False)

source code 

Create a PDB representation of the motion between a set of models.

This will create a PDB file containing the atoms of all models, with identical atoms links using CONECT records. This function only supports the internal structural object.

Parameters:
  • file (str) - The name of the PDB file to write.
  • dir (str or None) - The directory where the PDB file will be placed. If set to None, then the file will be placed in the current directory.
  • models (list of int or None) - The optional list of models to restrict this to.
  • force (bool) - The force flag which if True will cause the file to be overwritten.

write_pdb(file=None, dir=None, model_num=None, compress_type=0, force=False)

source code 

The PDB writing function.

Parameters:
  • file (str) - The name of the PDB file to write.
  • dir (str or None) - The directory where the PDB file will be placed. If set to None, then the file will be placed in the current directory.
  • model_num (None or int) - The model to place into the PDB file. If not supplied, then all models will be placed into the file.
  • compress_type (int) - The compression type. The integer values correspond to the compression type: 0, no compression; 1, Bzip2 compression; 2, Gzip compression.
  • force (bool) - The force flag which if True will cause the file to be overwritten.