Open main menu

Changes

Tutorial for model-free analysis sam mahdi

16,297 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>
This looks good.
==== Load Try to load the relaxation data ====
Now comes the time to load the relaxation data.
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..<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> 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"># Deselectdeselect.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-5dAuvergne_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_bundlepipe.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) # Importfrom 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): print spin, mol_name, res_num, res_name, spin_id # 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) # Deselectdeselect.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-5dAuvergne_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 datarelax_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) # Deselectdeselect.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 is 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