Package pipe_control :: Module pcs
[hide private]
[frames] | no frames]

Module pcs

source code

Module for the manipulation of pseudo-contact shift data.

Functions [hide private]
 
back_calc(align_id=None)
Back calculate the PCS from the alignment tensor.
source code
 
centre(pos=None, atom_id=None, pipe=None, verbosity=1, ave_pos=False, force=False)
Specify the atom in the loaded structure corresponding to the paramagnetic centre.
source code
 
check_pipe_setup(pipe=None, pcs_id=None, sequence=False, N=False, tensors=False, pcs=False, paramag_centre=False)
Check that the current data pipe has been setup sufficiently.
source code
 
copy(pipe_from=None, pipe_to=None, align_id=None)
Copy the PCS data from one data pipe to another.
source code
 
corr_plot(format=None, file=None, dir=None, force=False)
Generate a correlation plot of the measured vs.
source code
 
delete(align_id=None)
Delete the PCS data corresponding to the alignment ID.
source code
 
display(align_id=None, bc=False)
Display the PCS data corresponding to the alignment ID.
source code
bool
opt_uses_pcs(align_id)
Determine if the PCS data for the given alignment ID is needed for optimisation.
source code
 
q_factors(spin_id=None)
Calculate the Q-factors for the PCS data.
source code
 
read(align_id=None, file=None, dir=None, file_data=None, spin_id_col=None, mol_name_col=None, res_num_col=None, res_name_col=None, spin_num_col=None, spin_name_col=None, data_col=None, error_col=None, sep=None, spin_id=None)
Read the PCS data from file.
source code
tuple of (numpy rank-2 float64 array, numpy rank-2 float64 array, numpy rank-2 float64 array, list of float, list of float, numpy rank-1 int32 array)
return_pcs_data(sim_index=None)
Set up the data structures for optimisation using PCSs as base data sets.
source code
 
set_errors(align_id=None, spin_id=None, sd=None)
Set the PCS errors if not already present.
source code
 
setup_pseudoatom_pcs()
Make sure that the spin systems are properly set up for pseudo-atoms and PCSs.
source code
 
structural_noise(align_id=None, rmsd=0.2, sim_num=1000, file=None, dir=None, force=False)
Determine the PCS error due to structural noise via simulation.
source code
 
weight(align_id=None, spin_id=None, weight=1.0)
Set optimisation weights on the PCS data.
source code
 
write(align_id=None, file=None, dir=None, bc=False, force=False)
Display the PCS data corresponding to the alignment ID.
source code
Variables [hide private]
  __package__ = 'pipe_control'

Imports: deepcopy, pi, sqrt, array, float64, int32, ones, std, zeros, norm, gauss, sys, warn, ave_pcs_tensor, pcs_tensor, RelaxError, RelaxNoAlignError, RelaxNoPdbError, RelaxNoPCSError, RelaxNoSequenceError, random_unit_vector, open_write_file, read_spin_data, write_spin_data, g1H, pcs_constant, RelaxWarning, RelaxNoSpinWarning, grace, pipes, get_tensor_index, get_tensor_object, opt_uses_align_data, opt_uses_tensor, exists_mol_res_spin_data, generate_spin_id_unique, is_pseudoatom, return_spin, spin_index_loop, spin_loop


Function Details [hide private]

back_calc(align_id=None)

source code 

Back calculate the PCS from the alignment tensor.

Parameters:
  • align_id (str) - The alignment tensor ID string.

centre(pos=None, atom_id=None, pipe=None, verbosity=1, ave_pos=False, force=False)

source code 

Specify the atom in the loaded structure corresponding to the paramagnetic centre.

Parameters:
  • pos (list of float) - The atomic position. If set, the atom_id string will be ignored.
  • atom_id (str) - The atom identification string.
  • pipe (None or str) - An alternative data pipe to extract the paramagnetic centre from.
  • verbosity (int) - The amount of information to print out. The bigger the number, the more information.
  • ave_pos (bool) - A flag which if True causes the atomic positions from multiple models to be averaged.
  • force - A flag which if True will cause the current PCS centre to be overwritten.

