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 """Set up the test case class for the system tests."""
41
42
43 super(Noe, self).__init__(methodName)
44
45
46 blacklist = [
47 'test_noe_analysis_memory_leaks'
48 ]
49
50
51 if methodName in blacklist:
52 status.skipped_tests.append([methodName, None, self._skip_type])
53
54
56 """Test the NOE analysis."""
57
58
59 self.app.gui.show_prompt(None)
60 self.app.gui.show_tree(None)
61 self.app.gui.show_pipe_editor(None)
62
63
64 analysis = self.new_analysis_wizard(analysis_type='noe')
65
66
67 analysis.field_nmr_frq.SetValue(str_to_gui('500'))
68
69
70 analysis.field_results_dir.SetValue(str_to_gui(ds.tmpdir))
71
72
73 file = status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'Ap4Aase.seq'
74 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)
75
76
77 self._execute_uf(uf_name='deselect.spin', spin_id=":3")
78
79
80 self._execute_uf(uf_name='spin.name', name="N")
81
82
83 self._execute_uf(uf_name='spin.create', res_num=40, spin_name="NE1")
84
85
86 interpreter.flush()
87
88
89 ids = ['ref', 'sat']
90 files = [
91 status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'peak_lists' + sep + 'ref_ave.list',
92 status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'peak_lists' + sep + 'sat_ave.list'
93 ]
94 errors = [3600, 3000]
95 errors_5 = [122000, 8500]
96 types = ['ref', 'sat']
97
98
99 for i in range(2):
100
101 analysis.peak_wizard_launch(None)
102 wizard = analysis.peak_wizard
103
104
105 wizard.setup_page(page='read', file=files[i], spectrum_id=ids[i])
106 wizard._go_next(None)
107
108
109 wizard._go_next(None)
110
111
112 wizard.setup_page(page='rmsd', error=errors[i])
113 wizard._apply(None)
114 wizard.setup_page(page='rmsd', error=errors_5[i], spin_id=':5')
115 wizard._go_next(None)
116
117
118 wizard.setup_page(page='spectrum_type', spectrum_type=types[i])
119 wizard._go_next(None)
120
121
122 analysis.execute(wx.CommandEvent(wx.wxEVT_COMMAND_BUTTON_CLICKED, analysis.button_exec_relax.GetId()))
123
124
125 analysis.thread.join()
126
127
128 wx.Yield()
129
130
131 self.check_exceptions()
132
133
134
135 if status.relax_mode != 'gui' and wx.version() != '2.9.4.1 gtk2 (classic)':
136 self.assertEqual(self.app.gui.controller.main_gauge.GetValue(), 100)
137
138
139 res_nums = [4, 5, 6, 40, 40, 55]
140 sat = [5050.0, 51643.0, 53663.0, -65111.0, -181131.0, -105322.0]
141 ref = [148614.0, 166842.0, 128690.0, 99566.0, 270047.0, 130959.0]
142 noe = [0.033980647852826784, 0.30953237194471417, 0.4169943274535706, -0.6539481349054899, -0.6707387973204665, -0.8042364404126482]
143 noe_err = [0.02020329903276632, 0.2320024671657343, 0.026067523940084526, 0.038300618865378507, 0.014260663438353431, 0.03183614777183591]
144
145
146 self.assertEqual(cdp_name(), ds.relax_gui.analyses[0].pipe_name)
147
148
149 i = 0
150 for spin_cont, mol_name, res_num, res_name in spin_loop(full_info=True):
151
152 if not spin_cont.select:
153 continue
154
155
156 self.assertEqual(res_nums[i], res_num)
157
158
159 self.assertEqual(sat[i], spin_cont.peak_intensity['sat'])
160 self.assertEqual(ref[i], spin_cont.peak_intensity['ref'])
161
162
163 self.assertEqual(noe[i], spin_cont.noe)
164 self.assertAlmostEqual(noe_err[i], spin_cont.noe_err)
165
166
167 i += 1
168
169
170 self.assertTrue(access(ds.tmpdir+sep+'grace'+sep+'noe.agr', F_OK))
171
172
174 """Test for memory leaks in the NOE analysis.
175
176 This can be monitored using the MS Windows task manager, once the 'USER Objects' column is shown.
177 """
178
179
180 for i in range(1000):
181
182 print("\n\n\nCreating the analysis number %i." % (i+1))
183
184
185 analysis = self.new_analysis_wizard(analysis_type='noe')
186
187
188 self.app.gui.analysis.delete_analysis(0)
189
190
191 print("\n\nClosing the analysis number %i.\n\n\n" % (i+1))
192