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