Package generic_fns :: Module relax_data
[hide private]
[frames] | no frames]

Module relax_data

source code

Module for the manipulation of relaxation data.

Functions [hide private]
 
back_calc(ri_id=None, ri_type=None, frq=None)
Back calculate the relaxation data.
source code
 
bmrb_read(star, sample_conditions=None)
Read the relaxation data from the NMR-STAR dictionary object.
source code
 
bmrb_write(star)
Generate the relaxation data saveframes for the NMR-STAR dictionary object.
source code
 
copy(pipe_from=None, pipe_to=None, ri_id=None)
Copy the relaxation data from one data pipe to another.
source code
str
create_frq_label(frq)
Generate a frequency label in MHz, rounded to the nearest factor of 10.
source code
 
delete(ri_id=None)
Delete relaxation data corresponding to the relaxation data ID.
source code
 
display(ri_id=None)
Display relaxation data corresponding to the ID.
source code
float
frq_loop()
Generator function for returning each unique frequency.
source code
list of str
get_data_names(global_flag=False, sim_names=False)
Return a list of names of data structures associated with relaxation data.
source code
int
num_frq()
Determine the number of unique frequencies.
source code
 
pack_data(ri_id, ri_type, frq, values, errors, spin_ids=None, mol_names=None, res_nums=None, res_names=None, spin_nums=None, spin_names=None, gen_seq=False)
Pack the relaxation data into the data pipe and spin containers.
source code
 
peak_intensity_type(ri_id=None, type=None)
Set the type of intensity measured for the peaks.
source code
 
