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

Module sequence

source code

Module for handling the molecule, residue, and spin sequence.

Functions [hide private]
 
attach_protons()
Attach a single proton to all heteronuclei.
source code
 
copy(pipe_from=None, pipe_to=None, preserve_select=False, empty=True, verbose=True)
Copy the molecule, residue, and spin sequence data from one data pipe to another.
source code
int
compare_sequence(pipe1=None, pipe2=None, fail=True)
Compare the sequence in two data pipes.
source code
 
display(sep=None, mol_name_flag=False, res_num_flag=False, res_name_flag=False, spin_num_flag=False, spin_name_flag=False)
Display the molecule, residue, and/or spin sequence data.
source code
 
generate(mol_name=None, res_num=None, res_name=None, spin_num=None, spin_name=None, pipe=None, select=True, verbose=True)
Generate the sequence item-by-item by adding a single molecule/residue/spin container as necessary.
source code
 
read(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, sep=None, spin_id=None)
Read the molecule, residue, and/or spin sequence data from file.
source code
list of SpinContainer instances
return_attached_protons(spin_hash=None)
Return a list of all proton spin containers attached to the given spin.
source code
 
write(file, dir=None, sep=None, mol_name_flag=True, res_num_flag=True, res_name_flag=True, spin_num_flag=True, spin_name_flag=True, force=False)
Write the molecule, residue, and/or sequence data.
source code
Variables [hide private]
  __package__ = 'pipe_control'

Imports: deepcopy, search, sys, RelaxError, RelaxDiffMolNumError, RelaxDiffResNumError, RelaxDiffSeqError, RelaxDiffSpinNumError, RelaxNoSequenceError, RelaxSequenceError, read_spin_data, write_spin_data, pipes, return_interatom_list, count_molecules, count_residues, count_spins, create_molecule, create_residue, create_spin, exists_mol_res_spin_data, generate_spin_id, return_molecule, return_residue, return_spin, set_spin_element, set_spin_isotope, spin_loop, check_pipe


Function Details [hide private]

copy(pipe_from=None, pipe_to=None, preserve_select=False, empty=True, verbose=True)

source code 

Copy the molecule, residue, and spin sequence data from one data pipe to another.

Parameters:
  • pipe_from (str) - The data pipe to copy the sequence data from. This defaults to the current data pipe.
  • pipe_to (str) - The data pipe to copy the sequence data to. This defaults to the current data pipe.
  • preserve_select (bool) - A flag which if True will cause spin selections to be preserved.
  • empty - A flag which if True will create a molecule, residue, and spin sequence in the target pipe lacking all of the spin data of the source pipe. If False, then the spin data will also be copied.
  • verbose (bool) - A flag which if True will cause info about each spin to be printed out as the sequence is generated.

compare_sequence(pipe1=None, pipe2=None, fail=True)

source code 

Compare the sequence in two data pipes.

Parameters:
  • pipe1 (str) - The name of the first data pipe.
  • pipe2 (str) - The name of the second data pipe.
  • fail (bool) - A flag which if True causes a RelaxError to be raised.
Returns: int
1 if the sequence is the same, 0 if different.
Raises:
  • RelaxError - If the sequence is different and the fail flag is True.

display(sep=None, mol_name_flag=False, res_num_flag=False, res_name_flag=False, spin_num_flag=False, spin_name_flag=False)

source code 

Display the molecule, residue, and/or spin sequence data.

This calls the write() function to do most of the work.

Parameters:
  • sep (str or None) - The column seperator which, if None, defaults to whitespace.
  • mol_name_flag (bool) - A flag which if True will cause the molecule name column to be written.
  • res_num_flag (bool) - A flag which if True will cause the residue number column to be written.
  • res_name_flag (bool) - A flag which if True will cause the residue name column to be written.
  • spin_name_flag (bool) - A flag which if True will cause the spin name column to be written.
  • spin_num_flag (bool) - A flag which if True will cause the spin number column to be written.
  • mol_name_flag (bool) - The column to contain the molecule name information.

generate(mol_name=None, res_num=None, res_name=None, spin_num=None, spin_name=None, pipe=None, select=True, verbose=True)

source code 

Generate the sequence item-by-item by adding a single molecule/residue/spin container as necessary.

Parameters:
  • mol_name (str or None) - The molecule name.
  • res_num (int or None) - The residue number.
  • res_name (str or None) - The residue name.
  • spin_num (int or None) - The spin number.
  • spin_name (str or None) - The spin name.
  • pipe (str) - The data pipe in which to generate the sequence. This defaults to the current data pipe.
  • select (bool) - The spin selection flag.
  • verbose (bool) - A flag which if True will cause info about each spin to be printed out as the sequence is generated.

read(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, sep=None, spin_id=None)

source code 

Read the molecule, residue, and/or spin sequence data from file.

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.
  • 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_attached_protons(spin_hash=None)

source code 

Return a list of all proton spin containers attached to the given spin.

Parameters:
  • spin_hash (str) - The unique spin hash.
Returns: list of SpinContainer instances
The list of proton spin containers attached to the given spin.

write(file, dir=None, sep=None, mol_name_flag=True, res_num_flag=True, res_name_flag=True, spin_num_flag=True, spin_name_flag=True, force=False)

source code 

Write the molecule, residue, and/or sequence data.

This calls the lib.io.write_spin_data() function to do most of the work.

Parameters:
  • file (str) - The name of the file to write the data to.
  • dir (str or None) - The directory to contain the file (defaults to the current directory if None).
  • sep (str or None) - The column seperator which, if None, defaults to whitespace.
  • mol_name_flag (bool) - A flag which if True will cause the molecule name column to be written.
  • res_num_flag (bool) - A flag which if True will cause the residue number column to be written.
  • res_name_flag (bool) - A flag which if True will cause the residue name column to be written.
  • spin_name_flag (bool) - A flag which if True will cause the spin name column to be written.
  • spin_num_flag - A flag which if True will cause the spin number column to be written.
  • force (bin) - A flag which if True will cause an existing file to be overwritten.