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