1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """The sequence user function definitions."""
24
25
26 import dep_check
27 if dep_check.wx_module:
28 from wx import FD_OPEN, FD_SAVE
29 else:
30 FD_OPEN = -1
31 FD_SAVE = -1
32
33
34 from graphics import WIZARD_IMAGE_PATH
35 from pipe_control import pipes, sequence
36 from user_functions.data import Uf_info; uf_info = Uf_info()
37 from user_functions.objects import Desc_container
38
39
40
41 uf_class = uf_info.add_class('sequence')
42 uf_class.title = "Class for manipulating sequence data."
43 uf_class.menu_text = "&sequence"
44 uf_class.gui_icon = "relax.sequence"
45
46
47
48 uf = uf_info.add_uf('sequence.attach_protons')
49 uf.title = "Attach protons to all heteronuclei."
50 uf.title_short = "Heteronuclei proton attachment."
51
52 uf.desc.append(Desc_container())
53 uf.desc[-1].add_paragraph("This can be used to attach protons to all the heteronuclei in the current data pipe. For each proton, a spin container will be created.")
54
55 uf.desc.append(Desc_container("Prompt examples"))
56 uf.desc[-1].add_paragraph("To attach protons, simply type:")
57 uf.desc[-1].add_prompt("relax> sequence.attach_protons()")
58 uf.backend = sequence.attach_protons
59 uf.menu_text = "&attach_protons"
60 uf.gui_icon = "oxygen.actions.list-add-relax-blue"
61 uf.wizard_size = (700, 500)
62 uf.wizard_image = WIZARD_IMAGE_PATH + 'sequence.png'
63
64
65
66 uf = uf_info.add_uf('sequence.copy')
67 uf.title = "Copy the molecule, residue, and spin sequence data from one data pipe to another."
68 uf.title_short = "Sequence data copying."
69 uf.add_keyarg(
70 name = "pipe_from",
71 py_type = "str",
72 desc_short = "source data pipe",
73 desc = "The name of the data pipe to copy the sequence data from.",
74 wiz_element_type = 'combo',
75 wiz_combo_iter = pipes.pipe_names,
76 wiz_read_only = True,
77 can_be_none = True
78 )
79 uf.add_keyarg(
80 name = "pipe_to",
81 py_type = "str",
82 desc_short = "destination data pipe",
83 desc = "The name of the data pipe to copy the sequence data to.",
84 wiz_element_type = 'combo',
85 wiz_combo_iter = pipes.pipe_names,
86 wiz_read_only = True,
87 can_be_none = True
88 )
89 uf.add_keyarg(
90 name = "empty",
91 default = True,
92 py_type = "bool",
93 desc_short = "empty sequence flag",
94 desc = "A flag which if True will create a molecule, residue, and spin sequence in the target pipe lacking all of the spin data of the source pipe. If False, then the spin data will also be copied."
95 )
96
97 uf.desc.append(Desc_container())
98 uf.desc[-1].add_paragraph("This will copy the sequence data between data pipes. The destination data pipe must not contain any sequence data. If the source and destination pipes are not specified, then both will default to the current data pipe (hence providing one is essential).")
99
100 uf.desc.append(Desc_container("Prompt examples"))
101 uf.desc[-1].add_paragraph("To copy the sequence from the data pipe 'm1' to the current data pipe, type:")
102 uf.desc[-1].add_prompt("relax> sequence.copy('m1')")
103 uf.desc[-1].add_prompt("relax> sequence.copy(pipe_from='m1')")
104 uf.desc[-1].add_paragraph("To copy the sequence from the current data pipe to the data pipe 'm9', type:")
105 uf.desc[-1].add_prompt("relax> sequence.copy(pipe_to='m9')")
106 uf.desc[-1].add_paragraph("To copy the sequence from the data pipe 'm1' to 'm2', type:")
107 uf.desc[-1].add_prompt("relax> sequence.copy('m1', 'm2')")
108 uf.desc[-1].add_prompt("relax> sequence.copy(pipe_from='m1', pipe_to='m2')")
109 uf.backend = sequence.copy
110 uf.menu_text = "©"
111 uf.gui_icon = "oxygen.actions.list-add"
112 uf.wizard_size = (800, 500)
113 uf.wizard_image = WIZARD_IMAGE_PATH + 'sequence.png'
114
115
116
117 uf = uf_info.add_uf('sequence.display')
118 uf.title = "Display sequences of molecules, residues, and/or spins."
119 uf.title_short = "Sequence data display."
120 uf.display = True
121 uf.add_keyarg(
122 name = "sep",
123 py_type = "str",
124 desc_short = "column separator",
125 desc = "The column separator (the default of None corresponds to white space).",
126 can_be_none = True
127 )
128 uf.add_keyarg(
129 name = "mol_name_flag",
130 default = True,
131 py_type = "bool",
132 desc_short = "molecule name flag",
133 desc = "A flag which if True will cause the molecule name column to be shown."
134 )
135 uf.add_keyarg(
136 name = "res_num_flag",
137 default = True,
138 py_type = "bool",
139 desc_short = "residue number flag",
140 desc = "A flag which if True will cause the residue number column to be shown."
141 )
142 uf.add_keyarg(
143 name = "res_name_flag",
144 default = True,
145 py_type = "bool",
146 desc_short = "residue name flag",
147 desc = "A flag which if True will cause the residue name column to be shown."
148 )
149 uf.add_keyarg(
150 name = "spin_num_flag",
151 default = True,
152 py_type = "bool",
153 desc_short = "spin number flag",
154 desc = "A flag which if True will cause the spin number column to be shown."
155 )
156 uf.add_keyarg(
157 name = "spin_name_flag",
158 default = True,
159 py_type = "bool",
160 desc_short = "spin name flag",
161 desc = "A flag which if True will cause the spin name column to be shown."
162 )
163
164 uf.desc.append(Desc_container())
165 uf.desc[-1].add_paragraph("This will print out the sequence information of all loaded spins in the current data pipe.")
166 uf.backend = sequence.display
167 uf.menu_text = "&display"
168 uf.gui_icon = "oxygen.actions.document-preview"
169 uf.wizard_size = (700, 500)
170 uf.wizard_image = WIZARD_IMAGE_PATH + 'sequence.png'
171 uf.wizard_apply_button = False
172
173
174
175 uf = uf_info.add_uf('sequence.read')
176 uf.title = "Read the molecule, residue, and spin sequence from a file."
177 uf.title_short = "Sequence data reading."
178 uf.add_keyarg(
179 name = "file",
180 py_type = "str",
181 arg_type = "file sel",
182 desc_short = "file name",
183 desc = "The name of the file containing the sequence data.",
184 wiz_filesel_style = FD_OPEN
185 )
186 uf.add_keyarg(
187 name = "dir",
188 py_type = "str",
189 arg_type = "dir",
190 desc_short = "directory name",
191 desc = "The directory where the file is located.",
192 can_be_none = True
193 )
194 uf.add_keyarg(
195 name = "spin_id_col",
196 py_type = "int",
197 arg_type = "free format",
198 desc_short = "spin ID column",
199 desc = "The spin ID string column (an alternative to the mol, res, and spin name and number columns).",
200 can_be_none = True
201 )
202 uf.add_keyarg(
203 name = "mol_name_col",
204 py_type = "int",
205 arg_type = "free format",
206 desc_short = "molecule name column",
207 desc = "The molecule name column (alternative to the spin_id_col).",
208 can_be_none = True
209 )
210 uf.add_keyarg(
211 name = "res_num_col",
212 py_type = "int",
213 arg_type = "free format",
214 desc_short = "residue number column",
215 desc = "The residue number column (alternative to the spin_id_col).",
216 can_be_none = True
217 )
218 uf.add_keyarg(
219 name = "res_name_col",
220 py_type = "int",
221 arg_type = "free format",
222 desc_short = "residue name column",
223 desc = "The residue name column (alternative to the spin_id_col).",
224 can_be_none = True
225 )
226 uf.add_keyarg(
227 name = "spin_num_col",
228 py_type = "int",
229 arg_type = "free format",
230 desc_short = "spin number column",
231 desc = "The spin number column (alternative to the spin_id_col).",
232 can_be_none = True
233 )
234 uf.add_keyarg(
235 name = "spin_name_col",
236 py_type = "int",
237 arg_type = "free format",
238 desc_short = "spin name column",
239 desc = "The spin name column (alternative to the spin_id_col).",
240 can_be_none = True
241 )
242 uf.add_keyarg(
243 name = "sep",
244 py_type = "str",
245 arg_type = "free format",
246 desc_short = "column separator",
247 desc = "The column separator (the default is white space).",
248 can_be_none = True
249 )
250 uf.add_keyarg(
251 name = "spin_id",
252 py_type = "str",
253 desc_short = "spin ID string",
254 desc = "The spin ID string to restrict the loading of data to certain spin subsets.",
255 can_be_none = True
256 )
257
258 uf.desc.append(Desc_container())
259 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.")
260
261 uf.desc.append(Desc_container("Prompt examples"))
262 uf.desc[-1].add_paragraph("The following commands will read protein backbone 15N sequence data out of a file called 'seq' where the residue numbers and names are in the first and second columns respectively:")
263 uf.desc[-1].add_prompt("relax> sequence.read('seq')")
264 uf.desc[-1].add_prompt("relax> sequence.read('seq', res_num_col=1, res_name_col=2)")
265 uf.desc[-1].add_prompt("relax> sequence.read(file='seq', res_num_col=1, res_name_col=2, sep=None)")
266 uf.desc[-1].add_paragraph("The following commands will read the residue sequence out of the file 'noe.out' which also contains the NOE values:")
267 uf.desc[-1].add_prompt("relax> sequence.read('noe.out')")
268 uf.desc[-1].add_prompt("relax> sequence.read('noe.out', res_num_col=1, res_name_col=2)")
269 uf.desc[-1].add_prompt("relax> sequence.read(file='noe.out', res_num_col=1, res_name_col=2)")
270 uf.desc[-1].add_paragraph("The following commands will read the sequence out of the file 'noe.600.out' where the residue numbers are in the second column, the names are in the sixth column and the columns are separated by commas:")
271 uf.desc[-1].add_prompt("relax> sequence.read('noe.600.out', res_num_col=2, res_name_col=6, sep=',')")
272 uf.desc[-1].add_prompt("relax> sequence.read(file='noe.600.out', res_num_col=2, res_name_col=6, sep=',')")
273 uf.desc[-1].add_paragraph("The following commands will read the RNA residues and atoms (including C2, C5, C6, C8, N1, and N3) from the file '500.NOE', where the residue number, residue name, spin number, and spin name are in the first to fourth columns respectively:")
274 uf.desc[-1].add_prompt("relax> sequence.read('500.NOE', res_num_col=1, res_name_col=2, spin_num_col=3, spin_name_col=4)")
275 uf.desc[-1].add_prompt("relax> sequence.read(file='500.NOE', res_num_col=1, res_name_col=2, spin_num_col=3, spin_name_col=4)")
276 uf.backend = sequence.read
277 uf.menu_text = "&read"
278 uf.gui_icon = "oxygen.actions.document-open"
279 uf.wizard_size = (900, 600)
280 uf.wizard_image = WIZARD_IMAGE_PATH + 'sequence.png'
281 uf.wizard_apply_button = False
282
283
284
285 uf = uf_info.add_uf('sequence.write')
286 uf.title = "Write the molecule, residue, and spin sequence to a file."
287 uf.title_short = "Sequence data writing."
288 uf.add_keyarg(
289 name = "file",
290 py_type = "str",
291 arg_type = "file sel",
292 desc_short = "file name",
293 desc = "The name of the file.",
294 wiz_filesel_style = FD_SAVE
295 )
296 uf.add_keyarg(
297 name = "dir",
298 py_type = "str",
299 arg_type = "dir",
300 desc_short = "directory name",
301 desc = "The directory name.",
302 can_be_none = True
303 )
304 uf.add_keyarg(
305 name = "sep",
306 py_type = "str",
307 desc_short = "column separator",
308 desc = "The column separator (the default of None corresponds to white space).",
309 can_be_none = True
310 )
311 uf.add_keyarg(
312 name = "mol_name_flag",
313 default = True,
314 py_type = "bool",
315 desc_short = "molecule name flag",
316 desc = "A flag which if True will cause the molecule name column to be shown."
317 )
318 uf.add_keyarg(
319 name = "res_num_flag",
320 default = True,
321 py_type = "bool",
322 desc_short = "residue number flag",
323 desc = "A flag which if True will cause the residue number column to be shown."
324 )
325 uf.add_keyarg(
326 name = "res_name_flag",
327 default = True,
328 py_type = "bool",
329 desc_short = "residue name flag",
330 desc = "A flag which if True will cause the residue name column to be shown."
331 )
332 uf.add_keyarg(
333 name = "spin_num_flag",
334 default = True,
335 py_type = "bool",
336 desc_short = "spin number flag",
337 desc = "A flag which if True will cause the spin number column to be shown."
338 )
339 uf.add_keyarg(
340 name = "spin_name_flag",
341 default = True,
342 py_type = "bool",
343 desc_short = "spin name flag",
344 desc = "A flag which if True will cause the spin name column to be shown."
345 )
346 uf.add_keyarg(
347 name = "force",
348 default = False,
349 py_type = "bool",
350 desc_short = "force flag",
351 desc = "A flag which if True will cause the file to be overwritten."
352 )
353
354 uf.desc.append(Desc_container())
355 uf.desc[-1].add_paragraph("Write the sequence data to file. If no directory name is given, the file will be placed in the current working directory.")
356 uf.backend = sequence.write
357 uf.menu_text = "&write"
358 uf.gui_icon = "oxygen.actions.document-save"
359 uf.wizard_size = (900, 700)
360 uf.wizard_image = WIZARD_IMAGE_PATH + 'sequence.png'
361 uf.wizard_apply_button = False
362