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

Module palmer

source code

Module for interfacing with Art Palmer's Modelfree 4 program.

Functions [hide private]
 
__deselect_spins()
Deselect spins with no or too little data, that are overfitting, etc.
source code
 
create(dir=None, binary=None, diff_search=None, sims=None, sim_type=None, trim=None, steps=None, heteronuc_type=None, atom1=None, atom2=None, spin_id=None, force=False, constraints=True)
Create the Modelfree4 input files.
source code
bool
create_mfdata(file, spin=None, spin_id=None, num_frq=None, frq=None)
Create the Modelfree4 input file 'mfmodel'.
source code
 
create_mfin(file, diff_search=None, sims=None, sim_type=None, trim=None, num_frq=None, frq=None)
Create the Modelfree4 input file 'mfin'.
source code
 
create_mfmodel(file, spin=None, spin_id=None, steps=None, constraints=None)
Create the Modelfree4 input file 'mfmodel'.
source code
 
create_mfpar(file, spin=None, spin_id=None, res_num=None, atom1=None, atom2=None)
Create the Modelfree4 input file 'mfpar'.
source code
 
create_run(file, binary=None, dir=None)
Create the script 'run.sh' for the execution of Modelfree4.
source code
 
execute(dir, force, binary)
Execute Modelfree4.
source code
 
extract(dir, spin_id=None)
Extract the Modelfree4 results out of the 'mfout' file.
source code
tuple of 2 floats
get_mf_data(mfout_lines, pos)
Extract the model-free data from the given position of the mfout file.
source code
tuple of int
line_positions(mfout_lines)
Function for getting the section positions (line number) of the mfout file.
source code
Variables [hide private]
  __package__ = 'pipe_control'

Imports: dep_check, pi, F_OK, access, chdir, chmod, getcwd, listdir, remove, sep, system, match, search, S_IRWXU, S_IRGRP, S_IROTH, PIPE, Popen, sys, RelaxError, RelaxDirError, RelaxFileError, RelaxNoInteratomError, RelaxNoModelError, RelaxNoPdbError, RelaxNoSequenceError, RelaxNoTensorError, mkdir_nofail, open_write_file, test_binary, return_gyromagnetic_ratio, diffusion_tensor, pipes, return_interatom_list, exists_mol_res_spin_data, spin_loop, determine_model_type


Function Details [hide private]

create(dir=None, binary=None, diff_search=None, sims=None, sim_type=None, trim=None, steps=None, heteronuc_type=None, atom1=None, atom2=None, spin_id=None, force=False, constraints=True)

source code 

Create the Modelfree4 input files.

The following files are created:

  • dir/mfin
  • dir/mfdata
  • dir/mfpar
  • dir/mfmodel
  • dir/run.sh
Parameters:
  • dir (str or None) - The optional directory to place the files into. If None, then the files will be placed into a directory named after the current data pipe.
  • binary (str) - The name of the Modelfree4 binary file. This can include the path to the binary.
  • diff_search (str) - The diffusion tensor search algorithm (see the Modelfree4 manual for details).
  • sims (int) - The number of Monte Carlo simulations to perform.
  • sim_type (str) - The type of simulation to perform (see the Modelfree4 manual for details).
  • trim (int) - Trimming of the Monte Carlo simulations (see the Modelfree4 manual for details).
  • steps (int) - The grid search size (see the Modelfree4 manual for details).
  • heteronuc_type (str) - The Modelfree4 three letter code for the heteronucleus type, e.g. '15N', '13C', etc.
  • atom1 (str) - The name of the heteronucleus in the PDB file.
  • atom2 (str) - The name of the proton in the PDB file.
  • spin_id (str) - The spin identification string.
  • force (bool) - A flag which if True will cause all pre-existing files to be overwritten.
  • constraints (bool) - A flag which if True will result in constrained optimisation.

create_mfdata(file, spin=None, spin_id=None, num_frq=None, frq=None)

source code 

Create the Modelfree4 input file 'mfmodel'.

