1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """The residue user function definitions."""
24
25
26 from graphics import WIZARD_IMAGE_PATH
27 from pipe_control import pipes
28 from pipe_control.mol_res_spin import copy_residue, create_residue, delete_residue, display_residue, get_molecule_names, get_residue_ids, id_string_doc, name_residue, number_residue
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('residue')
35 uf_class.title = "Class for manipulating the residue data."
36 uf_class.menu_text = "&residue"
37 uf_class.gui_icon = "relax.residue"
38
39
40
41 uf = uf_info.add_uf('residue.copy')
42 uf.title = "Copy all data associated with a residue."
43 uf.title_short = "Residue copying."
44 uf.display = True
45 uf.add_keyarg(
46 name = "pipe_from",
47 py_type = "str",
48 desc_short = "source pipe",
49 desc = "The data pipe containing the residue from which the data will be copied. This defaults to the current data pipe.",
50 wiz_element_type = 'combo',
51 wiz_combo_iter = pipes.pipe_names,
52 wiz_read_only = True,
53 can_be_none = True
54 )
55 uf.add_keyarg(
56 name = "res_from",
57 py_type = "str",
58 desc_short = "source residue ID",
59 desc = "The residue ID string of the residue to copy the data from.",
60 wiz_element_type = 'combo',
61 wiz_combo_iter = get_residue_ids,
62 wiz_read_only = True
63 )
64 uf.add_keyarg(
65 name = "pipe_to",
66 py_type = "str",
67 desc_short = "destination pipe",
68 desc = "The data pipe to copy the data to. This defaults to the current data pipe.",
69 wiz_element_type = 'combo',
70 wiz_combo_iter = pipes.pipe_names,
71 wiz_read_only = True,
72 can_be_none = True
73 )
74 uf.add_keyarg(
75 name = "res_to",
76 py_type = "str",
77 desc_short = "destination residue ID",
78 desc = "The residue ID string of the residue to copy the data to. If left blank, the new residue will have the same name as the old.",
79 can_be_none = True
80 )
81
82 uf.desc.append(Desc_container())
83 uf.desc[-1].add_paragraph("This will copy all the data associated with the identified residue to the new, non-existent residue. The new residue cannot currently exist.")
84
85 uf.desc.append(Desc_container("Prompt examples"))
86 uf.desc[-1].add_paragraph("To copy the residue data from residue 1 to the new residue 2, type:")
87 uf.desc[-1].add_prompt("relax> residue.copy(res_from=':1', res_to=':2')")
88 uf.desc[-1].add_paragraph("To copy residue 1 of the molecule 'Old mol' to residue 5 of the molecule 'New mol', type:")
89 uf.desc[-1].add_prompt("relax> residue.copy(res_from='#Old mol:1', res_to='#New mol:5')")
90 uf.desc[-1].add_paragraph("To copy the residue data of residue 1 from the data pipe 'm1' to 'm2', assuming the current data pipe is 'm1', type:")
91 uf.desc[-1].add_prompt("relax> residue.copy(res_from=':1', pipe_to='m2')")
92 uf.desc[-1].add_prompt("relax> residue.copy(pipe_from='m1', res_from=':1', pipe_to='m2', res_to=':1')")
93 uf.backend = copy_residue
94 uf.menu_text = "©"
95 uf.gui_icon = "oxygen.actions.list-add"
96 uf.wizard_size = (800, 600)
97 uf.wizard_image = WIZARD_IMAGE_PATH + 'residue.png'
98
99
100
101 uf = uf_info.add_uf('residue.create')
102 uf.title = "Create a new residue."
103 uf.title_short = "Residue creation."
104 uf.display = True
105 uf.add_keyarg(
106 name = "res_num",
107 py_type = "int",
108 min = -10000,
109 max = 10000,
110 desc_short = "residue number",
111 desc = "The residue number.",
112 can_be_none = True
113 )
114 uf.add_keyarg(
115 name = "res_name",
116 py_type = "str",
117 desc_short = "residue name",
118 desc = "The name of the residue.",
119 can_be_none = True
120 )
121 uf.add_keyarg(
122 name = "mol_name",
123 py_type = "str",
124 desc_short = "molecule name",
125 desc = "The name of the molecule to add the residue to.",
126 wiz_element_type = 'combo',
127 wiz_combo_iter = get_molecule_names,
128 wiz_read_only = True,
129 can_be_none = True
130 )
131
132 uf.desc.append(Desc_container())
133 uf.desc[-1].add_paragraph("Using this, a new sequence can be generated without using the sequence user functions. However if the sequence already exists, the new residue will be added to the end of the residue list (the residue numbers of this list need not be sequential). The same residue number cannot be used more than once. A corresponding single spin system will be created for this residue. The spin system number and name or additional spin systems can be added later if desired.")
134
135 uf.desc.append(Desc_container("Prompt examples"))
136 uf.desc[-1].add_paragraph("The following sequence of commands will generate the sequence 1 ALA, 2 GLY, 3 LYS:")
137 uf.desc[-1].add_prompt("relax> residue.create(1, 'ALA')")
138 uf.desc[-1].add_prompt("relax> residue.create(2, 'GLY')")
139 uf.desc[-1].add_prompt("relax> residue.create(3, 'LYS')")
140 uf.backend = create_residue
141 uf.menu_text = "c&reate"
142 uf.gui_icon = "oxygen.actions.list-add-relax-blue"
143 uf.wizard_size = (700, 500)
144 uf.wizard_image = WIZARD_IMAGE_PATH + 'residue.png'
145
146
147
148 uf = uf_info.add_uf('residue.delete')
149 uf.title = "Delete residues from the current data pipe."
150 uf.title_short = "Residue deletion."
151 uf.add_keyarg(
152 name = "res_id",
153 py_type = "str",
154 desc_short = "residue ID string",
155 desc = "The residue ID string.",
156 wiz_element_type = 'combo',
157 wiz_combo_iter = get_residue_ids,
158 wiz_read_only = False
159 )
160
161 uf.desc.append(Desc_container())
162 uf.desc[-1].add_paragraph("This can be used to delete a single or sets of residues. See the ID string documentation for more information. If spin system/atom ids are included a RelaxError will be raised.")
163 uf.desc.append(id_string_doc)
164 uf.backend = delete_residue
165 uf.menu_text = "&delete"
166 uf.gui_icon = "oxygen.actions.list-remove"
167 uf.wizard_height_desc = 550
168 uf.wizard_size = (900, 750)
169 uf.wizard_image = WIZARD_IMAGE_PATH + 'residue.png'
170
171
172
173 uf = uf_info.add_uf('residue.display')
174 uf.title = "Display information about the residue(s)."
175 uf.display = True
176 uf.add_keyarg(
177 name = "res_id",
178 py_type = "str",
179 desc_short = "residue ID string",
180 desc = "The residue ID string.",
181 wiz_element_type = 'combo',
182 wiz_combo_iter = get_residue_ids,
183 wiz_read_only = True,
184 can_be_none = True
185 )
186
187 uf.desc.append(Desc_container())
188 uf.desc[-1].add_paragraph("This will display the residue data loaded into the current data pipe.")
189 uf.desc.append(id_string_doc)
190 uf.backend = display_residue
191 uf.menu_text = "dis&play"
192 uf.gui_icon = "oxygen.actions.document-preview"
193 uf.wizard_height_desc = 550
194 uf.wizard_size = (1000, 750)
195 uf.wizard_apply_button = False
196 uf.wizard_image = WIZARD_IMAGE_PATH + 'residue.png'
197
198
199
200 uf = uf_info.add_uf('residue.name')
201 uf.title = "Name the residues."
202 uf.title_short = "Residue naming."
203 uf.add_keyarg(
204 name = "res_id",
205 py_type = "str",
206 desc_short = "residue ID string",
207 desc = "The residue ID string corresponding to one or more residues.",
208 wiz_element_type = 'combo',
209 wiz_combo_iter = get_residue_ids,
210 wiz_read_only = True
211 )
212 uf.add_keyarg(
213 name = "name",
214 py_type = "str",
215 desc_short = "new residue name",
216 desc = "The new name."
217 )
218 uf.add_keyarg(
219 name = "force",
220 default = False,
221 py_type = "bool",
222 arg_type = "force flag",
223 desc_short = "force flag",
224 desc = "A flag which if True will cause the residue to be renamed."
225 )
226
227 uf.desc.append(Desc_container())
228 uf.desc[-1].add_paragraph("This simply allows residues to be named (or renamed).")
229 uf.desc.append(id_string_doc)
230
231 uf.desc.append(Desc_container("Prompt examples"))
232 uf.desc[-1].add_paragraph("The following sequence of commands will rename the sequence {1 ALA, 2 GLY, 3 LYS} to {1 XXX, 2 XXX, 3 XXX}:")
233 uf.desc[-1].add_prompt("relax> residue.name(':1', 'XXX', force=True)")
234 uf.desc[-1].add_prompt("relax> residue.name(':2', 'XXX', force=True)")
235 uf.desc[-1].add_prompt("relax> residue.name(':3', 'XXX', force=True)")
236 uf.desc[-1].add_paragraph("Alternatively:")
237 uf.desc[-1].add_prompt("relax> residue.name(':1,2,3', 'XXX', force=True)")
238 uf.backend = name_residue
239 uf.menu_text = "&name"
240 uf.gui_icon = "oxygen.actions.edit-rename"
241 uf.wizard_height_desc = 500
242 uf.wizard_size = (1000, 750)
243 uf.wizard_image = WIZARD_IMAGE_PATH + 'residue.png'
244
245
246
247 uf = uf_info.add_uf('residue.number')
248 uf.title = "Number the residues."
249 uf.title_short = "Residue numbering."
250 uf.add_keyarg(
251 name = "res_id",
252 py_type = "str",
253 desc_short = "residue ID string",
254 desc = "The residue ID string corresponding to a single residue.",
255 wiz_element_type = 'combo',
256 wiz_combo_iter = get_residue_ids,
257 wiz_read_only = True
258 )
259 uf.add_keyarg(
260 name = "number",
261 py_type = "int",
262 min = -10000,
263 max = 10000,
264 desc_short = "new residue number",
265 desc = "The new residue number."
266 )
267 uf.add_keyarg(
268 name = "force",
269 default = False,
270 py_type = "bool",
271 arg_type = "force flag",
272 desc_short = "force flag",
273 desc = "A flag which if True will cause the residue to be renumbered."
274 )
275
276 uf.desc.append(Desc_container())
277 uf.desc[-1].add_paragraph("This simply allows residues to be numbered. The new number cannot correspond to an existing residue.")
278 uf.desc.append(id_string_doc)
279
280 uf.desc.append(Desc_container("Prompt examples"))
281 uf.desc[-1].add_paragraph("The following sequence of commands will renumber the sequence {1 ALA, 2 GLY, 3 LYS} to {101 ALA, 102 GLY, 103 LYS}:")
282 uf.desc[-1].add_prompt("relax> residue.number(':1', 101, force=True)")
283 uf.desc[-1].add_prompt("relax> residue.number(':2', 102, force=True)")
284 uf.desc[-1].add_prompt("relax> residue.number(':3', 103, force=True)")
285 uf.backend = number_residue
286 uf.menu_text = "&number"
287 uf.gui_icon = "oxygen.actions.edit-rename"
288 uf.wizard_height_desc = 500
289 uf.wizard_size = (1000, 750)
290 uf.wizard_image = WIZARD_IMAGE_PATH + 'residue.png'
291