1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 from os import F_OK, access, sep
25 import wx
26
27
28 from data import Relax_data_store; ds = Relax_data_store()
29 from generic_fns.mol_res_spin import spin_loop
30 from generic_fns.pipes import cdp_name
31 from status import Status; status = Status()
32 from test_suite.gui_tests.base_classes import GuiTestCase
33
34
35 from gui.interpreter import Interpreter; interpreter = Interpreter()
36 from gui.misc import int_to_gui, str_to_gui
37 from gui.user_functions import deselect, sequence, spin
38 from gui.wizard import Wiz_window
39
40
41 -class Noe(GuiTestCase):
42 """Class for testing various aspects specific to the NOE analysis."""
43
45 """Test the NOE analysis."""
46
47
48 self.app.gui.show_prompt(None)
49 self.app.gui.show_tree(None)
50 self.app.gui.show_pipe_editor(None)
51
52
53 self.app.gui.analysis.menu_new(None)
54 page = self.app.gui.analysis.new_wizard.wizard.get_page(0)
55 page.select_noe(None)
56 self.app.gui.analysis.new_wizard.wizard._go_next(None)
57 page = self.app.gui.analysis.new_wizard.wizard.get_page(1)
58 self.app.gui.analysis.new_wizard.wizard._go_next(None)
59
60
61 analysis_type, analysis_name, pipe_name = self.app.gui.analysis.new_wizard.get_data()
62
63
64 self.app.gui.analysis.new_analysis(analysis_type=analysis_type, analysis_name=analysis_name, pipe_name=pipe_name)
65
66
67 analysis = self.app.gui.analysis.get_page_from_name("Steady-state NOE")
68
69
70 analysis.field_nmr_frq.SetValue(str_to_gui('500'))
71
72
73 analysis.field_results_dir.SetValue(str_to_gui(ds.tmpdir))
74
75
76 wizard = Wiz_window(self.app.gui)
77 seq_read = sequence.Read_page(wizard)
78 file = status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'Ap4Aase.seq'
79 seq_read.file.SetValue(str_to_gui(file))
80 seq_read.mol_name_col.SetValue(int_to_gui(None))
81 seq_read.res_name_col.SetValue(int_to_gui(2))
82 seq_read.res_num_col.SetValue(int_to_gui(1))
83 seq_read.spin_name_col.SetValue(int_to_gui(None))
84 seq_read.spin_num_col.SetValue(int_to_gui(None))
85 seq_read.on_execute()
86
87
88 deselect_spin = deselect.Spin_page(wizard)
89 deselect_spin.spin_id.SetValue(str_to_gui(":3"))
90 deselect_spin.on_execute()
91
92
93 page = spin.Name_page(wizard)
94 page.name.SetValue(str_to_gui('N'))
95 page.on_execute()
96
97
98 interpreter.flush()
99
100
101 ids = ['ref', 'sat']
102 files = [
103 status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'peak_lists' + sep + 'ref_ave.list',
104 status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'peak_lists' + sep + 'sat_ave.list'
105 ]
106 errors = [3600, 3000]
107 types = [1, 0]
108
109
110 for i in range(2):
111
112 analysis.peak_wizard(None)
113
114
115 page = analysis.wizard.get_page(analysis.page_indices['read'])
116 page.file.SetValue(str_to_gui(files[i]))
117 page.spectrum_id.SetValue(str_to_gui(ids[i]))
118 page.proton.SetValue(str_to_gui('HN'))
119
120
121 analysis.wizard._go_next(None)
122 analysis.wizard._go_next(None)
123
124
125 page = analysis.wizard.get_page(analysis.page_indices['rmsd'])
126 page.error.SetValue(int_to_gui(errors[i]))
127
128
129 analysis.wizard._go_next(None)
130
131
132 page = analysis.wizard.get_page(analysis.page_indices['spectrum_type'])
133 page.spectrum_type.SetSelection(types[i])
134
135
136 analysis.wizard._go_next(None)
137
138
139 analysis.execute(wx.CommandEvent(wx.wxEVT_COMMAND_BUTTON_CLICKED, analysis.button_exec_relax.GetId()))
140
141
142 analysis.thread.join()
143
144
145 wx.Yield()
146
147
148 self.check_exceptions()
149
150
151 if status.relax_mode != 'gui':
152 self.assertEqual(self.app.gui.controller.main_gauge.GetValue(), 100)
153
154
155 res_nums = [4, 5, 6]
156 sat = [5050.0, 51643.0, 53663.0]
157 ref = [148614.0, 166842.0, 128690.0]
158 noe = [0.033980647852826784, 0.30953237194471417, 0.4169943274535706]
159 noe_err = [0.02020329903276632, 0.019181416098790607, 0.026067523940084526]
160
161
162 self.assertEqual(cdp_name(), ds.relax_gui.analyses[0].pipe_name)
163
164
165 i = 0
166 for spin_cont, mol_name, res_num, res_name in spin_loop(full_info=True):
167
168 if not spin_cont.select:
169 continue
170
171
172 self.assertEqual(res_nums[i], res_num)
173
174
175 self.assertEqual(sat[i], spin_cont.intensities['sat'])
176 self.assertEqual(ref[i], spin_cont.intensities['ref'])
177
178
179 self.assertEqual(noe[i], spin_cont.noe)
180 self.assertEqual(noe_err[i], spin_cont.noe_err)
181
182
183 i += 1
184
185
186 self.assert_(access(ds.tmpdir+sep+'grace'+sep+'noe.agr', F_OK))
187