1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 import sys
24
25 from colour import Colour
26 from doc_string import regexp_doc
27 import help
28 from generic_fns.minimise import Minimise
29 from specific_fns.consistency_tests import Consistency_tests
30 from specific_fns.model_free import Molmol
31 from specific_fns.jw_mapping import Jw_mapping
32 from specific_fns.noe import Noe
33
34
37
38 self.__relax_help__ = \
39 """Class for interfacing with Molmol."""
40
41
42 self.__relax_help__ = self.__relax_help__ + "\n" + help.relax_class_help
43
44
45 self.__relax__ = relax
46
47
48 - def clear_history(self):
49 """Function for clearing the Molmol command history."""
50
51
52 if self.__relax__.interpreter.intro:
53 text = sys.ps3 + "molmol.clear_history()"
54 print text
55
56
57 self.__relax__.generic.molmol.clear_history()
58
59
81
82
83 - def macro_exec(self, run=None, data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None):
84 """Function for executing Molmol macros.
85
86 Keyword Arguments
87 ~~~~~~~~~~~~~~~~~
88
89 run: The name of the run.
90
91 data_type: The data type to map to the structure.
92
93 style: The style of the macro.
94
95 colour_start: The starting colour, either an array or string, of the linear colour
96 gradient.
97
98 colour_end: The ending colour, either an array or string, of the linear colour gradient.
99
100 colour_list: The list of colours to match the start and end strings.
101
102
103 Description
104 ~~~~~~~~~~~
105
106 This function allows residues specific values to be mapped to a structure through Molmol
107 macros. Currently only the 'classic' style, which is described below, is availible.
108
109
110 Colour
111 ~~~~~~
112
113 The values are coloured based on a linear colour gradient which is specified through the
114 'colour_start' and 'colour_end' arguments. These arguments can either be a string to
115 identify one of the RGB (red, green, blue) colour arrays listed in the tables below, or you
116 can give the RGB vector itself. For example, colour_start='white' and
117 colour_start=[1.0, 1.0, 1.0] both select the same colour. Leaving both arguments at None
118 will select the default colour gradient which for each type of analysis is described below.
119
120 When supplying the colours as strings, two lists of colours can be selected from which to
121 match the strings. These are the default Molmol colour list and the X11 colour list, both
122 of which are described in the tables below. The default behaviour is to first search the
123 Molmol list and then the X11 colour list, raising an error if neither contain the string.
124 To explicitly select these lists, set the 'colour_list' argument to either 'molmol' or
125 'x11'.
126
127
128 Examples
129 ~~~~~~~~
130
131 To map the order parameter values, S2, of the run 'final' onto the structure using the
132 classic style, type:
133
134 relax> molmol.macro_exec('final', 'S2')
135 relax> molmol.macro_exec('final', data_type='S2')
136 relax> molmol.macro_exec('final', data_type='S2', style="classic")
137 """
138
139
140 if self.__relax__.interpreter.intro:
141 text = sys.ps3 + "molmol.macro_exec("
142 text = text + "run=" + `run`
143 text = text + ", data_type=" + `data_type`
144 text = text + ", style=" + `style`
145 text = text + ", colour_start=" + `colour_start`
146 text = text + ", colour_end=" + `colour_end`
147 text = text + ", colour_list=" + `colour_list` + ")"
148 print text
149
150
151 if type(run) != str:
152 raise RelaxStrError, ('run', run)
153
154
155 if type(data_type) != str:
156 raise RelaxStrError, ('data type', data_type)
157
158
159 if type(style) != str:
160 raise RelaxStrError, ('style', style)
161
162
163 if colour_start != None and type(colour_start) != str and type(colour_start) != list:
164 raise RelaxNoneStrListError, ('starting colour of the linear gradient', colour_start)
165 if type(colour_start) == list:
166 for i in xrange(len(colour_start)):
167 if type(colour_start[i]) != float and type(colour_start[i]) != int:
168 raise RelaxListNumError, ('starting colour of the linear gradient', colour_start)
169
170
171 if colour_end != None and type(colour_end) != str and type(colour_end) != list:
172 raise RelaxNoneStrListError, ('ending colour of the linear gradient', colour_end)
173 if type(colour_end) == list:
174 for i in xrange(len(colour_end)):
175 if type(colour_end[i]) != float and type(colour_end[i]) != int:
176 raise RelaxListNumError, ('ending colour of the linear gradient', colour_end)
177
178
179 self.__relax__.generic.molmol.macro_exec(run=run, data_type=data_type, style=style, colour_start=colour_start, colour_end=colour_end, colour_list=colour_list)
180
181
182
183 - def view(self, run=None):
184 """Function for viewing the collection of molecules extracted from the PDB file.
185
186 Keyword Arguments
187 ~~~~~~~~~~~~~~~~~
188
189 run: The name of the run which the PDB belongs to.
190
191
192 Example
193 ~~~~~~~
194
195 relax> molmol.view('m1')
196 relax> molmol.view(run='pdb')
197 """
198
199
200 if self.__relax__.interpreter.intro:
201 text = sys.ps3 + "molmol.view("
202 text = text + "run=" + `run` + ")"
203 print text
204
205
206 if type(run) != str:
207 raise RelaxStrError, ('run', run)
208
209
210 self.__relax__.generic.molmol.view(run=run)
211
212
213 - def write(self, run=None, data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None, file=None, dir='molmol', force=0):
214 """Function for creating Molmol macros.
215
216 Keyword Arguments
217 ~~~~~~~~~~~~~~~~~
218
219 run: The name of the run.
220
221 data_type: The data type to map to the structure.
222
223 style: The style of the macro.
224
225 colour_start: The starting colour, either an array or string, of the linear colour
226 gradient.
227
228 colour_end: The ending colour, either an array or string, of the linear colour gradient.
229
230 colour_list: The list of colours to match the start and end strings.
231
232 file: The name of the file.
233
234 dir: The directory name.
235
236 force: A flag which, if set to 1, will cause the file to be overwritten.
237
238
239 Description
240 ~~~~~~~~~~~
241
242 This function allows residues specific values to be mapped to a structure through the
243 creation of a Molmol '*.mac' macro which can be executed in Molmol by clicking on 'File,
244 Macro, Execute User...'. Currently only the 'classic' style, which is described below, is
245 availible.
246
247
248 Colour
249 ~~~~~~
250
251 The values are coloured based on a linear colour gradient which is specified through the
252 'colour_start' and 'colour_end' arguments. These arguments can either be a string to
253 identify one of the RGB (red, green, blue) colour arrays listed in the tables below, or you
254 can give the RGB vector itself. For example, colour_start='white' and
255 colour_start=[1.0, 1.0, 1.0] both select the same colour. Leaving both arguments at None
256 will select the default colour gradient which for each type of analysis is described below.
257
258 When supplying the colours as strings, two lists of colours can be selected from which to
259 match the strings. These are the default Molmol colour list and the X11 colour list, both
260 of which are described in the tables below. The default behaviour is to first search the
261 Molmol list and then the X11 colour list, raising an error if neither contain the string.
262 To explicitly select these lists, set the 'colour_list' argument to either 'molmol' or
263 'x11'.
264
265
266 Examples
267 ~~~~~~~~
268
269 To create a Molmol macro mapping the order parameter values, S2, of the run 'final' onto the
270 structure using the classic style, type:
271
272 relax> molmol.write('final', 'S2')
273 relax> molmol.write('final', data_type='S2')
274 relax> molmol.write('final', data_type='S2', style="classic", file='s2.mac', dir='molmol')
275 """
276
277
278 if self.__relax__.interpreter.intro:
279 text = sys.ps3 + "molmol.write("
280 text = text + "run=" + `run`
281 text = text + ", data_type=" + `data_type`
282 text = text + ", style=" + `style`
283 text = text + ", colour_start=" + `colour_start`
284 text = text + ", colour_end=" + `colour_end`
285 text = text + ", colour_list=" + `colour_list`
286 text = text + ", file=" + `file`
287 text = text + ", dir=" + `dir`
288 text = text + ", force=" + `force` + ")"
289 print text
290
291
292 if type(run) != str:
293 raise RelaxStrError, ('run', run)
294
295
296 if type(data_type) != str:
297 raise RelaxStrError, ('data type', data_type)
298
299
300 if type(style) != str:
301 raise RelaxStrError, ('style', style)
302
303
304 if colour_start != None and type(colour_start) != str and type(colour_start) != list:
305 raise RelaxNoneStrListError, ('starting colour of the linear gradient', colour_start)
306 if type(colour_start) == list:
307 for i in xrange(len(colour_start)):
308 if type(colour_start[i]) != float and type(colour_start[i]) != int:
309 raise RelaxListNumError, ('starting colour of the linear gradient', colour_start)
310
311
312 if colour_end != None and type(colour_end) != str and type(colour_end) != list:
313 raise RelaxNoneStrListError, ('ending colour of the linear gradient', colour_end)
314 if type(colour_end) == list:
315 for i in xrange(len(colour_end)):
316 if type(colour_end[i]) != float and type(colour_end[i]) != int:
317 raise RelaxListNumError, ('ending colour of the linear gradient', colour_end)
318
319
320 if file != None and type(file) != str:
321 raise RelaxNoneStrError, ('file name', file)
322
323
324 if dir != None and type(dir) != str:
325 raise RelaxNoneStrError, ('directory name', dir)
326
327
328 if type(force) != int or (force != 0 and force != 1):
329 raise RelaxBinError, ('force flag', force)
330
331
332 self.__relax__.generic.molmol.write(run=run, data_type=data_type, style=style, colour_start=colour_start, colour_end=colour_end, colour_list=colour_list, file=file, dir=dir, force=force)
333
334
335
336
337
338
339
340 write.__doc__ = write.__doc__ + "\n\n" + Molmol.classic.__doc__ + "\n\n"
341
342
343 write.__doc__ = write.__doc__ + "\n\n" + Colour.molmol_colours.__doc__ + "\n\n"
344
345
346 write.__doc__ = write.__doc__ + "\n\n" + Colour.x11_colours.__doc__ + "\n\n"
347