Changes

Jump to navigation Jump to search

Dx map

1,357 bytes added, 19:44, 16 October 2020
m
Switch to the {{gna bug url}} and {{gna bug url}} templates to remove dead Gna! links.
__TOC__
 
== Sample data to try dx ==
<source lang="bash">
cd $HOME/Desktop
mkdir test_dx
cd test_dx
 
# See sample scripts
ls -la $HOME/software/relax/sample_scripts/model_free
cp $HOME/software/relax/sample_scripts/model_free/map.py .
 
# Get data
ls -la $HOME/software/relax/test_suite/shared_data/model_free/sphere
cp $HOME/software/relax/test_suite/shared_data/model_free/sphere/*.out .
cp $HOME/software/relax/test_suite/shared_data/model_free/sphere/*.pdb .
 
# Modify map script
cp map.py map_mod.py
sed -i.bak "s/res_num_col=1)/mol_name_col=1, res_num_col=2, res_name_col=3, spin_num_col=4, spin_name_col=5)/g" map_mod.py
sed -i.bak "s/600/900/g" map_mod.py
sed -i.bak "s/spin\.name/#spin\.name/g" map_mod.py
sed -i.bak "s/res_num_col=1, data_col=3, error_col=4)/mol_name_col=1, res_num_col=2, res_name_col=3, spin_num_col=4, spin_name_col=5, data_col=6, error_col=7)/g" map_mod.py
sed -i.bak "s/sequence\.attach_protons/#sequence\.attach_protons/g" map_mod.py
sed -i.bak "spin/a spin" map_mod.py
 
# Add these two lines to map_mod.py
spin.element(element='H', spin_id='@H')
spin.isotope('1H', spin_id='@H')
 
# Run
relax map_mod.py
</source>
 
== Code to generate map ==
<source lang="Python">
for cur_spin, mol_name, resi, resn, spin_id in spin_loop(full_info=True, return_id=True, skip_desel=True):
file_name = "map%s" % (cur_spin_id .replace('#', '_').replace(':', '_').replace('@', '_'))
dx.map(params=['dw', 'pA', 'kex'], map_type='Iso3D', spin_id=":1@N", inc=70, lower=None, upper=None, axis_incs=5, file_prefix=file_name, dir=ds.resdir, point=None, point_file='point', remap=None)
#vp_exec: A flag specifying whether to execute the visual program automatically at start-up.
dx.execute(file_prefix=file_name, dir=ds.resdir, dx_exe='dx', vp_exec=True)
== How to use dx ==
* Run '<code>dx'</code>,In teh and then in the '''Data explorer''' or '''DE'''.* Click on '''<code>Edit Visual Programs...'''</code>.* Select the <code>map.net </code> program created by relax,
Now in the '''<code>Visual Program Editor''' </code> or '''<code>VPE'''</code>.* Select the menu entry '<code>Execute->Execute on change'</code>.
That's it.
You now have a 3D frame, but nothing in it. <br>Therefore the contour levels must be too low or high. <br>From the map file, the values are in the hundreds of thousands.
Then:
* In the main program window, double click on the '<code>Isosurface elements'</code>.
* Change the values until you see surfaces. In the first the value is 500. I changed this to 500,000. Multiply all by 1000.
* In the second, 100 -> 100000.
This should maybe be performed by the dx.map user function, determining reasonable contour levels.
With a bit of zooming, clicking on '<code>File -> Save image' </code> in the "<code>Surface" </code> window, "<code>allowing rendering"</code>, and outputting to a large TIFF file, "<code>save current"</code>, then "<code>apply"</code>.
An example image cropped and converted to PNG in the GIMP at <br>https://gna.org/bugs/download.php?file_id=20641.
Note that for a good resolution plot, you will need many more increments. <br> Using the lower and upper dx.map arguments will be useful to zoom into the space.
== Example images ==
These images is from [https://{{gna.org/bugs/index.php?bug link|22024 |text=bug 22024. Minimisation space for CR72 is catastrophic. The chi2 surface over dw and pA is bounded.]}}
{|style="margin: 0 auto;"
| [[File:Bug 22024 R2eff.png|thumb|center|upright=2|https://{{gna.org/bugs/index.php?22024Bug bug url|22024}} Bug 22024: Minimisation space for CR72 is catastrophic. The chi2 surface over dw and pA is bounded.]]| [[File:Bug 22024 Dw kex.png|thumb|upright=2|https://{{gna.org/bugs/index.php?22024Bug bug url|22024}} Bug 22024: Minimisation space for CR72 is catastrophic. The chi2 surface over dw and pA is bounded.]]
|}
{|style="margin: 0 auto;"
| [[File:Bug 22024 Dw kex pA.png|thumb|upright=2|https://{{gna.org/bugs/index.php?22024Bug bug url|22024}} Bug 22024: Minimisation space for CR72 is catastrophic. The chi2 surface over dw and pA is bounded.]]| [[File:Bug 22024 Dw pA.png|thumb|upright=2|https://{{gna.org/bugs/index.php?22024Bug bug url|22024}} Bug 22024: Minimisation space for CR72 is catastrophic. The chi2 surface over dw and pA is bounded.]]| [[File:Bug 22024 Kex pA.png|thumb|upright=2|https://{{gna.org/bugs/index.php?22024Bug bug url|22024}} Bug 22024: Minimisation space for CR72 is catastrophic. The chi2 surface over dw and pA is bounded.]]
|}
relax cpmg_synthetic.py
</source>
 Here is the synthetic data generator code.: {{collapsible script| type =relax script| title =Script for calculating synthetics CPMG data.| lang = Code ===python<source lang| script ="Python">
###############################################################################
# #
# Add more spins here.
spins = [
['Ala', 1, 'N', {'r2': {r20_key_1: 25.0, r20_key_2: 24.0}, 'r2a': {r20_key_1: 25.0, r20_key_2: 24.0}, 'r2b': {r20_key_1: 25.0, r20_key_2: 24.0}, 'kex': 2200.0, 'pA': 0.993, 'dw': 30.05} ]
#['Ala', 2, 'N', {'r2': {r20_key_1: 15.0, r20_key_2: 14.0}, 'r2a': {r20_key_1: 15.0, r20_key_2: 14.0}, 'r2b': {r20_key_1: 15.0, r20_key_2: 14.0}, 'kex': 2200.0, 'pA': 0.993, 'dw': 1.5} ]
]
# To map the hypersurface of chi2, when altering kex, dw and pA.
if not hasattr(ds, 'opendx'):
#ds.opendx = False #ds.opendx = True
# Which parameters to map on chi2 surface.
cur_spin_id = ":%i@%s"%(res_num, spin_name)
cur_spin = return_spin(cur_spin_id)
 
# Save all the paramers to loop throgh later.
ds.model_analyse_params = cur_spin.params
par_dic = {}
clust_r2 = clust_params[mo_param]
set_r2 = params[mo_param]
for key, val in getattr(cur_spin, mo_param)min_r2.items():
grid_r2_frq = grid_r2[key]
min_r2_frq = min_r2[key]
if ds.opendx:
print_res(cur_spins=cur_spins, grid_params=ds.grid_results[i][3], min_params=ds.min_results[i][3], clust_params=ds.clust_results[i][3])
</source>}}
= See also =
[[Install dx]]
[[Category:User_functions]]
Trusted, Bureaucrats
4,223

edits

Navigation menu