Tutorial for model-free analysis sam mahdi

From relax wiki
Jump to navigation Jump to search

Background

This follow the discussion with Sam Mahdi, at the mailing list: https://mail.gna.org/public/relax-users/2016-09/threads.html#00001

Files has been uploaded to: bug #25044: https://gna.org/bugs/?25044

  • Model Free Analysis problems when attempting to run on multi-processors and using the script to run

Available data

  • R1 600 MHz
  • R2 600 MHz
  • R1 800 MHz
  • R2 800 MHz
  • ssNOE 600 MHz
  • ssNOE 800 MHz

Version of relax and computer

Version og relax is 4.0.2

Hardware information:
    Machine:                 x86_64
    Processor:               x86_64
    Processor name:          Intel(R) Core(TM)2 Duo CPU     E7500  @ 2.93GHz
    Endianness:              little
    Total RAM size:          2756 Mb
    Total swap size:         2815 Mb

Operating system information:
    System:                  Linux
    Release:                 4.5.7-300.fc24.x86_64
    Version:                 #1 SMP Wed Jun 8 18:12:45 UTC 2016
    GNU/Linux version:       Fedora 24 Twenty Four
    Distribution:            fedora 24 Twenty Four
    Full platform string:    Linux-4.5.7-300.fc24.x86_64-x86_64-with-fedora-24-Twenty_Four

Python information:
    Architecture:            64bit
    Python version:          2.7.12
    Python branch:          
    Python build:            default, Aug  9 2016 15:48:18
    Python compiler:         GCC 6.1.1 20160621 (Red Hat 6.1.1-3)
    Libc version:            glibc 2.2.5
    Python implementation:   CPython
    Python revision:        
    Python executable:       /usr/bin/python
    Python flags:            sys.flags(debug=0, py3k_warning=0, division_warning=0, division_new=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, tabcheck=0, verbose=0, unicode=0, bytes_warning=0, hash_randomization=0)
    Python float info:       sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)
    Python module path:      ['/home/student/relax-4.0.2', '/usr/lib/python27.zip', '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2', '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old', '/usr/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7/site-packages', '/usr/lib64/python2.7/site-packages/openmpi', '/usr/lib64/python2.7/site-packages/gtk-2.0', '/usr/lib/python2.7/site-packages']

Python packages and modules (most are optional):

Name               Installed    Version             Path                                                
minfx              True         1.0.12              /home/student/relax-4.0.2/minfx                     
bmrblib            True         1.0.4               /home/student/relax-4.0.2/bmrblib                   
numpy              True         1.11.0              /usr/lib64/python2.7/site-packages/numpy            
scipy              True         0.16.1              /usr/lib64/python2.7/site-packages/scipy            
wxPython           False                                                                                
matplotlib         True         1.5.2rc2            /usr/lib64/python2.7/site-packages/matplotlib       
mpi4py             True         2.0.0               /usr/lib64/python2.7/site-packages/openmpi/mpi4py   
epydoc             False                                                                                
optparse           True         1.5.3               /usr/lib64/python2.7/optparse.pyc                   
readline           True                             /usr/lib64/python2.7/lib-dynload/readline.so        
profile            True                             /usr/lib64/python2.7/profile.pyc                    
bz2                True                             /usr/lib64/python2.7/lib-dynload/bz2.so             
gzip               True                             /usr/lib64/python2.7/gzip.pyc                       
io                 True                             /usr/lib64/python2.7/io.pyc                         
xml                True         0.8.4 (internal)    /usr/lib64/python2.7/xml/__init__.pyc               
xml.dom.minidom    True                             /usr/lib64/python2.7/xml/dom/minidom.pyc            

relax information:
    Version:                 4.0.2
    Processor fabric:        Uni-processor.

Current script

Sam has provided this script.
It is not entirely clear how the "The dauvergne_protocol model-free auto-analysis" was initiated. Maybe a combination of GUI and scripts?

relax> from time import asctime, localtime
relax> from auto_analyses.dauvergne_protocol import dAuvergne_protocol 
relax> DIFF_MODEL=['local_tm','sphere','prolate','oblate','ellipsoid','final']
relax> MF_MODELS=['m0','m1','m2','m3','m4','m5','m6','m7','m8','m9']
relax> LOCAL_TM_MODELS=['tm0','tm1','tm2','tm3','tm4','tm5','tm6','tm7','tm7','tm8','tm9']
relax> GRID_INC=11
relax> MIN_ALGOR='newton'
relax> MC_NUM=500
relax> CONV_LOOP=True
relax> pipe_bundle="mf(%s)"%asctime(localtime())
relax> name="origin-"+pipe_bundle
relax> pipe.create(name,'mf',bundle=pipe_bundle)
relax> structure.read_pdb('2d9j.pdb',set_mol_name='hRGS7')
relax> structure.load_spins('@N',ave_pos=True)
relax> structure.load_spins('@NE1',ave_pos=True)
relax> structure.load_spins('@H',ave_pos=True)
relax> structure.load_spins('@HE1',ave_pos=True)
relax> spin.isotope('15N',spin_id='@N*')
relax> spin.isotope('1H',spin_id='@H*')
relax> interatom.define(spin_id1='@N',spin_id2='@H', direct_bond=True)
relax> interatom.define(spin_id1='@NE1',spin_id2='@HE1', direct_bond=True)
relax> interatom.set_dist(spin_id1='@N*',spin_id2='@H*',ave_dist=1.02*1e-10)
relax> interatom.unit_vectors()
relax> value.set(-172*1e-6,'csa',spin_id='@N*')

