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