Parameters:
  • file (file object) - The writable file object.
  • spin (SpinContainer instance) - The spin container.
  • spin_id - The spin identification string. @type spin_id str
  • num_frq (int) - The number of spectrometer frequencies relaxation data was collected at.
  • frq (list of float) - The spectrometer frequencies.
Returns: bool
True if file data is written, False otherwise.

create_mfin(file, diff_search=None, sims=None, sim_type=None, trim=None, num_frq=None, frq=None)

source code 

Create the Modelfree4 input file 'mfin'.

Parameters:
  • file (file object) - The writable file object.
  • diff_search (str) - The diffusion tensor search algorithm (see the Modelfree4 manual for details).
  • sims (int) - The number of Monte Carlo simulations to perform.
  • sim_type (str) - The type of simulation to perform (see the Modelfree4 manual for details).
  • trim (int) - Trimming of the Monte Carlo simulations (see the Modelfree4 manual for details).
  • num_frq (int) - The number of spectrometer frequencies relaxation data was collected at.
  • frq (list of float) - The spectrometer frequencies.

create_mfmodel(file, spin=None, spin_id=None, steps=None, constraints=None)

source code 

Create the Modelfree4 input file 'mfmodel'.

Parameters:
  • file (file object) - The writable file object.
  • spin (SpinContainer instance) - The spin container.
  • spin_id - The spin identification string. @type spin_id str
  • steps (int) - The grid search size (see the Modelfree4 manual for details).
  • constraints (bool) - A flag which if True will result in constrained optimisation.

create_mfpar(file, spin=None, spin_id=None, res_num=None, atom1=None, atom2=None)

source code 

Create the Modelfree4 input file 'mfpar'.

Parameters:
  • file (file object) - The writable file object.
  • spin (SpinContainer instance) - The spin container.
  • spin_id - The spin identification string. @type spin_id str
  • res_num (int) - The residue number from the PDB file corresponding to the spin.
  • atom1 (str) - The name of the heteronucleus in the PDB file.
  • atom2 (str) - The name of the proton in the PDB file.

create_run(file, binary=None, dir=None)

source code 

Create the script 'run.sh' for the execution of Modelfree4.

Parameters:
  • file (file object) - The writable file object.
  • binary (str) - The name of the Modelfree4 binary file. This can include the path to the binary.
  • dir (str) - The directory to copy the PDB file to.

execute(dir, force, binary)

source code 

Execute Modelfree4.

BUG: Control-C during execution causes the cwd to stay as dir.

Parameters:
  • dir (str or None) - The optional directory where the script is located.
  • force (bool) - A flag which if True will cause any pre-existing files to be overwritten by Modelfree4.
  • binary (str) - The name of the Modelfree4 binary file. This can include the path to the binary.

extract(dir, spin_id=None)

source code 

Extract the Modelfree4 results out of the 'mfout' file.

Parameters:
  • dir (str or None) - The directory containing the 'mfout' file.
  • spin_id (str or None) - The spin identification string.

get_mf_data(mfout_lines, pos)

source code 

Extract the model-free data from the given position of the mfout file.

This method is designed to catch a number of bugs in Modelfree4's mfout file.

The first bug is the presence of a series of '*' characters causing a fusion of two columns. This is handled by splitting by the '*' char and then returning the first element.

The second bug is when the floating point number is too big to fit into Modelfree4's string format limit of 15.3f. This results in a results line such as:

246 10000.00019682363392.000 1 0.000 0.000 0.000 0.000

This is caught by scanning for two '.' characters in the column, and handled by assuming that every floating point number will have three decimal characters.

Parameters:
  • mfout_lines (list of str) - A list of all the lines of the mfout file.
  • pos (int) - The mfout line position.
Returns: tuple of 2 floats
The value and error.

line_positions(mfout_lines)

source code 

Function for getting the section positions (line number) of the mfout file.

Parameters:
  • mfout_lines (list of str) - A list of all the lines of the mfout file.
Returns: tuple of int
The line indices where the s2, s2f, s2s, te, rex, and chi2 sections start in the mfout file.