Make suggestion script

Copy sample script

To provide a suggestion script, the relax example script is copied to the folder with the data.

# Find where relax is called from. It's a symbolic link in the users bin folder.
tlinnet@linmac:Sam_25044$ which relax
/Users/tlinnet/bin/relax

# Read the link to the folder where relax is installed.
tlinnet@linmac:Sam_25044$ readlink `which relax`
/Users/tlinnet/software/relax_trunk_svn/relax

# The current working folder with data
tlinnet@linmac:Sam_25044$ pwd
/Users/tlinnet/Desktop/Sam_25044

# Copy sample script
cp /Users/tlinnet/software/relax_trunk_svn/sample_scripts/model_free/dauvergne_protocol.py sam_script.py

Now modify sample script

We are going to edit "sam_script.py".

Initial script

# Python module imports.
from time import asctime, localtime
# relax module imports.
from auto_analyses.dauvergne_protocol import dAuvergne_protocol


# Analysis variables.
#####################
# The diffusion model.
DIFF_MODEL = 'local_tm'

# The model-free models.  Do not change these unless absolutely necessary, the protocol is likely to fail if these are changed.
MF_MODELS = ['m0', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9']
LOCAL_TM_MODELS = ['tm0', 'tm1', 'tm2', 'tm3', 'tm4', 'tm5', 'tm6', 'tm7', 'tm8', 'tm9']

# The grid search size (the number of increments per dimension).
GRID_INC = 11

# The optimisation technique.
MIN_ALGOR = 'newton'

# The number of Monte Carlo simulations to be used for error analysis at the end of the analysis.
MC_NUM = 10

# Automatic looping over all rounds until convergence (must be a boolean value of True or False).
CONV_LOOP = True

# Set up the data pipe.
#######################

# The following sequence of user function calls can be changed as needed.

# Create the data pipe.
pipe_bundle = "mf (%s)" % asctime(localtime())
name = "origin - " + pipe_bundle
pipe.create(name, 'mf', bundle=pipe_bundle)

Now we are just going to try this.

relax sam_script.py

This works fine. Lets add the next line.

Loading model from pdb file

From Sams script, we see that he uses the PDB ID: 2d9j

# Get pdb
wget http://www.rcsb.org/pdb/files/2d9j.pdb.gz
# Extract
gzip -d 2d9j.pdb.gz

We open the .pdb file in PyMOL and see that it is a NMR file with 20 states.
We need to figure out how to use the command structure.read_pdb

So we open relax in the prompt, and use the help command.

relax
# Relax start
help(structure.read_pdb)
exit

In the help menu, it says:

    read_model:  If set, only the given model number(s) from the PDB file will be read.  Otherwise
all models will be read.  This can be a single number or list of numbers.

Now add the following line to "sam_script.py".

structure.read_pdb('2d9j.pdb', set_mol_name='hRGS7', read_model=1)
exit

Now we are just going to try this.

relax sam_script.py

This works fine. Lets add the next line.

Create data containers

In the sample script, we see that we should use the command "structure.load_spins".

Since we do not know what that is, we use the help command.

So we open relax in the prompt, and use the help command.

relax
# Relax start
help(structure.load_spins)
exit

There is a lengthy description. But what relax need to do internal inside python, is to create data-containers where it can add data.
It is as simple as that. We need some place to store relax data, and relax generate some "variables" on a naming scheme from the pdb file.
After this, we alter the nitrogens to be isotope N15, and the same for hydrogen.

Now add the following line to "sam_script.py".

# Set up the 15N and 1H spins (both backbone and Trp indole sidechains).
structure.load_spins('@N', ave_pos=True)
structure.load_spins('@NE1', ave_pos=True)
structure.load_spins('@H', ave_pos=True)
structure.load_spins('@HE1', ave_pos=True)
spin.isotope('15N', spin_id='@N*')
spin.isotope('1H', spin_id='@H*')

Now we are just going to try this.

relax sam_script.py

Check the spin containers via GUI

Right now, we want to check the spin containers.

First we do in the the GUI.
Now add the following line to "sam_script.py".

state.save('ini_setup', force=True)

Now we are just going to try this. Run relax to save the state, and then start in GUI.

relax sam_script.py

# Start relax in GUI
relax -g

Now do in the GUI

  1. File -> Open relax state
  2. Point to "ini_setup.bz2"
  3. Go to: View -> Spin Viewer

And inspect the spins!
Close relax

Check the spin containers via script

Instead of using the GUI to inspect the spins, we can use the command

Add the following line to "sam_script.py".

# Import
from pipe_control.mol_res_spin import spin_loop

# Loop and print
for spin, mol_name, res_num, res_name, spin_id in spin_loop(full_info=True, return_id=True, skip_desel=True):
    print spin, mol_name, res_num, res_name, spin_id

Now we are just going to try this.

relax sam_script.py

That gives some output in the command as this.

Objects:
  element: 'H'
  isotope: '1H'
  name: 'H'
  num: 2204
  pos: array([-26.478999999999999,  -4.86             ,   6.999            ])
  select: True
 hRGS7 139 GLY #hRGS7:139@H

This looks good.

Load the relaxation data

Now comes the time to load the relaxation data.

In the sample script, we see that we should use the command "relax_data.read".

Since we do not know what that is, we use the help command.

So we open relax in the prompt, and use the help command.

relax
# Relax start
help(relax_data.read)
exit

See also