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