1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """The select user function definitions."""
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 pipe_control import domain, selection
35 from user_functions.data import Uf_info; uf_info = Uf_info()
36 from user_functions.objects import Desc_container
37
38
39
40 uf_class = uf_info.add_class("select")
41 uf_class.title = "Class for selecting spins."
42 uf_class.menu_text = "&select"
43 uf_class.gui_icon = "relax.spin"
44
45
46
47 uf = uf_info.add_uf("select.all")
48 uf.title = "Select all spins in the current data pipe."
49 uf.title_short = "Selection of all spins."
50 uf.display = True
51
52 uf.desc.append(Desc_container())
53 uf.desc[-1].add_paragraph("This will select all spins, irregardless of their current state.")
54
55 uf.desc.append(Desc_container("Prompt examples"))
56 uf.desc[-1].add_paragraph("To select all spins, simply type:")
57 uf.desc[-1].add_prompt("relax> select.all()")
58 uf.backend = selection.sel_all
59 uf.menu_text = "&all"
60 uf.wizard_size = (600, 550)
61 uf.wizard_apply_button = False
62 uf.wizard_image = WIZARD_IMAGE_PATH + 'select.png'
63
64
65
66 uf = uf_info.add_uf("select.domain")
67 uf.title = "Select all spins and interatomic data containers of a domain."
68 uf.title_short = "Selection of whole domains."
69 uf.display = True
70 uf.add_keyarg(
71 name = "domain_id",
72 py_type = "str",
73 arg_type = "domain ID",
74 desc_short = "domain ID string",
75 desc = "The domain ID string of the domain to select.",
76 wiz_element_type = 'combo',
77 wiz_combo_iter = domain.get_domain_ids,
78 can_be_none = False
79 )
80 uf.add_keyarg(
81 name = "boolean",
82 default = "AND",
83 py_type = "str",
84 desc_short = "boolean operator",
85 desc = "The boolean operator specifying how interatomic data containers should be selected.",
86 wiz_element_type = "combo",
87 wiz_combo_choices = [
88 "OR",
89 "NOR",
90 "AND",
91 "NAND",
92 "XOR",
93 "XNOR"
94 ],
95 wiz_read_only = True
96 )
97 uf.add_keyarg(
98 name = "change_all",
99 default = True,
100 py_type = "bool",
101 desc_short = "change all flag",
102 desc = "A flag specifying if all non-matching spin and interatomic data containers should be deselected."
103 )
104
105 uf.desc.append(Desc_container())
106 uf.desc[-1].add_paragraph("This will select all spins and interatomic data containers of a given domain. This is defined by the domain ID string as specified by the previously executed domain-related user functions.")
107 uf.desc.append(selection.boolean_doc)
108
109 uf.desc.append(Desc_container("Prompt examples"))
110 uf.desc[-1].add_paragraph("To select all spins of the domain 'N-dom', simply type one of:")
111 uf.desc[-1].add_prompt("relax> select.domain('N-dom', change_all=True)")
112 uf.desc[-1].add_prompt("relax> select.domain(domain_id='N-dom', change_all=True)")
113 uf.desc[-1].add_paragraph("To select all spins of the domain 'N-dom', preserving the current selections, simply type one of:")
114 uf.desc[-1].add_prompt("relax> select.domain('N-dom', 'AND', True)")
115 uf.desc[-1].add_prompt("relax> select.domain(domain_id='N-dom', boolean='AND', change_all=True)")
116 uf.backend = selection.sel_domain
117 uf.menu_text = "&domain"
118 uf.wizard_height_desc = 500
119 uf.wizard_size = (1000, 750)
120 uf.wizard_apply_button = True
121 uf.wizard_image = WIZARD_IMAGE_PATH + 'select.png'
122
123
124
125 uf = uf_info.add_uf("select.interatom")
126 uf.title = "Select specific interatomic data containers."
127 uf.title_short = "Interatomic data container selection."
128 uf.display = True
129 uf.add_keyarg(
130 name = "spin_id1",
131 py_type = "str",
132 arg_type = "spin ID",
133 desc_short = "first spin ID string",
134 desc = "The spin ID string of the first spin of the interatomic data container.",
135 can_be_none = True
136 )
137 uf.add_keyarg(
138 name = "spin_id2",
139 py_type = "str",
140 arg_type = "spin ID",
141 desc_short = "second spin ID string",
142 desc = "The spin ID string of the second spin of the interatomic data container.",
143 can_be_none = True
144 )
145 uf.add_keyarg(
146 name = "boolean",
147 default = "OR",
148 py_type = "str",
149 desc_short = "boolean operator",
150 desc = "The boolean operator specifying how interatomic data containers should be selected.",
151 wiz_element_type = "combo",
152 wiz_combo_choices = [
153 "OR",
154 "NOR",
155 "AND",
156 "NAND",
157 "XOR",
158 "XNOR"
159 ],
160 wiz_read_only = True
161 )
162 uf.add_keyarg(
163 name = "change_all",
164 default = False,
165 py_type = "bool",
166 desc_short = "change all",
167 desc = "A flag specifying if all other interatomic data containers should be changed."
168 )
169
170 uf.desc.append(Desc_container())
171 uf.desc[-1].add_paragraph("This is used to select specific interatomic data containers which store information about spin pairs such as RDCs, NOEs, dipole-dipole pairs involved in relaxation, etc. The 'change all' flag default is False meaning that all interatomic data containers currently either selected or deselected will remain that way. Setting this to True will cause all interatomic data containers not specified by the spin ID strings to be selected.")
172 uf.desc.append(selection.boolean_doc)
173
174 uf.desc.append(Desc_container("Prompt examples"))
175 uf.desc[-1].add_paragraph("To select all N-H backbone bond vectors of a protein, assuming these interatomic data containers have been already set up, type one of:")
176 uf.desc[-1].add_prompt("relax> select.interatom('@N', '@H')")
177 uf.desc[-1].add_prompt("relax> select.interatom(spin_id1='@N', spin_id2='@H')")
178 uf.desc[-1].add_paragraph("To select all H-H interatomic vectors of a small organic molecule, type one of:")
179 uf.desc[-1].add_prompt("relax> select.interatom('@H*', '@H*')")
180 uf.desc[-1].add_prompt("relax> select.interatom(spin_id1='@H*', spin_id2='@H*')")
181 uf.backend = selection.sel_interatom
182 uf.menu_text = "&interatom"
183 uf.wizard_height_desc = 450
184 uf.wizard_size = (1000, 750)
185 uf.wizard_image = WIZARD_IMAGE_PATH + 'select.png'
186
187
188
189 uf = uf_info.add_uf("select.read")
190 uf.title = "Select the spins contained in a file."
191 uf.title_short = "Selecting spins from file."
192 uf.display = True
193 uf.add_keyarg(
194 name = "file",
195 py_type = "str_or_inst",
196 arg_type = "file sel",
197 desc_short = "file name",
198 desc = "The name of the file containing the list of spins to select.",
199 wiz_filesel_style = FD_OPEN
200 )
201 uf.add_keyarg(
202 name = "dir",
203 py_type = "str",
204 arg_type = "dir",
205 desc_short = "directory name",
206 desc = "The directory where the file is located.",
207 can_be_none = True
208 )
209 uf.add_keyarg(
210 name = "spin_id_col",
211 py_type = "int",
212 arg_type = "free format",
213 desc_short = "spin ID string column",
214 desc = "The spin ID string column (an alternative to the mol, res, and spin name and number columns).",
215 can_be_none = True
216 )
217 uf.add_keyarg(
218 name = "mol_name_col",
219 py_type = "int",
220 arg_type = "free format",
221 desc_short = "molecule name column",
222 desc = "The molecule name column (alternative to the spin_id_col).",
223 can_be_none = True
224 )
225 uf.add_keyarg(
226 name = "res_num_col",
227 py_type = "int",
228 arg_type = "free format",
229 desc_short = "residue number column",
230 desc = "The residue number column (alternative to the spin_id_col).",
231 can_be_none = True
232 )
233 uf.add_keyarg(
234 name = "res_name_col",
235 py_type = "int",
236 arg_type = "free format",
237 desc_short = "residue name column",
238 desc = "The residue name column (alternative to the spin_id_col).",
239 can_be_none = True
240 )
241 uf.add_keyarg(
242 name = "spin_num_col",
243 py_type = "int",
244 arg_type = "free format",
245 desc_short = "spin number column",
246 desc = "The spin number column (alternative to the spin_id_col).",
247 can_be_none = True
248 )
249 uf.add_keyarg(
250 name = "spin_name_col",
251 py_type = "int",
252 arg_type = "free format",
253 desc_short = "spin name column",
254 desc = "The spin name column (alternative to the spin_id_col).",
255 can_be_none = True
256 )
257 uf.add_keyarg(
258 name = "sep",
259 py_type = "str",
260 arg_type = "free format",
261 desc_short = "column separator",
262 desc = "The column separator (the default is white space).",
263 can_be_none = True
264 )
265 uf.add_keyarg(
266 name = "spin_id",
267 py_type = "str",
268 arg_type = "spin ID",
269 desc_short = "spin ID string",
270 desc = "The spin ID string to restrict the loading of data to certain spin subsets.",
271 can_be_none = True
272 )
273 uf.add_keyarg(
274 name = "boolean",
275 default = "OR",
276 py_type = "str",
277 desc_short = "boolean operator",
278 desc = "The boolean operator specifying how spins should be selected.",
279 wiz_element_type = "combo",
280 wiz_combo_choices = [
281 "OR",
282 "NOR",
283 "AND",
284 "NAND",
285 "XOR",
286 "XNOR"
287 ],
288 wiz_read_only = True
289 )
290 uf.add_keyarg(
291 name = "change_all",
292 default = False,
293 py_type = "bool",
294 desc_short = "change all",
295 desc = "A flag specifying if all other spins should be changed."
296 )
297
298 uf.desc.append(Desc_container())
299 uf.desc[-1].add_paragraph("The spin system can be identified in the file using two different formats. The first is the spin ID string column which can include the molecule name, the residue name and number, and the spin name and number. Alternatively the molecule name, residue number, residue name, spin number and/or spin name columns can be supplied allowing this information to be in separate columns. Note that the numbering of columns starts at one. The spin ID string can be used to restrict the reading to certain spin types, for example only 15N spins when only residue information is in the file.")
300 uf.desc[-1].add_paragraph("Empty lines and lines beginning with a hash are ignored.")
301 uf.desc[-1].add_paragraph("The 'change all' flag default is False meaning that all spins currently either selected or deselected will remain that way. Setting this to True will cause all spins not specified in the file to be deselected.")
302 uf.desc.append(selection.boolean_doc)
303
304 uf.desc.append(Desc_container("Prompt examples"))
305 uf.desc[-1].add_paragraph("To select all residues listed with residue numbers in the first column of the file 'isolated_peaks', type one of:")
306 uf.desc[-1].add_prompt("relax> select.read('isolated_peaks', res_num_col=1)")
307 uf.desc[-1].add_prompt("relax> select.read(file='isolated_peaks', res_num_col=1)")
308 uf.desc[-1].add_paragraph("To select the spins in the second column of the relaxation data file 'r1.600' while deselecting all other spins, for example type:")
309 uf.desc[-1].add_prompt("relax> select.read('r1.600', spin_num_col=2, change_all=True)")
310 uf.desc[-1].add_prompt("relax> select.read(file='r1.600', spin_num_col=2, change_all=True)")
311 uf.backend = selection.sel_read
312 uf.menu_text = "&read"
313 uf.gui_icon = "oxygen.actions.document-open"
314 uf.wizard_height_desc = 400
315 uf.wizard_size = (1000, 750)
316 uf.wizard_image = WIZARD_IMAGE_PATH + 'select.png'
317
318
319
320 uf = uf_info.add_uf("select.reverse")
321 uf.title = "Reversal of the spin selection for the given spins."
322 uf.title_short = "Spin selection reversal."
323 uf.display = True
324 uf.add_keyarg(
325 name = "spin_id",
326 py_type = "str",
327 desc_short = "spin ID string",
328 desc = "The spin ID string.",
329 can_be_none = True
330 )
331
332 uf.desc.append(Desc_container())
333 uf.desc[-1].add_paragraph("By supplying the spin ID string, a subset of spins can have their selection status reversed.")
334
335 uf.desc.append(Desc_container("Prompt examples"))
336 uf.desc[-1].add_paragraph("To select all currently deselected spins and deselect those which are selected type:")
337 uf.desc[-1].add_prompt("relax> select.reverse()")
338 uf.backend = selection.reverse
339 uf.menu_text = "re&verse"
340 uf.gui_icon = "oxygen.actions.system-switch-user"
341 uf.wizard_size = (700, 550)
342 uf.wizard_apply_button = False
343 uf.wizard_image = WIZARD_IMAGE_PATH + 'select.png'
344
345
346
347 uf = uf_info.add_uf("select.spin")
348 uf.title = "Select specific spins."
349 uf.title_short = "Spin selection."
350 uf.display = True
351 uf.add_keyarg(
352 name = "spin_id",
353 py_type = "str",
354 desc_short = "spin ID string",
355 desc = "The spin ID string.",
356 can_be_none = True
357 )
358 uf.add_keyarg(
359 name = "boolean",
360 default = "OR",
361 py_type = "str",
362 desc_short = "boolean operator",
363 desc = "The boolean operator specifying how spins should be selected.",
364 wiz_element_type = "combo",
365 wiz_combo_choices = [
366 "OR",
367 "NOR",
368 "AND",
369 "NAND",
370 "XOR",
371 "XNOR"
372 ],
373 wiz_read_only = True
374 )
375 uf.add_keyarg(
376 name = "change_all",
377 default = False,
378 py_type = "bool",
379 desc_short = "change all",
380 desc = "A flag specifying if all other spins should be changed."
381 )
382
383 uf.desc.append(Desc_container())
384 uf.desc[-1].add_paragraph("The 'change all' flag default is False meaning that all spins currently either selected or deselected will remain that way. Setting this to True will cause all spins not specified by the spin ID string to be selected.")
385 uf.desc.append(selection.boolean_doc)
386
387 uf.desc.append(Desc_container("Prompt examples"))
388 uf.desc[-1].add_paragraph("To select only glycines and alanines, assuming they have been loaded with the names GLY and ALA, type one of:")
389 uf.desc[-1].add_prompt("relax> select.spin(spin_id=':GLY|:ALA')")
390 uf.desc[-1].add_paragraph("To select residue 5 CYS in addition to the currently selected residues, type one of:")
391 uf.desc[-1].add_prompt("relax> select.spin(':5')")
392 uf.desc[-1].add_prompt("relax> select.spin(':5&:CYS')")
393 uf.desc[-1].add_prompt("relax> select.spin(spin_id=':5&:CYS')")
394 uf.backend = selection.sel_spin
395 uf.menu_text = "&spin"
396 uf.gui_icon = "relax.spin"
397 uf.wizard_height_desc = 500
398 uf.wizard_size = (1000, 750)
399 uf.wizard_image = WIZARD_IMAGE_PATH + 'select.png'
400