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

Module rdc

source code

Module for the manipulation of RDC data.

Functions [hide private]
 
back_calc(align_id=None)
Back calculate the RDC from the alignment tensor and unit bond vectors.
source code
 
check_pipe_setup(pipe=None, rdc_id=None, sequence=False, N=False, tensors=False, rdc=False)
Check that the current data pipe has been setup sufficiently.
source code
bool
check_rdcs(interatom)
Check if all data required for calculating the RDC is present.
source code
float or None
convert(value, data_type, align_id, to_intern=False)
Convert the RDC based on the 'D' or '2D' data type.
source code
 
copy(pipe_from=None, pipe_to=None, align_id=None, back_calc=True)
Copy the RDC data from one data pipe to another.
source code
 
corr_plot(format=None, title=None, subtitle=None, file=None, dir=None, force=False)
Generate a correlation plot of the measured vs.
source code
 
delete(align_id=None)
Delete the RDC data corresponding to the alignment ID.
source code
 
display(align_id=None, bc=False)
Display the RDC data corresponding to the alignment ID.
source code
bool
opt_uses_j_couplings()
Determine of J couplings are needed for optimisation.
source code
bool
opt_uses_rdc(align_id)
Determine if the RDC data for the given alignment ID is needed for optimisation.
source code
 
q_factors(spin_id=None, sim_index=None, verbosity=1)
Calculate the Q factors for the RDC data.
source code
 
read(align_id=None, file=None, dir=None, file_data=None, data_type='D', spin_id1_col=None, spin_id2_col=None, data_col=None, error_col=None, sep=None, neg_g_corr=False, absolute=False)
Read the RDC data from file.
source code
tuple of (numpy rank-2 float64 array, numpy rank-2 float64 array, numpy rank-2 float64 array, list of numpy rank-3 float64 arrays, list of lists of floats, numpy rank-2 int32 array, numpy rank-2 int32 array, numpy rank-2 float64 array, numpy rank-1 int32 array)
return_rdc_data(sim_index=None, verbosity=0)
Set up the data structures for optimisation using RDCs as base data sets.
source code
 
set_errors(align_id=None, spin_id1=None, spin_id2=None, sd=None)
Set the RDC errors if not already present.
source code
 
setup_pseudoatom_rdc()
Make sure that the interatom system is properly set up for pseudo-atoms and RDCs.
source code
 
weight(align_id=None, spin_id=None, weight=1.0)
Set optimisation weights on the RDC data.
source code
 
write(align_id=None, file=None, dir=None, bc=False, force=False)
Display the RDC data corresponding to the alignment ID.
source code
Variables [hide private]
  __package__ = 'pipe_control'

Imports: deepcopy, ceil, floor, pi, sqrt, array, int32, float64, ones, transpose, zeros, norm, sys, warn, is_float, nan, ave_rdc_tensor, RelaxError, RelaxNoAlignError, RelaxNoJError, RelaxNoRDCError, RelaxNoSequenceError, RelaxSpinTypeError, extract_data, open_write_file, strip, write_data, periodic_table, dipolar_constant, write_xy_data, write_xy_header, RelaxWarning, RelaxSpinTypeWarning, pipes, get_tensor_index, get_tensor_object, opt_uses_align_data, opt_uses_tensor, create_interatom, interatomic_loop, return_interatom, exists_mol_res_spin_data, is_pseudoatom, pseudoatom_loop, return_spin, check_pipe


Function Details [hide private]

back_calc(align_id=None)

source code 

Back calculate the RDC from the alignment tensor and unit bond vectors.

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

