1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 """The select user function definitions."""
25
26
27 from graphics import WIZARD_IMAGE_PATH
28 from pipe_control import domain, selection, spectrum
29 from user_functions.data import Uf_info; uf_info = Uf_info()
30 from user_functions.objects import Desc_container
31
32
33
34 uf_class = uf_info.add_class("select")
35 uf_class.title = "Class for selecting spins."
36 uf_class.menu_text = "&select"
37 uf_class.gui_icon = "relax.spin"
38
39
40
41 uf = uf_info.add_uf("select.all")
42 uf.title = "Select all spins in the current data pipe."
43 uf.title_short = "Selection of all spins."
44 uf.display = True
45
46 uf.desc.append(Desc_container())
47 uf.desc[-1].add_paragraph("This will select all spins, irregardless of their current state.")
48
49 uf.desc.append(Desc_container("Prompt examples"))
50 uf.desc[-1].add_paragraph("To select all spins, simply type:")
51 uf.desc[-1].add_prompt("relax> select.all()")
52 uf.backend = selection.sel_all
53 uf.menu_text = "&all"
54 uf.wizard_size = (600, 550)
55 uf.wizard_apply_button = False
56 uf.wizard_image = WIZARD_IMAGE_PATH + 'select.png'
57
58
59
60 uf = uf_info.add_uf('select.display')
61 uf.title = "Display the current spin selection status."
62 uf.title_short = "Display spin selection status."
63 uf.display = True
64
65 uf.desc.append(Desc_container())
66 uf.desc[-1].add_paragraph("This simply prints out the current spin selections.")
67
68 uf.desc.append(Desc_container("Prompt examples"))
69 uf.desc[-1].add_paragraph("To show the current selections, type:")
70 uf.desc[-1].add_prompt("relax> select.display()")
71 uf.backend = selection.display
72 uf.menu_text = "dis&play"
73 uf.gui_icon = "oxygen.actions.document-preview"
74 uf.wizard_size = (600, 550)
75 uf.wizard_apply_button = False
76 uf.wizard_image = WIZARD_IMAGE_PATH + 'select.png'
77
78
79
80 uf = uf_info.add_uf("select.domain")
81 uf.title = "Select all spins and interatomic data containers of a domain."
82 uf.title_short = "Selection of whole domains."
83 uf.display = True
84 uf.add_keyarg(
85 name = "domain_id",
86 basic_types = ["str"],
87 desc_short = "domain ID string",
88 desc = "The domain ID string of the domain to select.",
89 wiz_element_type = 'combo',
90 wiz_combo_iter = domain.get_domain_ids,
91 can_be_none = False
92 )
93 uf.add_keyarg(
94 name = "boolean",
95 default = "AND",
96 basic_types = ["str"],
97 desc_short = "boolean operator",
98 desc = "The boolean operator specifying how interatomic data containers should be selected.",
99 wiz_element_type = "combo",
100 wiz_combo_choices = [
101 "OR",
102 "NOR",
103 "AND",
104 "NAND",
105 "XOR",
106 "XNOR"
107 ],
108 wiz_read_only = True
109 )
110 uf.add_keyarg(
111 name = "change_all",
112 default = True,
113 basic_types = ["bool"],
114 desc_short = "change all flag",
115 desc = "A flag specifying if all non-matching spin and interatomic data containers should be deselected."
116 )
117
118 uf.desc.append(Desc_container())
119 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.")
120 uf.desc.append(selection.boolean_doc)
121
122 uf.desc.append(Desc_container("Prompt examples"))
123 uf.desc[-1].add_paragraph("To select all spins of the domain 'N-dom', simply type one of:")
124 uf.desc[-1].add_prompt("relax> select.domain('N-dom', change_all=True)")
125 uf.desc[-1].add_prompt("relax> select.domain(domain_id='N-dom', change_all=True)")
126 uf.desc[-1].add_paragraph("To select all spins of the domain 'N-dom', preserving the current selections, simply type one of:")
127 uf.desc[-1].add_prompt("relax> select.domain('N-dom', 'AND', True)")
128 uf.desc[-1].add_prompt("relax> select.domain(domain_id='N-dom', boolean='AND', change_all=True)")
129 uf.backend = selection.sel_domain
130 uf.menu_text = "&domain"
131 uf.wizard_height_desc = 500
132 uf.wizard_size = (1000, 750)
133 uf.wizard_apply_button = True
134 uf.wizard_image = WIZARD_IMAGE_PATH + 'select.png'
135
136
137
138 uf = uf_info.add_uf("select.interatom")
139 uf.title = "Select specific interatomic data containers."
140 uf.title_short = "Interatomic data container selection."
141 uf.display = True
142 uf.add_keyarg(
143 name = "spin_id1",
144 arg_type = "spin ID",
145 desc_short = "first spin ID string",
146 desc = "The spin ID string of the first spin of the interatomic data container.",
147 can_be_none = True
148 )
149 uf.add_keyarg(
150 name = "spin_id2",
151 arg_type = "spin ID",
152 desc_short = "second spin ID string",
153 desc = "The spin ID string of the second spin of the interatomic data container.",
154 can_be_none = True
155 )
156 uf.add_keyarg(
157 name = "boolean",
158 default = "OR",
159 basic_types = ["str"],
160 desc_short = "boolean operator",
161 desc = "The boolean operator specifying how interatomic data containers should be selected.",
162 wiz_element_type = "combo",
163 wiz_combo_choices = [
164 "OR",
165 "NOR",
166 "AND",
167 "NAND",
168 "XOR",
169 "XNOR"
170 ],
171 wiz_read_only = True
172 )
173 uf.add_keyarg(
174 name = "change_all",
175 default = False,
176 basic_types = ["bool"],
177 desc_short = "change all",
178 desc = "A flag specifying if all other interatomic data containers should be changed."
179 )
180
181 uf.desc.append(Desc_container())
182 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.")
183 uf.desc.append(selection.boolean_doc)
184
185 uf.desc.append(Desc_container("Prompt examples"))
186 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:")
187 uf.desc[-1].add_prompt("relax> select.interatom('@N', '@H')")
188 uf.desc[-1].add_prompt("relax> select.interatom(spin_id1='@N', spin_id2='@H')")
189 uf.desc[-1].add_paragraph("To select all H-H interatomic vectors of a small organic molecule, type one of:")
190 uf.desc[-1].add_prompt("relax> select.interatom('@H*', '@H*')")
191 uf.desc[-1].add_prompt("relax> select.interatom(spin_id1='@H*', spin_id2='@H*')")
192 uf.backend = selection.sel_interatom
193 uf.menu_text = "&interatom"
194 uf.wizard_height_desc = 450
195 uf.wizard_size = (1000, 750)
196 uf.wizard_image = WIZARD_IMAGE_PATH + 'select.png'
197
198
199
200 uf = uf_info.add_uf("select.read")
201 uf.title = "Select the spins contained in a file."
202 uf.title_short = "Selecting spins from file."
203 uf.display = True
204 uf.add_keyarg(
205 name = "file",
206 arg_type = "file sel read",
207 desc_short = "file name",
208 desc = "The name of the file containing the list of spins to select.",
209 )
210 uf.add_keyarg(
211 name = "dir",
212 arg_type = "dir",
213 desc_short = "directory name",
214 desc = "The directory where the file is located.",
215 can_be_none = True
216 )
217 uf.add_keyarg(
218 name = "spin_id_col",
219 basic_types = ["int"],
220 arg_type = "free format",
221 desc_short = "spin ID string column",
222 desc = "The spin ID string column (an alternative to the mol, res, and spin name and number columns).",
223 can_be_none = True
224 )
225 uf.add_keyarg(
226 name = "mol_name_col",
227 basic_types = ["int"],
228 arg_type = "free format",
229 desc_short = "molecule name column",
230 desc = "The molecule name column (alternative to the spin_id_col).",
231 can_be_none = True
232 )
233 uf.add_keyarg(
234 name = "res_num_col",
235 basic_types = ["int"],
236 arg_type = "free format",
237 desc_short = "residue number column",
238 desc = "The residue number column (alternative to the spin_id_col).",
239 can_be_none = True
240 )
241 uf.add_keyarg(
242 name = "res_name_col",
243 basic_types = ["int"],
244 arg_type = "free format",
245 desc_short = "residue name column",
246 desc = "The residue name column (alternative to the spin_id_col).",
247 can_be_none = True
248 )
249 uf.add_keyarg(
250 name = "spin_num_col",
251 basic_types = ["int"],
252 arg_type = "free format",
253 desc_short = "spin number column",
254 desc = "The spin number column (alternative to the spin_id_col).",
255 can_be_none = True
256 )
257 uf.add_keyarg(
258 name = "spin_name_col",
259 basic_types = ["int"],
260 arg_type = "free format",
261 desc_short = "spin name column",
262 desc = "The spin name column (alternative to the spin_id_col).",
263 can_be_none = True
264 )
265 uf.add_keyarg(
266 name = "sep",
267 basic_types = ["str"],
268 arg_type = "free format",
269 desc_short = "column separator",
270 desc = "The column separator (the default is white space).",
271 can_be_none = True
272 )
273 uf.add_keyarg(
274 name = "spin_id",
275 arg_type = "spin ID",
276 desc_short = "spin ID string",
277 desc = "The spin ID string to restrict the loading of data to certain spin subsets.",
278 can_be_none = True
279 )
280 uf.add_keyarg(
281 name = "boolean",
282 default = "OR",
283 basic_types = ["str"],
284 desc_short = "boolean operator",
285 desc = "The boolean operator specifying how spins should be selected.",
286 wiz_element_type = "combo",
287 wiz_combo_choices = [
288 "OR",
289 "NOR",
290 "AND",
291 "NAND",
292 "XOR",
293 "XNOR"
294 ],
295 wiz_read_only = True
296 )
297 uf.add_keyarg(
298 name = "change_all",
299 default = False,
300 basic_types = ["bool"],
301 desc_short = "change all",
302 desc = "A flag specifying if all other spins should be changed."
303 )
304
305 uf.desc.append(Desc_container())
306 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.")
307 uf.desc[-1].add_paragraph("Empty lines and lines beginning with a hash are ignored.")
308 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.")
309 uf.desc.append(selection.boolean_doc)
310
311 uf.desc.append(Desc_container("Prompt examples"))
312 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:")
313 uf.desc[-1].add_prompt("relax> select.read('isolated_peaks', res_num_col=1)")
314 uf.desc[-1].add_prompt("relax> select.read(file='isolated_peaks', res_num_col=1)")
315 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:")
316 uf.desc[-1].add_prompt("relax> select.read('r1.600', spin_num_col=2, change_all=True)")
317 uf.desc[-1].add_prompt("relax> select.read(file='r1.600', spin_num_col=2, change_all=True)")
318 uf.backend = selection.sel_read
319 uf.menu_text = "&read"
320 uf.gui_icon = "oxygen.actions.document-open"
321 uf.wizard_height_desc = 400
322 uf.wizard_size = (1000, 750)
323 uf.wizard_image = WIZARD_IMAGE_PATH + 'select.png'
324
325
326
327 uf = uf_info.add_uf("select.reverse")
328 uf.title = "Reversal of the spin selection for the given spins."
329 uf.title_short = "Spin selection reversal."
330 uf.display = True
331 uf.add_keyarg(
332 name = "spin_id",
333 basic_types = ["str"],
334 desc_short = "spin ID string",
335 desc = "The spin ID string.",
336 can_be_none = True
337 )
338
339 uf.desc.append(Desc_container())
340 uf.desc[-1].add_paragraph("By supplying the spin ID string, a subset of spins can have their selection status reversed.")
341
342 uf.desc.append(Desc_container("Prompt examples"))
343 uf.desc[-1].add_paragraph("To select all currently deselected spins and deselect those which are selected type:")
344 uf.desc[-1].add_prompt("relax> select.reverse()")
345 uf.backend = selection.reverse
346 uf.menu_text = "re&verse"
347 uf.gui_icon = "oxygen.actions.system-switch-user"
348 uf.wizard_size = (700, 550)
349 uf.wizard_apply_button = False
350 uf.wizard_image = WIZARD_IMAGE_PATH + 'select.png'
351
352
353
354 uf = uf_info.add_uf("select.sn_ratio")
355 uf.title = "Select spins with signal to noise ratio higher or lower than the given ratio."
356 uf.title_short = "Spin signal to noise selection."
357 uf.display = True
358 uf.add_keyarg(
359 name = "ratio",
360 default = 10.0,
361 basic_types = ["float"],
362 desc_short = "ratio",
363 desc = "The signal to noise ratio to compare to."
364 )
365 uf.add_keyarg(
366 name = "operation",
367 default = ">",
368 basic_types = ["str"],
369 desc_short = "comparison operation",
370 desc = "The comparison operation by which to select the spins.",
371 wiz_element_type = "combo",
372 wiz_combo_choices = [
373 "'<' : strictly less than",
374 "'<=' : less than or equal",
375 "'>' : strictly greater than",
376 "'>=' : greater than or equal",
377 "'==' : equal",
378 "'!=' : not equal",
379 ],
380 wiz_combo_data = [
381 "<",
382 "<=",
383 ">",
384 ">=",
385 "==",
386 "!=",
387 ],
388 wiz_read_only = True
389 )
390 uf.add_keyarg(
391 name = "all_sn",
392 default = True,
393 basic_types = ["bool"],
394 desc_short = "all S/N per spin flag",
395 desc = "A flag specifying if all the signal to noise ratios per spin should match the comparison operator, of if just a single comparison match is enough."
396 )
397
398 uf.desc.append(Desc_container())
399 uf.desc[-1].add_paragraph("The comparison operation is the method which to select spins according to: operation(sn_ratio, ratio).")
400 uf.desc[-1].add_paragraph("The possible operations are: '<':strictly less than, '<=':less than or equal, '>':strictly greater than, '>=':greater than or equal, '==':equal, '!=':not equal.")
401 uf.desc[-1].add_paragraph("The 'all_sn' flag default is True, meaning that if all of the spin's signal to noise levels evaluates to True in the comparison, the spin is selected.")
402
403 uf.desc.append(Desc_container("Prompt examples"))
404 uf.desc[-1].add_paragraph("To select all spins with a signal to noise ratio higher than 10.0:")
405 uf.desc[-1].add_prompt("relax> select.sn_ratio(ratio=10.0, operation='>')")
406 uf.desc[-1].add_prompt("relax> select.sn_ratio(ratio=10.0, operation='>', all_sn=False)")
407 uf.backend = spectrum.sn_ratio_selection
408 uf.menu_text = "&sn_ratio"
409 uf.gui_icon = "relax.fid"
410 uf.wizard_height_desc = 500
411 uf.wizard_size = (1000, 750)
412 uf.wizard_image = WIZARD_IMAGE_PATH + 'select.png'
413
414
415
416 uf = uf_info.add_uf("select.spin")
417 uf.title = "Select specific spins."
418 uf.title_short = "Spin selection."
419 uf.display = True
420 uf.add_keyarg(
421 name = "spin_id",
422 basic_types = ["str"],
423 desc_short = "spin ID string",
424 desc = "The spin ID string.",
425 can_be_none = True
426 )
427 uf.add_keyarg(
428 name = "boolean",
429 default = "OR",
430 basic_types = ["str"],
431 desc_short = "boolean operator",
432 desc = "The boolean operator specifying how spins should be selected.",
433 wiz_element_type = "combo",
434 wiz_combo_choices = [
435 "OR",
436 "NOR",
437 "AND",
438 "NAND",
439 "XOR",
440 "XNOR"
441 ],
442 wiz_read_only = True
443 )
444 uf.add_keyarg(
445 name = "change_all",
446 default = False,
447 basic_types = ["bool"],
448 desc_short = "change all",
449 desc = "A flag specifying if all other spins should be changed."
450 )
451
452 uf.desc.append(Desc_container())
453 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.")
454 uf.desc.append(selection.boolean_doc)
455
456 uf.desc.append(Desc_container("Prompt examples"))
457 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:")
458 uf.desc[-1].add_prompt("relax> select.spin(spin_id=':GLY|:ALA')")
459 uf.desc[-1].add_paragraph("To select residue 5 CYS in addition to the currently selected residues, type one of:")
460 uf.desc[-1].add_prompt("relax> select.spin(':5')")
461 uf.desc[-1].add_prompt("relax> select.spin(':5&:CYS')")
462 uf.desc[-1].add_prompt("relax> select.spin(spin_id=':5&:CYS')")
463 uf.backend = selection.sel_spin
464 uf.menu_text = "&spin"
465 uf.gui_icon = "relax.spin"
466 uf.wizard_height_desc = 500
467 uf.wizard_size = (1000, 750)
468 uf.wizard_image = WIZARD_IMAGE_PATH + 'select.png'
469