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 grace user function definitions for controlling the Grace data viewing software."""
25
26
27 import wx
28
29
30 from generic_fns import grace, minimise
31 from graphics import WIZARD_IMAGE_PATH
32 from prompt.doc_string import regexp_doc
33 from specific_fns.model_free import Model_free
34 from specific_fns.jw_mapping import Jw_mapping
35 from specific_fns.noe import Noe
36 from specific_fns.relax_fit import Relax_fit
37 from user_functions.data import Uf_info; uf_info = Uf_info()
38 from user_functions.objects import Desc_container
39
40
41
42 uf_class = uf_info.add_class('grace')
43 uf_class.title = "Class for interfacing with Grace."
44 uf_class.menu_text = "&grace"
45 uf_class.gui_icon = "relax.grace_icon"
46
47
48
49 uf = uf_info.add_uf('grace.view')
50 uf.title = "Visualise the file within Grace."
51 uf.title_short = "Grace execution."
52 uf.add_keyarg(
53 name = "file",
54 py_type = "str",
55 arg_type = "file sel",
56 desc_short = "file name",
57 desc = "The name of the file.",
58 wiz_filesel_wildcard = "Grace files (*.agr)|*.agr;*.AGR",
59 wiz_filesel_style = wx.FD_OPEN
60 )
61 uf.add_keyarg(
62 name = "dir",
63 default = "grace",
64 py_type = "str",
65 arg_type = "dir",
66 desc_short = "directory name",
67 desc = "The directory name.",
68 can_be_none = True
69 )
70 uf.add_keyarg(
71 name = "grace_exe",
72 default = "xmgrace",
73 py_type = "str",
74 desc_short = "Grace executable file",
75 desc = "The Grace executable file."
76 )
77
78 uf.desc.append(Desc_container())
79 uf.desc[-1].add_paragraph("This can be used to view the specified Grace '*.agr' file by opening it with the Grace program.")
80
81 uf.desc.append(Desc_container("Prompt examples"))
82 uf.desc[-1].add_paragraph("To view the file 's2.agr' in the directory 'grace', type:")
83 uf.desc[-1].add_prompt("relax> grace.view(file='s2.agr')")
84 uf.desc[-1].add_prompt("relax> grace.view(file='s2.agr', dir='grace')")
85 uf.backend = grace.view
86 uf.menu_text = "&view"
87 uf.gui_icon = "relax.grace_icon"
88 uf.wizard_size = (900, 500)
89 uf.wizard_image = WIZARD_IMAGE_PATH + 'grace.png'
90
91
92
93 uf = uf_info.add_uf('grace.write')
94 uf.title = "Create a grace '.agr' file to visualise the 2D data."
95 uf.title_short = "Grace file creation."
96 uf.add_keyarg(
97 name = "x_data_type",
98 default = "spin",
99 py_type = "str",
100 desc_short = "x data type",
101 desc = "The data type for the X-axis (no regular expression is allowed).",
102 wiz_element_type = 'combo',
103 wiz_combo_iter = grace.get_data_types
104 )
105 uf.add_keyarg(
106 name = "y_data_type",
107 py_type = "str",
108 desc_short = "y data type",
109 desc = "The data type for the Y-axis (no regular expression is allowed).",
110 wiz_element_type = 'combo',
111 wiz_combo_iter = grace.get_data_types
112 )
113 uf.add_keyarg(
114 name = "spin_id",
115 py_type = "str",
116 desc_short = "spin ID string",
117 desc = "The spin identification string.",
118 can_be_none = True
119 )
120 uf.add_keyarg(
121 name = "plot_data",
122 default = "value",
123 py_type = "str",
124 desc_short = "plot data",
125 desc = "The data to use for the plot.",
126 wiz_element_type = "combo",
127 wiz_combo_choices = [
128 "Values",
129 "Errors",
130 "Simulation values"
131 ],
132 wiz_combo_data = [
133 "value",
134 "error",
135 "sims"
136 ],
137 wiz_read_only = True
138 )
139 uf.add_keyarg(
140 name = "file",
141 py_type = "str",
142 arg_type = "file sel",
143 desc_short = "file name",
144 desc = "The name of the file.",
145 wiz_filesel_wildcard = "Grace files (*.agr)|*.agr;*.AGR",
146 wiz_filesel_style = wx.FD_SAVE
147 )
148 uf.add_keyarg(
149 name = "dir",
150 default = "grace",
151 py_type = "str",
152 arg_type = "dir",
153 desc_short = "directory name",
154 desc = "The directory name.",
155 can_be_none = True
156 )
157 uf.add_keyarg(
158 name = "force",
159 default = False,
160 py_type = "bool",
161 desc_short = "force flag",
162 desc = "A flag which, if set to True, will cause the file to be overwritten."
163 )
164 uf.add_keyarg(
165 name = "norm",
166 default = False,
167 py_type = "bool",
168 desc_short = "normalisation flag",
169 desc = "A flag which, if set to True, will cause all graphs to be normalised to a starting value of 1. This is for the normalisation of series type data."
170 )
171
172 uf.desc.append(Desc_container())
173 uf.desc[-1].add_paragraph("This is designed to be as flexible as possible so that any combination of data can be plotted. The output is in the format of a Grace plot (also known as ACE/gr, Xmgr, and xmgrace) which only supports two dimensional plots. Three types of information can be used to create various types of plot. These include the x-axis and y-axis data types, the spin identification string, and the type of data plot.")
174 uf.desc[-1].add_paragraph("The x-axis and y-axis data types should be plain strings, regular expression is not allowed. If the x-axis data type is not given, the plot will default to having the spin sequence along the x-axis. The two axes of the Grace plot can be absolutely any of the data types listed in the tables below. The only limitation, currently anyway, is that the data must belong to the same data pipe.")
175 uf.desc[-1].add_paragraph("The spin identification string can be used to limit which spins are used in the plot. The default is that all spins will be used, however, the ID string can be used to select a subset of all spins, or a single spin for plots of Monte Carlo simulations, etc.")
176 uf.desc[-1].add_paragraph("The property which is actually plotted can be controlled by the plot data setting. This can be one of the following:")
177 uf.desc[-1].add_item_list_element("'value'", "Plot values (with errors if they exist).")
178 uf.desc[-1].add_item_list_element("'error'", "Plot errors.")
179 uf.desc[-1].add_item_list_element("'sims'", "Plot the simulation values.")
180 uf.desc[-1].add_paragraph("Normalisation is only allowed for series type data, for example the R2 exponential curves, and will be ignored for all other data types. If the norm flag is set to True then the y-value of the first point of the series will be set to 1. This normalisation is useful for highlighting errors in the data sets.")
181 uf.desc.append(regexp_doc)
182 uf.desc.append(minimise.return_data_name_doc)
183 uf.desc.append(Noe.return_data_name_doc)
184 uf.desc.append(Relax_fit.return_data_name_doc)
185 uf.desc.append(Jw_mapping.return_data_name_doc)
186 uf.desc.append(Model_free.return_data_name_doc)
187
188 uf.desc.append(Desc_container("Prompt examples"))
189 uf.desc[-1].add_paragraph("To write the NOE values for all spins to the Grace file 'noe.agr', type one of:")
190 uf.desc[-1].add_prompt("relax> grace.write('spin', 'noe', file='noe.agr')")
191 uf.desc[-1].add_prompt("relax> grace.write(y_data_type='noe', file='noe.agr')")
192 uf.desc[-1].add_prompt("relax> grace.write(x_data_type='spin', y_data_type='noe', file='noe.agr')")
193 uf.desc[-1].add_prompt("relax> grace.write(y_data_type='noe', file='noe.agr', force=True)")
194 uf.desc[-1].add_paragraph("To create a Grace file of 's2' vs. 'te' for all spins, type one of:")
195 uf.desc[-1].add_prompt("relax> grace.write('s2', 'te', file='s2_te.agr')")
196 uf.desc[-1].add_prompt("relax> grace.write(x_data_type='s2', y_data_type='te', file='s2_te.agr')")
197 uf.desc[-1].add_prompt("relax> grace.write(x_data_type='s2', y_data_type='te', file='s2_te.agr', force=True)")
198 uf.desc[-1].add_paragraph("To create a Grace file of the Monte Carlo simulation values of 'rex' vs. 'te' for residue 123, type one of:")
199 uf.desc[-1].add_prompt("relax> grace.write('rex', 'te', spin_id=':123', plot_data='sims', file='s2_te.agr')")
200 uf.desc[-1].add_prompt("relax> grace.write(x_data_type='rex', y_data_type='te', spin_id=':123', plot_data='sims', file='s2_te.agr')")
201 uf.desc[-1].add_paragraph("By plotting the peak intensities, the integrity of exponential relaxation curves can be checked and anomalies searched for prior to model-free analysis or reduced spectral density mapping. For example the normalised average peak intensities can be plotted verses the relaxation time periods for the relaxation curves of all residues of a protein. The normalisation, whereby the initial peak intensity of each residue I(0) is set to 1, emphasises any problems. To produce this Grace file, type:")
202 uf.desc[-1].add_prompt("relax> grace.write(x_data_type='relax_times', y_data_type='ave_int', file='intensities_norm.agr', force=True, norm=True)")
203 uf.backend = grace.write
204 uf.menu_text = "&write"
205 uf.gui_icon = "oxygen.actions.document-save"
206 uf.wizard_size = (1000, 700)
207 uf.wizard_image = WIZARD_IMAGE_PATH + 'grace.png'
208