check_pipe_setup(pipe=None, pcs_id=None, sequence=False, N=False, tensors=False, pcs=False, paramag_centre=False)

source code 

Check that the current data pipe has been setup sufficiently.

Parameters:
  • pipe (None or str) - The data pipe to check, defaulting to the current pipe.
  • pcs_id (None or str) - The PCS ID string to check for in cdp.pcs_ids.
  • sequence (bool) - A flag which when True will invoke the sequence data check.
  • N (bool) - A flag which if True will check that cdp.N is set.
  • tensors (bool) - A flag which if True will check that alignment tensors exist.
  • pcs (bool) - A flag which if True will check that PCSs exist.
  • paramag_centre (bool) - A flag which if True will check that the paramagnetic centre has been set.

copy(pipe_from=None, pipe_to=None, align_id=None)

source code 

Copy the PCS data from one data pipe to another.

Parameters:
  • pipe_from (str) - The data pipe to copy the PCS data from. This defaults to the current data pipe.
  • pipe_to (str) - The data pipe to copy the PCS data to. This defaults to the current data pipe.
  • align_id (str) - The alignment ID string.

corr_plot(format=None, file=None, dir=None, force=False)

source code 

Generate a correlation plot of the measured vs. back-calculated PCSs.

Parameters:
  • format (str or None) - The format for the plot file. The following values are accepted: 'grace', a Grace plot; None, a plain text file.
  • file (str or file object) - The file name or object to write to.
  • dir (str) - The name of the directory to place the file into (defaults to the current directory).
  • force (bool) - A flag which if True will cause any pre-existing file to be overwritten.

delete(align_id=None)

source code 

Delete the PCS data corresponding to the alignment ID.

Parameters:
  • align_id (str or None) - The alignment tensor ID string. If not specified, all data will be deleted.

display(align_id=None, bc=False)

source code 

Display the PCS data corresponding to the alignment ID.

Parameters:
  • align_id (str) - The alignment tensor ID string.
  • bc (bool) - The back-calculation flag which if True will cause the back-calculated rather than measured data to be displayed.

opt_uses_pcs(align_id)

source code 

Determine if the PCS data for the given alignment ID is needed for optimisation.

Parameters:
  • align_id (str) - The alignment ID string.
Returns: bool
True if the PCS data is to be used for optimisation, False otherwise.

q_factors(spin_id=None)

source code 

Calculate the Q-factors for the PCS data.

Parameters:
  • spin_id (None or str) - The spin ID string used to restrict the Q-factor calculation to a subset of all spins.

read(align_id=None, file=None, dir=None, file_data=None, spin_id_col=None, mol_name_col=None, res_num_col=None, res_name_col=None, spin_num_col=None, spin_name_col=None, data_col=None, error_col=None, sep=None, spin_id=None)

source code 

Read the PCS data from file.

Parameters:
  • align_id (str) - The alignment tensor ID string.
  • file (str) - The name of the file to open.
  • dir (str or None) - The directory containing the file (defaults to the current directory if None).
  • file_data (list of lists) - An alternative opening a file, if the data already exists in the correct format. The format is a list of lists where the first index corresponds to the row and the second the column.
  • spin_id_col (int or None) - The column containing the spin ID strings. If supplied, the mol_name_col, res_name_col, res_num_col, spin_name_col, and spin_num_col arguments must be none.
  • mol_name_col (int or None) - The column containing the molecule name information. If supplied, spin_id_col must be None.
  • res_name_col (int or None) - The column containing the residue name information. If supplied, spin_id_col must be None.
  • res_num_col (int or None) - The column containing the residue number information. If supplied, spin_id_col must be None.
  • spin_name_col (int or None) - The column containing the spin name information. If supplied, spin_id_col must be None.
  • spin_num_col (int or None) - The column containing the spin number information. If supplied, spin_id_col must be None.
  • data_col (int or None) - The column containing the PCS data in Hz.
  • error_col (int or None) - The column containing the PCS errors.
  • sep (str or None) - The column separator which, if None, defaults to whitespace.
  • spin_id (None or str) - The spin ID string used to restrict data loading to a subset of all spins.