check_pipe_setup(pipe=None, rdc_id=None, sequence=False, N=False, tensors=False, rdc=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.
  • rdc_id (None or str) - The RDC ID string to check for in cdp.rdc_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.
  • rdc (bool) - A flag which if True will check that RDCs exist.

check_rdcs(interatom)

source code 

Check if all data required for calculating the RDC is present.

Parameters:
  • interatom (InteratomContainer instance) - The interatomic data container.
Returns: bool
True if all data required for calculating the RDC is present, False otherwise.

convert(value, data_type, align_id, to_intern=False)

source code 

Convert the RDC based on the 'D' or '2D' data type.

Parameters:
  • value (float or None) - The value or error to convert.
  • data_type (str) - The RDC data type. Either 'D', '2D' or 'T'.
  • align_id (str) - The alignment tensor ID string.
  • to_intern (bool) - A flag which if True will convert to the internal D notation if needed, or if False will convert from the internal D notation to the external D or 2D format.
Returns: float or None
The converted value.

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

source code 

Copy the RDC data from one data pipe to another.

Parameters:
  • pipe_from (str) - The data pipe to copy the RDC data from. This defaults to the current data pipe.
  • pipe_to (str) - The data pipe to copy the RDC data to. This defaults to the current data pipe.
  • align_id (str) - The alignment ID string.
  • back_calc (bool) - A flag which if True will cause any back-calculated RDCs present to also be copied with the real values and errors.

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

source code 

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

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.
  • title (None or str) - The title for the plot, overriding the default.
  • subtitle (None or str) - The subtitle for the plot, overriding the default.
  • 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 RDC 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 RDC 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_j_couplings()

source code 

Determine of J couplings are needed for optimisation.

Returns: bool
True if J couplings are required, False otherwise.

opt_uses_rdc(align_id)

source code 

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

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

q_factors(spin_id=None, sim_index=None, verbosity=1)

source code 

Calculate the Q factors for the RDC data.

Parameters:
  • spin_id (None or str) - The spin ID string used to restrict the Q factor calculation to a subset of all spins.
  • sim_index (None or int) - The optional Monte Carlo simulation index.
  • verbosity (int) - A flag specifying the amount of information to print. The higher the value, the greater the verbosity.

read(align_id=None, file=None, dir=None, file_data=None, data_type='D', spin_id1_col=None, spin_id2_col=None, data_col=None, error_col=None, sep=None, neg_g_corr=False, absolute=False)

source code 

Read the RDC 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 to 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.
  • data_type - A string which is set to 'D' means that the splitting in the aligned sample was assumed to be J + D, or if set to '2D' then the splitting was taken as J + 2D. If set to 'T', then the data will be marked as being J+D values.
  • spin_id1_col (int) - The column containing the spin ID strings of the first spin.
  • spin_id2_col (int) - The column containing the spin ID strings of the second spin.
  • data_col (int or None) - The column containing the RDC data in Hz.
  • error_col (int or None) - The column containing the RDC errors.
  • sep (str or None) - The column separator which, if None, defaults to whitespace.
  • neg_g_corr (bool) - A flag which is used to correct for the negative gyromagnetic ratio of 15N. If True, a sign inversion will be applied to all RDC values to be loaded.
  • absolute (bool) - A flag which if True indicates that the RDCs to load are signless. All RDCs will then be converted to positive values.

return_rdc_data(sim_index=None, verbosity=0)

source code 

Set up the data structures for optimisation using RDCs 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.
  • verbosity (int) - A flag specifying the amount of information to print. The higher the value, the greater the verbosity.
Returns: tuple of (numpy rank-2 float64 array, numpy rank-2 float64 array, numpy rank-2 float64 array, list of numpy rank-3 float64 arrays, list of lists of floats, numpy rank-2 int32 array, numpy rank-2 int32 array, numpy rank-2 float64 array, numpy rank-1 int32 array)
The assembled data structures for using RDCs as the base data for optimisation. These include:
  • rdc, the RDC values.
  • rdc_err, the RDC errors.
  • rdc_weight, the RDC weights.
  • vectors, the interatomic vectors (pseudo-atom dependent).
  • rdc_const, the dipolar constants (pseudo-atom dependent).
  • absolute, the absolute value flags (as 1's and 0's).
  • T_flags, the flags for T = J+D type data (as 1's and 0's).
  • j_couplings, the J coupling values if the RDC data type is set to T = J+D.
  • 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_id1=None, spin_id2=None, sd=None)

source code 

Set the RDC errors if not already present.

Parameters:
  • align_id (str) - The optional alignment tensor ID string.
  • spin_id1 (None or str) - The optional spin ID string of the first spin.
  • spin_id2 (None or str) - The optional spin ID string of the second spin.
  • sd (float or int.) - The RDC standard deviation in Hz.

setup_pseudoatom_rdc()

source code 

Make sure that the interatom system is properly set up for pseudo-atoms and RDCs.

Interatomic data containers between the non-pseudo-atom and the pseudo-atom members will be deselected.

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

source code 

Set optimisation weights on the RDC 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 RDC will have.

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

source code 

Display the RDC 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.