1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """The dx user function definitions for controlling the OpenDX visualisation software."""
24
25
26 import dep_check
27 if dep_check.wx_module:
28 from wx import FD_OPEN
29 else:
30 FD_OPEN = -1
31
32
33 from graphics import WIZARD_IMAGE_PATH
34 from lib.software.opendx.execute import run
35 from pipe_control import diffusion_tensor
36 from pipe_control.opendx import map
37 from prompt.doc_string import regexp_doc
38 from specific_analyses.model_free import Model_free
39 from user_functions.data import Uf_info; uf_info = Uf_info()
40 from user_functions.data import Uf_tables; uf_tables = Uf_tables()
41 from user_functions.objects import Desc_container
42
43
44
45 uf_class = uf_info.add_class("dx")
46 uf_class.title = "Class for interfacing with OpenDX."
47 uf_class.menu_text = "&dx"
48 uf_class.gui_icon = "relax.opendx"
49
50
51
52 uf = uf_info.add_uf("dx.execute")
53 uf.title = "Execute an OpenDX program."
54 uf.title_short = "OpenDX execution."
55 uf.add_keyarg(
56 name = "file_prefix",
57 default = "map",
58 py_type = "str",
59 desc_short = "file name",
60 desc = "The file name prefix. For example if file is set to 'temp', then the OpenDX program temp.net will be loaded."
61 )
62 uf.add_keyarg(
63 name = "dir",
64 default = "dx",
65 py_type = "str",
66 arg_type = "dir sel",
67 desc_short = "directory name",
68 desc = "The directory to change to for running OpenDX. If this is set to None, OpenDX will be run in the current directory.",
69 can_be_none = True
70 )
71 uf.add_keyarg(
72 name = "dx_exe",
73 default = "dx",
74 py_type = "str",
75 arg_type = "file sel",
76 desc_short = "OpenDX executable file name",
77 desc = "The OpenDX executable file.",
78 wiz_filesel_style = FD_OPEN,
79 wiz_filesel_preview = False
80 )
81 uf.add_keyarg(
82 name = "vp_exec",
83 default = True,
84 py_type = "bool",
85 desc_short = "visual program execution flag",
86 desc = "A flag specifying whether to execute the visual program automatically at start-up. The default of True causes the program to be executed."
87 )
88
89 uf.desc.append(Desc_container())
90 uf.desc[-1].add_paragraph("This will execute OpenDX to display the space maps created previously by the dx.map user function. This will work for any type of OpenDX map.")
91 uf.backend = run
92 uf.menu_text = "&execute"
93 uf.gui_icon = "oxygen.categories.applications-education"
94 uf.wizard_size = (700, 500)
95 uf.wizard_apply_button = False
96 uf.wizard_image = WIZARD_IMAGE_PATH + 'opendx.png'
97
98
99
100 uf = uf_info.add_uf("dx.map")
101 uf.title = "Create a map of the given space in OpenDX format."
102 uf.title_short = "OpenDX map creation."
103 uf.display = True
104 uf.add_keyarg(
105 name = "params",
106 py_type = "str_list",
107 desc_short = "parameters",
108 desc = "The parameters to be mapped. This should be an array of strings, the meanings of which are described below."
109 )
110 uf.add_keyarg(
111 name = "map_type",
112 default = "Iso3D",
113 py_type = "str",
114 desc_short = "map type",
115 desc = "The type of map to create. For example the default, a 3D isosurface, the type is 'Iso3D'. See below for more details.",
116 wiz_element_type = "combo",
117 wiz_combo_choices = ["Iso3D"],
118 wiz_read_only = True,
119 )
120 uf.add_keyarg(
121 name = "spin_id",
122 py_type = "str",
123 desc_short = "spin ID string",
124 desc = "The spin ID string.",
125 can_be_none = True
126 )
127 uf.add_keyarg(
128 name = "inc",
129 default = 20,
130 py_type = "int",
131 desc_short = "number of increments",
132 desc = "The number of increments to map in each dimension. This value controls the resolution of the map.",
133 wiz_element_type = "spin"
134 )
135 uf.add_keyarg(
136 name = "lower",
137 py_type = "num_list",
138 desc_short = "lower bounds",
139 desc = "The lower bounds of the space. If you wish to change the lower bounds of the map then supply an array of length equal to the number of parameters in the model. A lower bound for each parameter must be supplied. If nothing is supplied then the defaults will be used.",
140 can_be_none = True
141 )
142 uf.add_keyarg(
143 name = "upper",
144 py_type = "num_list",
145 desc_short = "upper bounds",
146 desc = "The upper bounds of the space. If you wish to change the upper bounds of the map then supply an array of length equal to the number of parameters in the model. A upper bound for each parameter must be supplied. If nothing is supplied then the defaults will be used.",
147 can_be_none = True
148 )
149 uf.add_keyarg(
150 name = "axis_incs",
151 default = 5,
152 py_type = "int",
153 desc_short = "axis increments",
154 desc = "The number of increments or ticks displaying parameter values along the axes of the OpenDX plot.",
155 wiz_element_type = "spin"
156 )
157 uf.add_keyarg(
158 name = "file_prefix",
159 default = "map",
160 py_type = "str",
161 desc_short = "file prefix",
162 desc = "The file name. All the output files are prefixed with this name. The main file containing the data points will be called the value of 'file'. The OpenDX program will be called 'file.net' and the OpenDX import file will be called 'file.general'."
163 )
164 uf.add_keyarg(
165 name = "dir",
166 default = "dx",
167 py_type = "str",
168 arg_type = "dir sel",
169 desc_short = "directory name",
170 desc = "The directory to output files to. Set this to 'None' if you do not want the files to be placed in subdirectory. If the directory does not exist, it will be created.",
171 can_be_none = True
172 )
173 uf.add_keyarg(
174 name = "point",
175 py_type = "num_list",
176 desc_short = "point",
177 desc = "An array of parameter values where a point in the map, shown as a red sphere, will be placed. The length must be equal to the number of parameters.",
178 can_be_none = True
179 )
180 uf.add_keyarg(
181 name = "point_file",
182 default = "point",
183 py_type = "str",
184 desc_short = "point file name prefix",
185 desc = "The name of that the point output files will be prefixed with.",
186 can_be_none = True
187 )
188 uf.add_keyarg(
189 name = "remap",
190 py_type = "func",
191 arg_type = "func",
192 desc_short = "remap function",
193 desc = "A user supplied remapping function. This function will receive the parameter array and must return an array of equal length.",
194 can_be_none = True
195 )
196
197 uf.desc.append(Desc_container())
198 uf.desc[-1].add_paragraph("This will map the space corresponding to the spin identifier and create the OpenDX files. The map type can be changed to one of the following supported map types:")
199 table = uf_tables.add_table(label="table: opendx map", caption="OpenDx mapping types.")
200 table.add_headings(["Surface type", "Name"])
201 table.add_row(["3D isosurface", "'Iso3D'"])
202 uf.desc[-1].add_table(table.label)
203
204 uf.desc.append(regexp_doc)
205 uf.desc.append(diffusion_tensor.__return_data_name_doc__)
206 uf.desc.append(Model_free.return_data_name_doc)
207
208 uf.desc.append(Desc_container("Prompt examples"))
209 uf.desc[-1].add_paragraph("The following commands will generate a map of the extended model-free space for model 'm5' consisting of the parameters {S2, S2f, ts}. Files will be output into the directory 'dx' and will be prefixed by 'map'. In this case, the system is a protein and residue number 6 will be mapped.")
210 uf.desc[-1].add_prompt("relax> dx.map(['s2', 's2f', 'ts'], spin_id=':6')")
211 uf.desc[-1].add_prompt("relax> dx.map(['s2', 's2f', 'ts'], spin_id=':6', file_prefix='map', dir='dx')")
212 uf.desc[-1].add_prompt("relax> dx.map(params=['s2', 's2f', 'ts'], spin_id=':6', inc=20, file_prefix='map', dir='dx')")
213 uf.desc[-1].add_prompt("relax> dx.map(params=['s2', 's2f', 'ts'], spin_id=':6', map_type='Iso3D', inc=20, file_prefix='map', dir='dx')")
214 uf.desc[-1].add_paragraph("To map the model-free space 'm4' for residue 2, spin N6 defined by the parameters {S2, te, Rex}, name the results 'test', and to place the files in the current directory, use one of the following commands:")
215 uf.desc[-1].add_prompt("relax> dx.map(['s2', 'te', 'rex'], spin_id=':2@N6', file_prefix='test', dir=None)")
216 uf.desc[-1].add_prompt("relax> dx.map(params=['s2', 'te', 'rex'], spin_id=':2@N6', inc=100, file_prefix='test', dir=None)")
217 uf.backend = map
218 uf.menu_text = "&map"
219 uf.gui_icon = "relax.grid_search"
220 uf.wizard_height_desc = 280
221 uf.wizard_size = (1000, 750)
222 uf.wizard_image = WIZARD_IMAGE_PATH + 'opendx.png'
223