return_pcs_data(sim_index=None)

source code 

Set up the data structures for optimisation using PCSs as base data sets.

Parameters:
  • sim_index (None or int) - The index of the simulation to optimise. This should be None if normal optimisation is desired.
Returns: tuple of (numpy rank-2 float64 array, numpy rank-2 float64 array, numpy rank-2 float64 array, list of float, list of float, numpy rank-1 int32 array)
The assembled data structures for using PCSs as the base data for optimisation. These include:
  • the PCS values.
  • the unit vectors connecting the paramagnetic centre (the electron spin) to the spin.
  • the PCS weight.
  • the experimental temperatures.
  • the spectrometer frequencies.
  • pseudo_flags, the list of flags indicating if the interatomic data contains a pseudo-atom (as 1's and 0's).

set_errors(align_id=None, spin_id=None, sd=None)

source code 

Set the PCS errors if not already present.

Parameters:
  • align_id (str) - The optional alignment tensor ID string.
  • spin_id (None or str) - The optional spin ID string.
  • sd (float or int.) - The PCS standard deviation in ppm.

setup_pseudoatom_pcs()

source code 

Make sure that the spin systems are properly set up for pseudo-atoms and PCSs.

All spin data containers which are a member of a pseudo-atom will be deselected.

structural_noise(align_id=None, rmsd=0.2, sim_num=1000, file=None, dir=None, force=False)

source code 

Determine the PCS error due to structural noise via simulation.

For the simulation the following must already be set up in the current data pipe:

  • The position of the paramagnetic centre.
  • The alignment and magnetic susceptibility tensor.

The protocol for the simulation is as follows:

  • The lanthanide or paramagnetic centre position will be fixed. Its motion is assumed to be on the femto- to pico- and nanosecond timescales. Hence the motion is averaged over the evolution of the PCS and can be ignored.
  • The positions of the nuclear spins will be randomised N times. For each simulation a random unit vector will be generated. Then a random distance along the unit vector will be generated by sampling from a Gaussian distribution centered at zero, the original spin position, with a standard deviation set to the given RMSD. Both positive and negative displacements will be used.
  • The PCS for the randomised position will be back calculated.
  • The PCS standard deviation will be calculated from the N randomised PCS values.

The standard deviation will both be stored in the spin container data structure in the relax data store as well as being added to the already present PCS error (using variance addition). This will then be used in any optimisations involving the PCS.

If the alignment ID string is not supplied, the procedure will be applied to the PCS data from all alignments.

Parameters:
  • align_id (str) - The alignment tensor ID string.
  • rmsd (float) - The atomic position RMSD, in Angstrom, to randomise the spin positions with for the simulations.
  • sim_num (int) - The number of simulations, N, to perform to determine the structural noise component of the PCS errors.
  • file (None or str) - The optional name of the Grace file to plot the structural errors verses the paramagnetic centre to spin distances.
  • dir (None or str) - The directory name to place the Grace file into.
  • force (bool) - A flag which if True will cause any pre-existing file to be overwritten.

weight(align_id=None, spin_id=None, weight=1.0)

source code 

Set optimisation weights on the PCS data.

Parameters:
  • align_id (str) - The alignment tensor ID string.
  • spin_id (None or str) - The spin ID string.
  • weight (float or int.) - The optimisation weight. The higher the value, the more importance the PCS will have.

write(align_id=None, file=None, dir=None, bc=False, force=False)

source code 

Display the PCS data corresponding to the alignment ID.

Parameters:
  • align_id (str) - The alignment tensor ID string.
  • file (str or file object) - The file name or object to write to.
  • dir (str) - The name of the directory to place the file into (defaults to the current directory).
  • bc (bool) - The back-calculation flag which if True will cause the back-calculated rather than measured data to be written.
  • force (bool) - A flag which if True will cause any pre-existing file to be overwritten.