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 import wx
28
29
30 from generic_fns import selection
31 from graphics import WIZARD_IMAGE_PATH
32 from user_functions.data import Uf_info; uf_info = Uf_info()
33 from user_functions.objects import Desc_container
34
35
36
37 uf_class = uf_info.add_class("deselect")
38 uf_class.title = "Class for deselecting spins."
39 uf_class.menu_text = "&deselect"
40 uf_class.gui_icon = "relax.spin_grey"
41
42
43
44 uf = uf_info.add_uf("deselect.all")
45 uf.title = "Deselect all spins in the current data pipe."
46 uf.title_short = "Deselection of all spins."
47 uf.display = True
48
49 uf.desc.append(Desc_container())
50 uf.desc[-1].add_paragraph("This will deselect all spins, irregardless of their current state.")
51
52 uf.desc.append(Desc_container("Prompt examples"))
53 uf.desc[-1].add_paragraph("To deselect all spins, simply type:")
54 uf.desc[-1].add_prompt("relax> deselect.all()")
55 uf.backend = selection.desel_all
56 uf.menu_text = "&all"
57 uf.wizard_size = (600, 550)
58 uf.wizard_apply_button = False
59 uf.wizard_image = WIZARD_IMAGE_PATH + 'deselect.png'
60
61
62
63 uf = uf_info.add_uf("deselect.read")
64 uf.title = "Deselect the spins contained in a file."
65 uf.title_short = "Deselecting spins from file."
66 uf.display = True
67 uf.add_keyarg(
68 name = "file",
69 py_type = "str_or_inst",
70 arg_type = "file sel",
71 desc_short = "file name",
72 desc = "The name of the file containing the list of spins to deselect.",
73 wiz_filesel_style = wx.FD_OPEN
74 )
75 uf.add_keyarg(
76 name = "dir",
77 py_type = "str",
78 arg_type = "dir",
79 desc_short = "directory name",
80 desc = "The directory where the file is located.",
81 can_be_none = True
82 )
83 uf.add_keyarg(
84 name = "spin_id_col",
85 py_type = "int",
86 arg_type = "free format",
87 desc_short = "spin ID string column",
88 desc = "The spin ID string column (an alternative to the mol, res, and spin name and number columns).",
89 can_be_none = True
90 )
91 uf.add_keyarg(
92 name = "mol_name_col",
93 py_type = "int",
94 arg_type = "free format",
95 desc_short = "molecule name column",
96 desc = "The molecule name column (alternative to the spin_id_col).",
97 can_be_none = True
98 )
99 uf.add_keyarg(
100 name = "res_num_col",
101 py_type = "int",
102 arg_type = "free format",
103 desc_short = "residue number column",
104 desc = "The residue number column (alternative to the spin_id_col).",
105 can_be_none = True
106 )
107 uf.add_keyarg(
108 name = "res_name_col",
109 py_type = "int",
110 arg_type = "free format",
111 desc_short = "residue name column",
112 desc = "The residue name column (alternative to the spin_id_col).",
113 can_be_none = True
114 )
115 uf.add_keyarg(
116 name = "spin_num_col",
117 py_type = "int",
118 arg_type = "free format",
119 desc_short = "spin number column",
120 desc = "The spin number column (alternative to the spin_id_col).",
121 can_be_none = True
122 )
123 uf.add_keyarg(
124 name = "spin_name_col",
125 py_type = "int",
126 arg_type = "free format",
127 desc_short = "spin name column",
128 desc = "The spin name column (alternative to the spin_id_col).",
129 can_be_none = True
130 )
131 uf.add_keyarg(
132 name = "sep",
133 py_type = "str",
134 arg_type = "free format",
135 desc_short = "column separator",
136 desc = "The column separator (the default is white space).",
137 can_be_none = True
138 )
139 uf.add_keyarg(
140 name = "spin_id",
141 py_type = "str",
142 arg_type = "spin ID",
143 desc_short = "spin ID string",
144 desc = "The spin ID string to restrict the loading of data to certain spin subsets.",
145 can_be_none = True
146 )
147 uf.add_keyarg(
148 name = "boolean",
149 default = "AND",
150 py_type = "str",
151 desc_short = "boolean operator",
152 desc = "The boolean operator specifying how spins should be selected.",
153 wiz_element_type = "combo",
154 wiz_combo_choices = [
155 "OR",
156 "NOR",
157 "AND",
158 "NAND",
159 "XOR",
160 "XNOR"
161 ],
162 wiz_read_only = True
163 )
164 uf.add_keyarg(
165 name = "change_all",
166 default = False,
167 py_type = "bool",
168 desc_short = "change all",
169 desc = "A flag specifying if all other spins should be changed."
170 )
171
172 uf.desc.append(Desc_container())
173 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.")
174 uf.desc[-1].add_paragraph("Empty lines and lines beginning with a hash are ignored.")
175 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.")
176 uf.desc.append(selection.boolean_doc)
177
178 uf.desc.append(Desc_container("Prompt examples"))
179 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:")
180 uf.desc[-1].add_prompt("relax> deselect.read('unresolved', res_num_col=1)")
181 uf.desc[-1].add_prompt("relax> deselect.read(file='unresolved', res_num_col=1)")
182 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:")
183 uf.desc[-1].add_prompt("relax> deselect.read('r1.600', spin_num_col=2, change_all=True)")
184 uf.desc[-1].add_prompt("relax> deselect.read(file='r1.600', spin_num_col=2, change_all=True)")
185 uf.backend = selection.desel_read
186 uf.menu_text = "&read"
187 uf.gui_icon = "oxygen.actions.document-open"
188 uf.wizard_height_desc = 200
189 uf.wizard_size = (1000, 700)
190 uf.wizard_image = WIZARD_IMAGE_PATH + 'deselect.png'
191
192
193
194 uf = uf_info.add_uf("deselect.reverse")
195 uf.title = "Reversal of the spin selection for the given spins."
196 uf.title_short = "Spin selection reversal."
197 uf.display = True
198 uf.add_keyarg(
199 name = "spin_id",
200 py_type = "str",
201 desc_short = "spin ID string",
202 desc = "The spin ID string.",
203 can_be_none = True
204 )
205
206 uf.desc.append(Desc_container())
207 uf.desc[-1].add_paragraph("By supplying the spin ID string, a subset of spins can have their selection status reversed.")
208
209 uf.desc.append(Desc_container())
210 uf.desc[-1].add_paragraph("To deselect all currently selected spins and select those which are deselected type:")
211 uf.desc[-1].add_prompt("relax> deselect.reverse()")
212 uf.backend = selection.reverse
213 uf.menu_text = "re&verse"
214 uf.gui_icon = "oxygen.actions.system-switch-user"
215 uf.wizard_size = (700, 550)
216 uf.wizard_apply_button = False
217 uf.wizard_image = WIZARD_IMAGE_PATH + 'deselect.png'
218
219
220
221 uf = uf_info.add_uf("deselect.spin")
222 uf.title = "Deselect specific spins."
223 uf.title_short = "Spin deselection."
224 uf.display = True
225 uf.add_keyarg(
226 name = "spin_id",
227 py_type = "str",
228 desc_short = "spin ID string",
229 desc = "The spin ID string.",
230 can_be_none = True
231 )
232 uf.add_keyarg(
233 name = "boolean",
234 default = "AND",
235 py_type = "str",
236 desc_short = "boolean operator",
237 desc = "The boolean operator specifying how spins should be deselected.",
238 wiz_element_type = "combo",
239 wiz_combo_choices = [
240 "OR",
241 "NOR",
242 "AND",
243 "NAND",
244 "XOR",
245 "XNOR"
246 ],
247 wiz_read_only = True
248 )
249 uf.add_keyarg(
250 name = "change_all",
251 default = False,
252 py_type = "bool",
253 desc_short = "change all",
254 desc = "A flag specifying if all other spins should be changed."
255 )
256
257 uf.desc.append(Desc_container())
258 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.")
259 uf.desc.append(selection.boolean_doc)
260
261 uf.desc.append(Desc_container("Prompt examples"))
262 uf.desc[-1].add_paragraph("To deselect all glycines and alanines, type:")
263 uf.desc[-1].add_prompt("relax> deselect.spin(spin_id=':GLY|:ALA')")
264 uf.desc[-1].add_paragraph("To deselect residue 12 MET type:")
265 uf.desc[-1].add_prompt("relax> deselect.spin(':12')")
266 uf.desc[-1].add_prompt("relax> deselect.spin(spin_id=':12')")
267 uf.desc[-1].add_prompt("relax> deselect.spin(spin_id=':12&:MET')")
268 uf.backend = selection.desel_spin
269 uf.menu_text = "&spin"
270 uf.gui_icon = "relax.spin_grey"
271 uf.wizard_height_desc = 500
272 uf.wizard_size = (1000, 750)
273 uf.wizard_image = WIZARD_IMAGE_PATH + 'deselect.png'
274