read(ri_id=None, ri_type=None, frq=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 R1, R2, or NOE relaxation data from a file.
source code
 
return_data_desc(name)
Return a description of the spin specific object.
source code
 
return_value(spin, data_type, bc=False)
Return the value and error corresponding to 'data_type'.
source code
 
temp_calibration(ri_id=None, method=None)
Set the temperature calibration method.
source code
 
temp_control(ri_id=None, method=None)
Set the temperature control method.
source code
 
write(ri_id=None, file=None, dir=None, bc=False, force=False)
Write relaxation data to a file.
source code
Variables [hide private]
  ds = The relax data storage obje...
  VALID_TYPES = ['R1', 'R2', 'NOE']
  __package__ = 'generic_fns'

Imports: deepcopy, array, float64, int32, ones, zeros, string, sys, warn, Relax_data_store, ExpInfo, bmrb, create_spin, exists_mol_res_spin_data, find_index, generate_spin_id, get_molecule_names, return_spin, spin_index_loop, spin_loop, pipes, value, element_from_isotope, number_from_isotope, RelaxError, RelaxNoRiError, RelaxNoSequenceError, RelaxNoSpinError, RelaxRiError, read_spin_data, RelaxWarning, specific_fns


Function Details [hide private]

back_calc(ri_id=None, ri_type=None, frq=None)

source code 

Back calculate the relaxation data.

If no relaxation data currently exists, then the ri_id, ri_type, and frq args are required.

Parameters:
  • ri_id (None or str) - The relaxation data ID string. If not given, all relaxation data will be back calculated.
  • ri_type (None or str) - The relaxation data type. This should be one of 'R1', 'R2', or 'NOE'.
  • frq (None or float) - The spectrometer proton frequency in Hz.

bmrb_read(star, sample_conditions=None)

source code 

Read the relaxation data from the NMR-STAR dictionary object.

Parameters:
  • star (NMR_STAR instance) - The NMR-STAR dictionary object.
  • sample_conditions (None or str) - The sample condition label to read. Only one sample condition can be read per data pipe.

bmrb_write(star)

source code 

Generate the relaxation data saveframes for the NMR-STAR dictionary object.

Parameters:
  • star (NMR_STAR instance) - The NMR-STAR dictionary object.

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

source code 

Copy the relaxation data from one data pipe to another.

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

create_frq_label(frq)

source code 

Generate a frequency label in MHz, rounded to the nearest factor of 10.

Parameters:
  • frq (float) - The frequency in Hz.
Returns: str
The MHz frequency label.

delete(ri_id=None)

source code 

Delete relaxation data corresponding to the relaxation data ID.

Parameters:
  • ri_id (str) - The relaxation data ID string.

display(ri_id=None)

source code 

Display relaxation data corresponding to the ID.

Parameters:
  • ri_id (str) - The relaxation data ID string.

frq_loop()

source code 

Generator function for returning each unique frequency.

Returns: float
The frequency.

get_data_names(global_flag=False, sim_names=False)

source code 

Return a list of names of data structures associated with relaxation data.

Description

The names are as follows:

ri_data: Relaxation data.

ri_data_err: Relaxation data error.

ri_data_bc: The back calculated relaxation data.

ri_type: The relaxation data type, i.e. one of ['NOE', 'R1', 'R2']

frq: NMR frequencies in Hz, eg [600.0 * 1e6, 500.0 * 1e6]

Parameters:
  • global_flag (bool) - A flag which if True corresponds to the pipe specific data structures and if False corresponds to the spin specific data structures.
  • sim_names (bool) - A flag which if True will add the Monte Carlo simulation object names as well.
Returns: list of str
The list of object names.

num_frq()

source code 

Determine the number of unique frequencies.

Returns: int
The number of unique frequencies.

pack_data(ri_id, ri_type, frq, values, errors, spin_ids=None, mol_names=None, res_nums=None, res_names=None, spin_nums=None, spin_names=None, gen_seq=False)

source code 

Pack the relaxation data into the data pipe and spin containers.

The values, errors, and spin_ids arguments must be lists of equal length or None. Each element i corresponds to a unique spin.

Parameters:
  • ri_id (str) - The relaxation data ID string.
  • ri_type (str) - The relaxation data type, ie 'R1', 'R2', or 'NOE'.
  • frq (float) - The spectrometer proton frequency in Hz.
  • values (None or list of float or float array) - The relaxation data for each spin.
  • errors (None or list of float or float array) - The relaxation data errors for each spin.
  • spin_ids (None or list of str) - The list of spin ID strings. If the other spin identifiers are given, i.e. mol_names, res_nums, res_names, spin_nums, and/or spin_names, then this argument is not necessary.
  • mol_names (None or list of str) - The list of molecule names used for creating the spin IDs (if not given) or for generating the sequence data.
  • res_nums (None or list of str) - The list of residue numbers used for creating the spin IDs (if not given) or for generating the sequence data.
  • res_names (None or list of str) - The list of residue names used for creating the spin IDs (if not given) or for generating the sequence data.
  • spin_nums (None or list of str) - The list of spin numbers used for creating the spin IDs (if not given) or for generating the sequence data.
  • spin_names (None or list of str) - The list of spin names used for creating the spin IDs (if not given) or for generating the sequence data.
  • gen_seq (bool) - A flag which if True will cause the molecule, residue, and spin sequence data to be generated.

peak_intensity_type(ri_id=None, type=None)

source code 

Set the type of intensity measured for the peaks.

Parameters:
  • ri_id (str) - The relaxation data ID string.
  • type (str) - The peak intensity type, one of 'height' or 'volume'.

read(ri_id=None, ri_type=None, frq=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 R1, R2, or NOE relaxation data from a file.

Parameters:
  • ri_id (str) - The relaxation data ID string.
  • ri_type (str) - The relaxation data type, ie 'R1', 'R2', or 'NOE'.
  • frq (float) - The spectrometer proton frequency in Hz.
  • 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 relaxation data.
  • error_col (int or None) - The column containing the relaxation data 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_data_desc(name)

source code 

Return a description of the spin specific object.

Parameters:
  • name (str) - The name of the spin specific object.

return_value(spin, data_type, bc=False)

source code 

Return the value and error corresponding to 'data_type'.

Parameters:
  • spin (SpinContainer instance) - The spin container.
  • data_type (str) - The relaxation data ID string.
  • bc (bool) - A flag which if True will cause the back calculated relaxation data to be written.

temp_calibration(ri_id=None, method=None)

source code 

Set the temperature calibration method.

Parameters:
  • ri_id (str) - The relaxation data type, ie 'R1', 'R2', or 'NOE'.
  • method (str) - The temperature calibration method.

temp_control(ri_id=None, method=None)

source code 

Set the temperature control method.

Parameters:
  • ri_id (str) - The relaxation data ID string.
  • method (str) - The temperature control method.

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

source code 

Write relaxation data to a file.

Parameters:
  • ri_id (str) - The relaxation data ID string.
  • file (str) - The name of the file to create.
  • dir (str or None) - The directory to write to.
  • bc (bool) - A flag which if True will cause the back calculated relaxation data to be written.
  • force (bool) - A flag which if True will cause any pre-existing file to be overwritten.

Variables Details [hide private]

ds

Value:
The relax data storage object.

Data pipes:
  None

Data store objects:
  __dict__ <type 'dict'>: dict() -> new empty dictionary
  __doc__ <type 'str'>: The relax data storage object.
...