== Background ==
This follow the discussion with Sam Mahdi, at the mailing list: https://mail.{{gna.org/public/mailing list url|relax-users/2016-09/threads.html#00001}}
Files has been uploaded to: {{gna bug #25044: https://gna.org/bugs/?link|25044}}
* Model Free Analysis problems when attempting to run on multi-processors and using the script to run
== Version of relax and computer ==
Version og of relax is 4.0.2
<source lang="text">
== Current script ==
Sam has provided this script. <br> It is not entirely clear how the "The dauvergne_protocol model-free auto-analysis" was initiated. Maybe a combination of GUI and scripts?
<source lang="python">
cd relax> from time import asctime, localtimerelax> 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=11relax> MIN_ALGOR='newton'relax> MC_NUM=500relax> CONV_LOOP=Truerelax> pipe_bundle="mf(%s)"%asctime(localtime())relax> name="origin-"+pipe_bundlerelax> 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*')</source> == Make suggestion script ===== Copy sample script ===To provide a suggestion script, the relax example script is copied to the folder with the data. <source lang="bash"># Find where relax is called from. It's a symbolic link in the users bin folder.tlinnet@linmac:Sam_25044$CWDwhich 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 datatlinnet@linmac:Sam_25044$ pwd/Users/tlinnet/Desktop/Sam_25044 # Copy sample scriptcp /Users/tlinnet/software/relax_trunk_svn/sample_scripts/model_free/dauvergne_protocol.py sam_script.py</source> === Now modify sample script ===We are going to edit "sam_script.py". ==== Initial script ====<source lang="python"># 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_bundlepipe.create(name, 'mf', bundle=pipe_bundle)</source>
set FIDS=`cat fid_filesNow we are just going to try this.ls`set DIRN1=`dirname $PWD/${FIDS[1]}` foreach I (`seq 2 ${#FIDS}`)set FID<source lang=${FIDS[$I]}; set DIRN=`dirname $FID`cd $DIRNecho $DIRNcp -f $DIRN1/fid.com .cp -f $DIRN1/nmrproc.com ."bash">relax sam_script./fid.com./nmrproc.comcd ..endpy
</source>
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
<source lang="bash">
# Get pdb
wget http://www.rcsb.org/pdb/files/2d9j.pdb.gz
# Extract
gzip -d 2d9j.pdb.gz
</source>
We open the .pdb file in PyMOL and see that it is a NMR file with 20 states. <br>
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.
<source lang="bash">
relax
# Relax start
help(structure.read_pdb)
exit
</source>
In the help menu, it says:
<source lang="text">
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.
</source>
Now add the following line to "sam_script.py".
<source lang="python">
structure.read_pdb('2d9j.pdb', set_mol_name='hRGS7', read_model=1)
</source>
Now we are just going to try this.
<source lang="bash">
relax sam_script.py
</source>
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.
<source lang="bash">
relax
# Relax start
help(structure.load_spins)
exit
</source>
There is a lengthy description. But what relax need to do internal inside python, is to create data-containers where it can add data. <br>
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. <br>
After this, we alter the nitrogens to be isotope N15, and the same for hydrogen.
Now add the following line to "sam_script.py".
<source lang="python">
# 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*')
</source>
Now we are just going to try this.
<source lang="bash">
relax sam_script.py
</source>
==== Check the spin containers via GUI====
Right now, we want to check the spin containers.<br>
First we do in the the GUI.<br>
Now add the following line to "sam_script.py".
<source lang="python">
state.save('ini_setup', force=True)
</source>
Now we are just going to try this. Run relax to save the state, and then start in GUI.
<source lang="bash">
relax sam_script.py
# Start relax in GUI
relax -g
</source>
Now do in the GUI
# File -> Open relax state
# Point to "ini_setup.bz2"
# Go to: View -> Spin Viewer
And inspect the spins! <br>
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".
<source lang="python">
# 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
</source>
Now we are just going to try this.
<source lang="bash">
relax sam_script.py
</source>
That gives some output in the command as this.
<source lang="text">
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
</source>
This looks good.
==== Try to 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.
<source lang="bash">
relax
# Relax start
help(relax_data.read)
exit
</source>
Let us inspect just one file date. Open in a text browser "R1_600".
It says
<source lang="text">
Residue R1 Error
1
2
3
4
5
6
7
8
9
10
11
12 1.58 0.06
13 1.23 0.05
14 1.48 0.1
15 2.06 0.04
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
139
</source>
This will probably not work. The file does not contain the same separators in the file. <br>
But let us try!
Add the following line to "sam_script.py".
<source lang="python">
relax_data.read(ri_id='R1_600', ri_type='R1', frq=599.719*1e6, file='R1_600', res_num_col=1, data_col=2, error_col=3)
</source>
Now we are just going to try this.
<source lang="bash">
relax sam_script.py
</source>
That gives some output in the command as this.
<source lang="text">
RelaxWarning: The sequence data in the line ['Residue', 'R1', 'Error'] is invalid, the residue number data 'Residue' is invalid.
RelaxWarning: The sequence data in the line ['1'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['2'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['3'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['4'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['5'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['6'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['7'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['8'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['9'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['10'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['11'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['17'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['18'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['19'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['20'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['21'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['22'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['23'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['24'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['25'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['26'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['27'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['28'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['29'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['30'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['31'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['32'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['33'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['34'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['35'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['36'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['37'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['38'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['39'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['40'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['41'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['42'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['43'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['44'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['45'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['46'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['47'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['48'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['49'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['50'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['51'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['52'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['53'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['54'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['55'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['56'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['57'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['58'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['59'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['60'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['61'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['62'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['63'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['64'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['65'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['66'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['67'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['68'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['69'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['70'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['71'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['72'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['73'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['74'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['75'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['76'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['77'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['78'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['79'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['80'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['81'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['82'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['83'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['84'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['85'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['86'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['87'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['88'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['89'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['90'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['91'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['92'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['93'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['94'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['95'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['96'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['97'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['98'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['99'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['100'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['101'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['102'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['103'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['104'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['105'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['106'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['107'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['108'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['109'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['110'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['111'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['112'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['113'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['114'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['115'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['116'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['117'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['118'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['119'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['120'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['121'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['122'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['123'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['124'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['125'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['126'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['127'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['128'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['129'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['130'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['131'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['132'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['133'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['134'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['135'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['136'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['137'] is invalid, the data is missing.
RelaxWarning: The sequence data in the line ['139'] is invalid, the data is missing.
RelaxError: The spin ID '#hRGS7:12' corresponds to multiple spins, including '#hRGS7:12@N' and '#hRGS7:12@H'.
</source>
A lot of problems! <br>
We modify the data file to look like this. Note the hashtag "#".
<source lang="text">
#Residue R1 Error
12 1.58 0.06
13 1.23 0.05
14 1.48 0.1
15 2.06 0.04
</source>
Now we are just going to try this.
<source lang="bash">
relax sam_script.py
</source>
That gives some output in the command as this.
<source lang="text">
RelaxError: The spin ID '#hRGS7:12' corresponds to multiple spins, including '#hRGS7:12@N' and '#hRGS7:12@H'.
</source>
NOTE: Instead of a "Warning", this is an "Error". <br>
This will not work.
And why? Relax does not know if the associated data is the R1 for the nitrogen or proton of spin 12. And then relax STOPS. <br>
'''Errors make relax STOP.'''
The data is insufficient or not labelled correct.
How could it look like? <br>
Have a look in: "relax_installation/test_suite/shared_data/model_free/sphere"
'''r1.500.out'''
<source lang="text">
# mol_name res_num res_name spin_num spin_name value error
sphere_mol1 1 GLY 1 N 1.4639691658223886 0.029279383316447773
sphere_mol1 1 GLY 2 H None None
sphere_mol1 2 GLY 3 N 1.4639691658223886 0.029279383316447773
sphere_mol1 2 GLY 4 H None None
</source>
Let us then alter '''R1_600''' file.
<source lang="bash">
#res_num spin_name R1 Error
12 N 1.58 0.06
13 N 1.23 0.05
14 N 1.48 0.1
15 N 2.06 0.04
</source>
Now MODIFY the following line in "sam_script.py".
<source lang="python">
# From
relax_data.read(ri_id='R1_600', ri_type='R1', frq=599.719*1e6, file='R1_600', res_num_col=1, data_col=2, error_col=3)
# To
relax_data.read(ri_id='R1_600', ri_type='R1', frq=599.719*1e6, file='R1_600', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
</source>
Now we are just going to try this.
<source lang="bash">
relax sam_script.py
</source>
Now it works.
<source lang="text">
Opening the file 'R1_600' for reading.
The following 599.719 MHz R1 relaxation data with the ID 'R1_600' has been loaded into the relax data store:
# Spin_ID Value Error
#hRGS7:12@N 1.58 0.06
#hRGS7:13@N 1.23 0.05
#hRGS7:14@N 1.48 0.1
#hRGS7:15@N 2.06 0.04
</source>
==== Alter rest of the data ====
Let us then alter '''R1_800''' file.
<source lang="bash">
#res_num spin_name R1 Error
12 N 1.15 0.03
13 N 0.832 0.011
14 N 1.07 0.05
15 N 0.78 0.17
</source>
Let us then alter '''R2_600''' file.
<source lang="bash">
#res_num spin_name R2 Error
12 N 18.6 0.6
13 N 14.58 0.39
</source>
Let us then alter '''ssNOE_600''' file.
<source lang="bash">
#res_num spin_name Noe Error
13 N 0.663870952 0.0386263336
14 N 0.8132898597 0.1578765885
</source>
Let us then alter '''ssNOE_800''' file.
<source lang="bash">
#res_num spin_name Noe Error
12 N 0.4833302155 0.1078027894
13 N 0.8142253659 0.0290794774
14 N 0.7922308188 0.0801096067
</source>
Now add the following lines in "sam_script.py", so there is 6 in total..
<source lang="python">
# From before
relax_data.read(ri_id='R1_600', ri_type='R1', frq=599.719*1e6, file='R1_600', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
# Add this
relax_data.read(ri_id='R2_600', ri_type='R2', frq=599.719*1e6, file='R2_600', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
relax_data.read(ri_id='ssNOE_600', ri_type='NOE', frq=599.719*1e6, file='ssNOE_600', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
relax_data.read(ri_id='R1_800', ri_type='R1', frq=799.719*1e6, file='R1_800', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
relax_data.read(ri_id='R2_800', ri_type='R2', frq=799.719*1e6, file='R2_800', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
relax_data.read(ri_id='ssNOE_800', ri_type='NOE', frq=799.719*1e6, file='ssNOE_800', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
</source>
Now we are just going to try this.
<source lang="bash">
relax sam_script.py
</source>
This looks fine
<source lang="text">
relax> relax_data.read(ri_id='R1_600', ri_type='R1', frq=599719000.0, file='R1_600', dir=None, spin_id_col=None, mol_name_col=None, res_num_col=1, res_name_col=None, spin_num_col=None, spin_name_col=2, data_col=3, error_col=4, sep=None, spin_id=None)
Opening the file 'R1_600' for reading.
The following 599.719 MHz R1 relaxation data with the ID 'R1_600' has been loaded into the relax data store:
# Spin_ID Value Error
#hRGS7:12@N 1.58 0.06
#hRGS7:13@N 1.23 0.05
#hRGS7:14@N 1.48 0.1
#hRGS7:15@N 2.06 0.04
relax> relax_data.read(ri_id='R2_600', ri_type='R2', frq=599719000.0, file='R2_600', dir=None, spin_id_col=None, mol_name_col=None, res_num_col=1, res_name_col=None, spin_num_col=None, spin_name_col=2, data_col=3, error_col=4, sep=None, spin_id=None)
Opening the file 'R2_600' for reading.
The following 599.719 MHz R2 relaxation data with the ID 'R2_600' has been loaded into the relax data store:
# Spin_ID Value Error
#hRGS7:12@N 18.6 0.6
#hRGS7:13@N 14.58 0.39
relax> relax_data.read(ri_id='ssNOE_600', ri_type='NOE', frq=599719000.0, file='ssNOE_600', dir=None, spin_id_col=None, mol_name_col=None, res_num_col=1, res_name_col=None, spin_num_col=None, spin_name_col=2, data_col=3, error_col=4, sep=None, spin_id=None)
Opening the file 'ssNOE_600' for reading.
The following 599.719 MHz NOE relaxation data with the ID 'ssNOE_600' has been loaded into the relax data store:
# Spin_ID Value Error
#hRGS7:13@N 0.663870952 0.0386263336
#hRGS7:14@N 0.8132898597 0.1578765885
relax> relax_data.read(ri_id='R1_800', ri_type='R1', frq=799719000.0, file='R1_800', dir=None, spin_id_col=None, mol_name_col=None, res_num_col=1, res_name_col=None, spin_num_col=None, spin_name_col=2, data_col=3, error_col=4, sep=None, spin_id=None)
Opening the file 'R1_800' for reading.
The following 799.719 MHz R1 relaxation data with the ID 'R1_800' has been loaded into the relax data store:
# Spin_ID Value Error
#hRGS7:12@N 1.15 0.03
#hRGS7:13@N 0.832 0.011
#hRGS7:14@N 1.07 0.05
#hRGS7:15@N 0.78 0.17
relax> relax_data.read(ri_id='R2_800', ri_type='R2', frq=799719000.0, file='R2_800', dir=None, spin_id_col=None, mol_name_col=None, res_num_col=1, res_name_col=None, spin_num_col=None, spin_name_col=2, data_col=3, error_col=4, sep=None, spin_id=None)
Opening the file 'R2_800' for reading.
The following 799.719 MHz R2 relaxation data with the ID 'R2_800' has been loaded into the relax data store:
# Spin_ID Value Error
#hRGS7:12@N 24.9 0.9
#hRGS7:13@N 16.1 0.3
#hRGS7:14@N 27.0 3.0
#hRGS7:15@N 22.96 0.19
relax> relax_data.read(ri_id='ssNOE_800', ri_type='NOE', frq=799719000.0, file='ssNOE_800', dir=None, spin_id_col=None, mol_name_col=None, res_num_col=1, res_name_col=None, spin_num_col=None, spin_name_col=2, data_col=3, error_col=4, sep=None, spin_id=None)
Opening the file 'ssNOE_800' for reading.
The following 799.719 MHz NOE relaxation data with the ID 'ssNOE_800' has been loaded into the relax data store:
# Spin_ID Value Error
#hRGS7:12@N 0.4833302155 0.1078027894
#hRGS7:13@N 0.8142253659 0.0290794774
#hRGS7:14@N 0.7922308188 0.0801096067
</source>
==== Define the magnetic dipole-dipole relaxation interaction ====
In the sample script, we see that we should use the command "interatom.define".
'''Use the help command to find out more.'''
Add this
<source lang="python">
# Define the magnetic dipole-dipole relaxation interaction.
interatom.define(spin_id1='@N', spin_id2='@H', direct_bond=True)
interatom.define(spin_id1='@NE1', spin_id2='@HE1', direct_bond=True)
interatom.set_dist(spin_id1='@N*', spin_id2='@H*', ave_dist=1.02 * 1e-10)
interatom.unit_vectors()
# Define the chemical shift relaxation interaction.
value.set(-172 * 1e-6, 'csa', spin_id='@N*')
</source>
Now we are just going to try this.
<source lang="bash">
relax sam_script.py
</source>
We see that relax calculates a lot of stuff, for spins we have no data for.
'''Let us practice to select and deselect spins.'''
So instead we do this:
<source lang="python">
# Deselect
deselect.all()
# Select
#select.spin(':12@N|:12@H|:13@N|:13@H|:14@N|:14@H|:15@N|:15@H')
select.spin(':12|:13|:14|:15')
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
# Define the magnetic dipole-dipole relaxation interaction.
interatom.define(spin_id1='@N', spin_id2='@H', direct_bond=True)
interatom.define(spin_id1='@NE1', spin_id2='@HE1', direct_bond=True)
interatom.set_dist(spin_id1='@N*', spin_id2='@H*', ave_dist=1.02 * 1e-10)
interatom.unit_vectors()
# Define the chemical shift relaxation interaction.
value.set(-172 * 1e-6, 'csa', spin_id='@N*')
</source>
==== Let us try to execute ====
Now add the following lines in "sam_script.py"
<source lang="python">
# Execution.
############
# Change some opt params.
# COMMENT THESE OUT FOR REAL CALCULATION. THIS IS ONLY TO SPEED UP THE PROCESS IN ERROR SEARCHING.
dAuvergne_protocol.opt_func_tol = 1e-5
dAuvergne_protocol.opt_max_iterations = 1000
# Do not change!
dAuvergne_protocol(pipe_name=name, pipe_bundle=pipe_bundle, diff_model=DIFF_MODEL, mf_models=MF_MODELS, local_tm_models=LOCAL_TM_MODELS, grid_inc=GRID_INC, min_algor=MIN_ALGOR, mc_sim_num=MC_NUM, conv_loop=CONV_LOOP)
</source>
Now we are just going to try this AND using a log file
<source lang="bash">
relax sam_script.py -t log.txt
</source>
==== The whole script file looked like this ====
<source lang="python">
# 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)
# Load the PDB file.
structure.read_pdb('2d9j.pdb', set_mol_name='hRGS7', read_model=1)
# 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*')
state.save('ini_setup', force=True)
# 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
# From before
relax_data.read(ri_id='R1_600', ri_type='R1', frq=599.719*1e6, file='R1_600', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
# Add this
relax_data.read(ri_id='R2_600', ri_type='R2', frq=599.719*1e6, file='R2_600', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
relax_data.read(ri_id='ssNOE_600', ri_type='NOE', frq=599.719*1e6, file='ssNOE_600', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
relax_data.read(ri_id='R1_800', ri_type='R1', frq=799.719*1e6, file='R1_800', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
relax_data.read(ri_id='R2_800', ri_type='R2', frq=799.719*1e6, file='R2_800', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
relax_data.read(ri_id='ssNOE_800', ri_type='NOE', frq=799.719*1e6, file='ssNOE_800', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
# Deselect
deselect.all()
# Select
#select.spin(':12@N|:12@H|:13@N|:13@H|:14@N|:14@H|:15@N|:15@H')
select.spin(':12|:13|:14|:15')
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
# Define the magnetic dipole-dipole relaxation interaction.
interatom.define(spin_id1='@N', spin_id2='@H', direct_bond=True)
interatom.define(spin_id1='@NE1', spin_id2='@HE1', direct_bond=True)
interatom.set_dist(spin_id1='@N*', spin_id2='@H*', ave_dist=1.02 * 1e-10)
interatom.unit_vectors()
# Define the chemical shift relaxation interaction.
value.set(-172 * 1e-6, 'csa', spin_id='@N*')
# Execution.
############
# Change some opt params.
# COMMENT THESE OUT FOR REAL CALCULATION. THIS IS ONLY TO SPEED UP THE PROCESS IN ERROR SEARCHING.
dAuvergne_protocol.opt_func_tol = 1e-5
dAuvergne_protocol.opt_max_iterations = 1000
# Do not change!
dAuvergne_protocol(pipe_name=name, pipe_bundle=pipe_bundle, diff_model=DIFF_MODEL, mf_models=MF_MODELS, local_tm_models=LOCAL_TM_MODELS, grid_inc=GRID_INC, min_algor=MIN_ALGOR, mc_sim_num=MC_NUM, conv_loop=CONV_LOOP)
</source>
== Make suggestion script for GUI ==
Let us try to analyse it in the GUI.
First copy the script over
<source lang="bash">
cp sam_script.py sam_script_GUI.py
</source>
Modify it, so it look like this
<source lang="bash">
# Load the PDB file.
structure.read_pdb('2d9j.pdb', set_mol_name='hRGS7', read_model=1)
# 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*')
# read data
relax_data.read(ri_id='R1_600', ri_type='R1', frq=599.719*1e6, file='R1_600', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
relax_data.read(ri_id='R2_600', ri_type='R2', frq=599.719*1e6, file='R2_600', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
relax_data.read(ri_id='ssNOE_600', ri_type='NOE', frq=599.719*1e6, file='ssNOE_600', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
relax_data.read(ri_id='R1_800', ri_type='R1', frq=799.719*1e6, file='R1_800', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
relax_data.read(ri_id='R2_800', ri_type='R2', frq=799.719*1e6, file='R2_800', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
relax_data.read(ri_id='ssNOE_800', ri_type='NOE', frq=799.719*1e6, file='ssNOE_800', res_num_col=1, spin_name_col=2, data_col=3, error_col=4)
# Deselect
deselect.all()
# Select
#select.spin(':12@N|:12@H|:13@N|:13@H|:14@N|:14@H|:15@N|:15@H')
select.spin(':12|:13|:14|:15')
# Define the magnetic dipole-dipole relaxation interaction.
interatom.define(spin_id1='@N', spin_id2='@H', direct_bond=True)
interatom.define(spin_id1='@NE1', spin_id2='@HE1', direct_bond=True)
interatom.set_dist(spin_id1='@N*', spin_id2='@H*', ave_dist=1.02 * 1e-10)
interatom.unit_vectors()
# Define the chemical shift relaxation interaction.
value.set(-172 * 1e-6, 'csa', spin_id='@N*')
</source>
=== Start relax in GUI ===
<source lang="bash">
relax -g -t log_gui.txt
</source>
Now do
# File -> New analysis
# Select "Model-free" -> Next
# Just hit Start in the box for pipe name
# Goto "User functions (n-z)" -> Script
# Find and open the script file "sam_script_GUI.py"
This should now fill out the data. Inspect the data
# View -> Spin Viewer
Save the state before execution. This state is easy to load in the GUI afterward
# File -> Save relax state -> as "test.bz2"
Exit relax. And start relax again
<source lang="bash">
relax -g -t log_gui_2.txt
</source>
Now do
# File -> Open relax state
# Select "test.bz2"
It should now show all the data.
Hit "Execute"
Consider
# Setting the number of Monte-Carlo simulations to 10, for initial faster calculation
== Conclusion ==
The data was insufficient or not labelled correct.
That made relax make an ERROR and make a STOP.
Please use the help function.
== See also ==
[[Category:Tutorials]]
[[Category:Relaxation dispersion analysisModel-free_analysis]]