Package lib :: Module sequence
[hide private]
[frames] | no frames]

Module sequence

source code

Functions [hide private]
str, list of [str, float], or list of [str, float, float]
read_spin_data(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)
Generator function for reading the spin specific data from file.
source code
 
validate_sequence(data, 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)
Test if the sequence data is valid.
source code
 
write_spin_data(file, dir=None, sep=None, spin_ids=None, mol_names=None, res_nums=None, res_names=None, spin_nums=None, spin_names=None, force=False, data=None, data_name=None, error=None, error_name=None, float_format='%20.15g')
Generator function for reading the spin specific data from file.
source code
Variables [hide private]
  __package__ = None
hash(x)

Imports: sys, warn, is_float, RelaxError, RelaxInvalidSeqError, extract_data, open_write_file, strip, write_data, spin_id_to_data_list, RelaxWarning, RelaxFileEmptyWarning


Function Details [hide private]

read_spin_data(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 

Generator function for reading the spin specific data from file.

Description

This function reads a columnar formatted file where each line corresponds to a spin system. Spin identification is either through a spin ID string or through columns containing the molecule name, residue name and number, and/or spin name and number.

Parameters:
  • 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.
  • 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 data.
  • error_col (int or None) - The column containing the 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.
Returns: str, list of [str, float], or list of [str, float, float]
A list of the spin specific data is yielded. The format is a list consisting of the spin ID string, the data value (if data_col is give), and the error value (if error_col is given). If both data_col and error_col are None, then the spin ID string is simply yielded.

validate_sequence(data, 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)

source code 

Test if the sequence data is valid.

The only function this performs is to raise a RelaxError if the data is invalid.

Parameters:
  • data (list of lists.) - The sequence data.
  • spin_id_col (int or None) - The column containing the spin ID strings.
  • mol_name_col (int or None) - The column containing the molecule name information.
  • res_name_col (int or None) - The column containing the residue name information.
  • res_num_col (int or None) - The column containing the residue number information.
  • spin_name_col (int or None) - The column containing the spin name information.
  • spin_num_col (int or None) - The column containing the spin number information.

write_spin_data(file, dir=None, sep=None, spin_ids=None, mol_names=None, res_nums=None, res_names=None, spin_nums=None, spin_names=None, force=False, data=None, data_name=None, error=None, error_name=None, float_format='%20.15g')

source code 

Generator function for reading the spin specific data from file.

Description

This function writes a columnar formatted file where each line corresponds to a spin system. Spin identification is either through a spin ID string or through columns containing the molecule name, residue name and number, and/or spin name and number.

Parameters:
  • file (str or file object) - The name of the file to write the data to (or alternatively an already opened file object).
  • dir (str or None) - The directory to place the file into (defaults to the current directory if None and the file argument is not a file object).
  • sep (str or None) - The column separator which, if None, defaults to whitespace.
  • spin_ids (None or list of str) - The list of spin ID strings.
  • mol_names (None or list of str) - The list of molecule names.
  • res_nums (None or list of int) - The list of residue numbers.
  • res_names (None or list of str) - The list of residue names.
  • spin_nums (None or list of int) - The list of spin numbers.
  • spin_names (None or list of str) - The list of spin names.
  • force (bool) - A flag which if True will cause an existing file to be overwritten.
  • data (list or list of lists) - A list of the data to write out. The first dimension corresponds to the spins. A second dimension can also be given if multiple data sets across multiple columns are desired.
  • data_name (str or list of str) - A name corresponding to the data argument. If the data argument is a list of lists, then this must also be a list with the same length as the second dimension of the data arg.
  • error (list or list of lists) - A list of the errors to write out. The first dimension corresponds to the spins. A second dimension can also be given if multiple data sets across multiple columns are desired. These will be inter-dispersed between the data columns, if the data is given. If the data arg is not None, then this must have the same dimensions as that object.
  • error_name (str or list of str) - A name corresponding to the error argument. If the error argument is a list of lists, then this must also be a list with the same length at the second dimension of the error arg.
  • float_format (str) - A float formatting string to use for the data and error whenever a float is found.