Difference between revisions of "Tutorial for model-free analysis sam mahdi"
m (→Background: Link fixes and use of a. New template.) |
|||
(17 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== Background == | == Background == | ||
− | This follow the discussion with Sam Mahdi, at the mailing list: | + | This follow the discussion with Sam Mahdi, at the mailing list: {{gna mailing list url|relax-users/2016-09/threads.html#00001}} |
− | Files has been uploaded to: bug | + | Files has been uploaded to: {{gna bug link|25044}} |
* Model Free Analysis problems when attempting to run on multi-processors and using the script to run | * Model Free Analysis problems when attempting to run on multi-processors and using the script to run | ||
Line 14: | Line 14: | ||
== Version of relax and computer == | == Version of relax and computer == | ||
− | Version | + | Version of relax is 4.0.2 |
<source lang="text"> | <source lang="text"> | ||
Line 176: | Line 176: | ||
This works fine. Lets add the next line. | 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 | From Sams script, we see that he uses the PDB ID: 2d9j | ||
<source lang="bash"> | <source lang="bash"> | ||
− | # Get | + | # Get pdb |
wget http://www.rcsb.org/pdb/files/2d9j.pdb.gz | wget http://www.rcsb.org/pdb/files/2d9j.pdb.gz | ||
# Extract | # Extract | ||
Line 194: | Line 194: | ||
# Relax start | # Relax start | ||
help(structure.read_pdb) | help(structure.read_pdb) | ||
+ | exit | ||
</source> | </source> | ||
Line 214: | Line 215: | ||
This works fine. Lets add the next line. | 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 == | == See also == | ||
[[Category:Tutorials]] | [[Category:Tutorials]] | ||
− | [[Category: | + | [[Category:Model-free_analysis]] |
Latest revision as of 09:59, 6 October 2020
Contents
- 1 Background
- 2 Available data
- 3 Version of relax and computer
- 4 Current script
- 5 Make suggestion script
- 5.1 Copy sample script
- 5.2 Now modify sample script
- 5.2.1 Initial script
- 5.2.2 Loading model from pdb file
- 5.2.3 Create data containers
- 5.2.4 Check the spin containers via GUI
- 5.2.5 Check the spin containers via script
- 5.2.6 Try to load the relaxation data
- 5.2.7 Alter rest of the data
- 5.2.8 Define the magnetic dipole-dipole relaxation interaction
- 5.2.9 Let us try to execute
- 5.2.10 The whole script file looked like this
- 6 Make suggestion script for GUI
- 7 Conclusion
- 8 See also
Background
This follow the discussion with Sam Mahdi, at the mailing list: https://www.nmr-relax.com/mail.gna.org/public/relax-users/2016-09/threads.html#00001
Files has been uploaded to: Bug #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 of 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)
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
- File -> Open relax state
- Point to "ini_setup.bz2"
- 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.
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.
relax
# Relax start
help(relax_data.read)
exit
Let us inspect just one file date. Open in a text browser "R1_600".
It says
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
This will probably not work. The file does not contain the same separators in the file.
But let us try!
Add the following line to "sam_script.py".
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)
Now we are just going to try this.
relax sam_script.py
That gives some output in the command as this.
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'.
A lot of problems!
We modify the data file to look like this. Note the hashtag "#".
#Residue R1 Error
12 1.58 0.06
13 1.23 0.05
14 1.48 0.1
15 2.06 0.04
Now we are just going to try this.
relax sam_script.py
That gives some output in the command as this.
RelaxError: The spin ID '#hRGS7:12' corresponds to multiple spins, including '#hRGS7:12@N' and '#hRGS7:12@H'.
NOTE: Instead of a "Warning", this is an "Error".
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.
Errors make relax STOP.
The data is insufficient or not labelled correct.
How could it look like?
Have a look in: "relax_installation/test_suite/shared_data/model_free/sphere"
r1.500.out
# 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
Let us then alter R1_600 file.
#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
Now MODIFY the following line in "sam_script.py".
# 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)
Now we are just going to try this.
relax sam_script.py
Now it works.
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
Alter rest of the data
Let us then alter R1_800 file.
#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
Let us then alter R2_600 file.
#res_num spin_name R2 Error
12 N 18.6 0.6
13 N 14.58 0.39
Let us then alter ssNOE_600 file.
#res_num spin_name Noe Error
13 N 0.663870952 0.0386263336
14 N 0.8132898597 0.1578765885
Let us then alter ssNOE_800 file.
#res_num spin_name Noe Error
12 N 0.4833302155 0.1078027894
13 N 0.8142253659 0.0290794774
14 N 0.7922308188 0.0801096067
Now add the following lines in "sam_script.py", so there is 6 in total..
# 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)
Now we are just going to try this.
relax sam_script.py
This looks fine
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
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
# 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*')
Now we are just going to try this.
relax sam_script.py
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:
# 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*')
Let us try to execute
Now add the following lines in "sam_script.py"
# 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)
Now we are just going to try this AND using a log file
relax sam_script.py -t log.txt
The whole script file looked like this
# 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)
Make suggestion script for GUI
Let us try to analyse it in the GUI.
First copy the script over
cp sam_script.py sam_script_GUI.py
Modify it, so it look like this
# 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*')
Start relax in GUI
relax -g -t log_gui.txt
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
relax -g -t log_gui_2.txt
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.