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 generic_fns import pipes, sequence
35 from graphics import WIZARD_IMAGE_PATH
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
90 uf.desc.append(Desc_container())
91 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).")
92
93 uf.desc.append(Desc_container("Prompt examples"))
94 uf.desc[-1].add_paragraph("To copy the sequence from the data pipe 'm1' to the current data pipe, type:")
95 uf.desc[-1].add_prompt("relax> sequence.copy('m1')")
96 uf.desc[-1].add_prompt("relax> sequence.copy(pipe_from='m1')")
97 uf.desc[-1].add_paragraph("To copy the sequence from the current data pipe to the data pipe 'm9', type:")
98 uf.desc[-1].add_prompt("relax> sequence.copy(pipe_to='m9')")
99 uf.desc[-1].add_paragraph("To copy the sequence from the data pipe 'm1' to 'm2', type:")
100 uf.desc[-1].add_prompt("relax> sequence.copy('m1', 'm2')")
101 uf.desc[-1].add_prompt("relax> sequence.copy(pipe_from='m1', pipe_to='m2')")
102 uf.backend = sequence.copy
103 uf.menu_text = "©"
104 uf.gui_icon = "oxygen.actions.list-add"
105 uf.wizard_size = (800, 500)
106 uf.wizard_image = WIZARD_IMAGE_PATH + 'sequence.png'
107
108
109
110 uf = uf_info.add_uf('sequence.display')
111 uf.title = "Display sequences of molecules, residues, and/or spins."
112 uf.title_short = "Sequence data display."
113 uf.display = True
114 uf.add_keyarg(
115 name = "sep",
116 py_type = "str",
117 desc_short = "column separator",
118 desc = "The column separator (the default of None corresponds to white space).",
119 can_be_none = True
120 )
121 uf.add_keyarg(
122 name = "mol_name_flag",
123 default = True,
124 py_type = "bool",
125 desc_short = "molecule name flag",
126 desc = "A flag which if True will cause the molecule name column to be shown."
127 )
128 uf.add_keyarg(
129 name = "res_num_flag",
130 default = True,
131 py_type = "bool",
132 desc_short = "residue number flag",
133 desc = "A flag which if True will cause the residue number column to be shown."
134 )
135 uf.add_keyarg(
136 name = "res_name_flag",
137 default = True,
138 py_type = "bool",
139 desc_short = "residue name flag",
140 desc = "A flag which if True will cause the residue name column to be shown."
141 )
142 uf.add_keyarg(
143 name = "spin_num_flag",
144 default = True,
145 py_type = "bool",
146 desc_short = "spin number flag",
147 desc = "A flag which if True will cause the spin number column to be shown."
148 )
149 uf.add_keyarg(
150 name = "spin_name_flag",
151 default = True,
152 py_type = "bool",
153 desc_short = "spin name flag",
154 desc = "A flag which if True will cause the spin name column to be shown."
155 )
156
157 uf.desc.append(Desc_container())
158 uf.desc[-1].add_paragraph("This will print out the sequence information of all loaded spins in the current data pipe.")
159 uf.backend = sequence.display
160 uf.menu_text = "&display"
161 uf.gui_icon = "oxygen.actions.document-preview"
162 uf.wizard_size = (700, 500)
163 uf.wizard_image = WIZARD_IMAGE_PATH + 'sequence.png'
164 uf.wizard_apply_button = False
165
166
167
168 uf = uf_info.add_uf('sequence.read')
169 uf.title = "Read the molecule, residue, and spin sequence from a file."
170 uf.title_short = "Sequence data reading."
171 uf.add_keyarg(
172 name = "file",
173 py_type = "str",
174 arg_type = "file sel",
175 desc_short = "file name",
176 desc = "The name of the file containing the sequence data.",
177 wiz_filesel_style = FD_OPEN
178 )
179 uf.add_keyarg(
180 name = "dir",
181 py_type = "str",
182 arg_type = "dir",
183 desc_short = "directory name",
184 desc = "The directory where the file is located.",
185 can_be_none = True
186 )
187 uf.add_keyarg(
188 name = "spin_id_col",
189 py_type = "int",
190 arg_type = "free format",
191 desc_short = "spin ID column",
192 desc = "The spin ID string column (an alternative to the mol, res, and spin name and number columns).",
193 can_be_none = True
194 )
195 uf.add_keyarg(
196 name = "mol_name_col",
197 py_type = "int",
198 arg_type = "free format",
199 desc_short = "molecule name column",
200 desc = "The molecule name column (alternative to the spin_id_col).",
201 can_be_none = True
202 )
203 uf.add_keyarg(
204 name = "res_num_col",
205 py_type = "int",
206 arg_type = "free format",
207 desc_short = "residue number column",
208 desc = "The residue number column (alternative to the spin_id_col).",
209 can_be_none = True
210 )
211 uf.add_keyarg(
212 name = "res_name_col",
213 py_type = "int",
214 arg_type = "free format",
215 desc_short = "residue name column",
216 desc = "The residue name column (alternative to the spin_id_col).",
217 can_be_none = True
218 )
219 uf.add_keyarg(
220 name = "spin_num_col",
221 py_type = "int",
222 arg_type = "free format",
223 desc_short = "spin number column",
224 desc = "The spin number column (alternative to the spin_id_col).",
225 can_be_none = True
226 )
227 uf.add_keyarg(
228 name = "spin_name_col",
229 py_type = "int",
230 arg_type = "free format",
231 desc_short = "spin name column",
232 desc = "The spin name column (alternative to the spin_id_col).",
233 can_be_none = True
234 )
235 uf.add_keyarg(
236 name = "sep",
237 py_type = "str",
238 arg_type = "free format",
239 desc_short = "column separator",
240 desc = "The column separator (the default is white space).",
241 can_be_none = True
242 )
243 uf.add_keyarg(
244 name = "spin_id",
245 py_type = "str",
246 desc_short = "spin ID string",
247 desc = "The spin ID string to restrict the loading of data to certain spin subsets.",
248 can_be_none = True
249 )
250
251 uf.desc.append(Desc_container())
252 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.")
253
254 uf.desc.append(Desc_container("Prompt examples"))
255 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:")
256 uf.desc[-1].add_prompt("relax> sequence.read('seq')")
257 uf.desc[-1].add_prompt("relax> sequence.read('seq', res_num_col=1, res_name_col=2)")
258 uf.desc[-1].add_prompt("relax> sequence.read(file='seq', res_num_col=1, res_name_col=2, sep=None)")
259 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:")
260 uf.desc[-1].add_prompt("relax> sequence.read('noe.out')")
261 uf.desc[-1].add_prompt("relax> sequence.read('noe.out', res_num_col=1, res_name_col=2)")
262 uf.desc[-1].add_prompt("relax> sequence.read(file='noe.out', res_num_col=1, res_name_col=2)")
263 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:")
264 uf.desc[-1].add_prompt("relax> sequence.read('noe.600.out', res_num_col=2, res_name_col=6, sep=',')")
265 uf.desc[-1].add_prompt("relax> sequence.read(file='noe.600.out', res_num_col=2, res_name_col=6, sep=',')")
266 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:")
267 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)")
268 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)")
269 uf.backend = sequence.read
270 uf.menu_text = "&read"
271 uf.gui_icon = "oxygen.actions.document-open"
272 uf.wizard_size = (900, 700)
273 uf.wizard_image = WIZARD_IMAGE_PATH + 'sequence.png'
274 uf.wizard_apply_button = False
275
276
277
278 uf = uf_info.add_uf('sequence.write')
279 uf.title = "Write the molecule, residue, and spin sequence to a file."
280 uf.title_short = "Sequence data writing."
281 uf.add_keyarg(
282 name = "file",
283 py_type = "str",
284 arg_type = "file sel",
285 desc_short = "file name",
286 desc = "The name of the file.",
287 wiz_filesel_style = FD_SAVE
288 )
289 uf.add_keyarg(
290 name = "dir",
291 py_type = "str",
292 arg_type = "dir",
293 desc_short = "directory name",
294 desc = "The directory name.",
295 can_be_none = True
296 )
297 uf.add_keyarg(
298 name = "sep",
299 py_type = "str",
300 desc_short = "column separator",
301 desc = "The column separator (the default of None corresponds to white space).",
302 can_be_none = True
303 )
304 uf.add_keyarg(
305 name = "mol_name_flag",
306 default = True,
307 py_type = "bool",
308 desc_short = "molecule name flag",
309 desc = "A flag which if True will cause the molecule name column to be shown."
310 )
311 uf.add_keyarg(
312 name = "res_num_flag",
313 default = True,
314 py_type = "bool",
315 desc_short = "residue number flag",
316 desc = "A flag which if True will cause the residue number column to be shown."
317 )
318 uf.add_keyarg(
319 name = "res_name_flag",
320 default = True,
321 py_type = "bool",
322 desc_short = "residue name flag",
323 desc = "A flag which if True will cause the residue name column to be shown."
324 )
325 uf.add_keyarg(
326 name = "spin_num_flag",
327 default = True,
328 py_type = "bool",
329 desc_short = "spin number flag",
330 desc = "A flag which if True will cause the spin number column to be shown."
331 )
332 uf.add_keyarg(
333 name = "spin_name_flag",
334 default = True,
335 py_type = "bool",
336 desc_short = "spin name flag",
337 desc = "A flag which if True will cause the spin name column to be shown."
338 )
339 uf.add_keyarg(
340 name = "force",
341 default = False,
342 py_type = "bool",
343 desc_short = "force flag",
344 desc = "A flag which if True will cause the file to be overwritten."
345 )
346
347 uf.desc.append(Desc_container())
348 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.")
349 uf.backend = sequence.write
350 uf.menu_text = "&write"
351 uf.gui_icon = "oxygen.actions.document-save"
352 uf.wizard_size = (900, 700)
353 uf.wizard_image = WIZARD_IMAGE_PATH + 'sequence.png'
354 uf.wizard_apply_button = False
355