Open main menu

Changes

Tutorial for model-free analysis sam mahdi

30,511 bytes added, 09:59, 6 October 2020
m
→‎Background: Link fixes and use of a. New template.
== 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">
<source lang="python">
structure.read_pdb('2d9j.pdb', set_mol_name='hRGS7', read_model=1)
exit
</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 ====
Now add 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 printfor spin, mol_name, res_num, res_name, spin_id in spin_loop(full_info=True, return_id=True, skip_desel=True): printspin, 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 "%20s %20srelax_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 starthelp(reprrelax_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 Error1 2 3 4 5 6 7 8 9 10 11 12 1.58 0.0613 1.23 0.0514 1.48 0.115 2.06 0.041718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137139</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(spin_idri_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 spinID '#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.0613 1.23 0.0514 1.48 0.115 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 Error12 N 1.58 0.0613 N 1.23 0.0514 N 1.48 0.115 N 2.06 0.04</source> Now MODIFY the following line in "sam_script.py".<source lang="python"># Fromrelax_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) # Torelax_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.0313 N 0.832 0.01114 N 1.07 0.0515 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.613 N 14.58 0.39</source> Let us then alter '''ssNOE_600''' file.<source lang="bash">#res_num spin_name Noe Error13 N 0.663870952 0.038626333614 N 0.8132898597 0.1578765885</source> Let us then alter '''ssNOE_800''' file.<source lang="bash">#res_num spin_name Noe Error12 N 0.4833302155 0.107802789413 N 0.8142253659 0.029079477414 N 0.7922308188 0.0801096067</source> Now add the following lines in "sam_script.py", so there is 6 in total..model<source lang="python"># From beforerelax_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 thisrelax_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>
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]]
Trusted, Bureaucrats
4,228

edits