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