Author: bugman Date: Fri Sep 7 09:29:57 2012 New Revision: 17476 URL: http://svn.gna.org/viewcvs/relax?rev=17476&view=rev Log: Created the test_bug_20152_read_dc_file() GUI test for catching bug #20152 (https://gna.org/bugs/?20152). This includes truncated data taken from the bug report (with data for only the first 3 residues). Added: trunk/test_suite/shared_data/bruker_files/T1_demo_1UBQ_H_trunc.txt (with props) trunk/test_suite/shared_data/structures/1UBQ_H_trunc.pdb Modified: trunk/test_suite/gui_tests/bruker.py Modified: trunk/test_suite/gui_tests/bruker.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/gui_tests/bruker.py?rev=17476&r1=17475&r2=17476&view=diff ============================================================================== --- trunk/test_suite/gui_tests/bruker.py (original) +++ trunk/test_suite/gui_tests/bruker.py Fri Sep 7 09:29:57 2012 @@ -22,11 +22,20 @@ # Module docstring. """GUI tests for the Bruker Dynamics Center support.""" +# Python module imports. +from os import sep # relax module imports. +from data import Relax_data_store; ds = Relax_data_store() import dep_check +from generic_fns.mol_res_spin import spin_loop +from status import Status; status = Status() from test_suite.gui_tests.base_classes import GuiTestCase from test_suite import system_tests + +# relax GUI imports. +from gui.interpreter import Interpreter; interpreter = Interpreter() +from gui.string_conv import str_to_gui class Bruker(GuiTestCase, system_tests.bruker.Bruker): @@ -47,3 +56,86 @@ # Create a data pipe. self.interpreter.pipe.create('mf', 'mf') + + + def test_bug_20152_read_dc_file(self): + """Test the reading of a DC file, catching bug #20152 (https://gna.org/bugs/?20152).""" + + # Simulate the new analysis wizard. + self.app.gui.analysis.menu_new(None) + page = self.app.gui.analysis.new_wizard.wizard.get_page(0) + page.select_mf(None) + page.analysis_name.SetValue(str_to_gui("Model-free test")) + self.app.gui.analysis.new_wizard.wizard._go_next(None) + page = self.app.gui.analysis.new_wizard.wizard.get_page(1) + self.app.gui.analysis.new_wizard.wizard._go_next(None) + + # Get the data. + analysis_type, analysis_name, pipe_name, pipe_bundle = self.app.gui.analysis.new_wizard.get_data() + + # Set up the analysis. + self.app.gui.analysis.new_analysis(analysis_type=analysis_type, analysis_name=analysis_name, pipe_name=pipe_name, pipe_bundle=pipe_bundle) + + # Alias the analysis. + analysis = self.app.gui.analysis.get_page_from_name("Model-free test") + + # Change the results directory. + analysis.field_results_dir.SetValue(str_to_gui(ds.tmpdir)) + + # Launch the spin viewer window. + self.app.gui.show_tree() + + # Spin loading wizard: Initialisation. + self.app.gui.spin_viewer.load_spins_wizard() + + # Spin loading wizard: The PDB file. + page = self.app.gui.spin_viewer.wizard.get_page(0) + page.selection = 'new pdb' + self.app.gui.spin_viewer.wizard._go_next() + page = self.app.gui.spin_viewer.wizard.get_page(self.app.gui.spin_viewer.wizard._current_page) + page.uf_args['file'].SetValue(str_to_gui(status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'structures' + sep + '1UBQ_H_trunc.pdb')) + self.app.gui.spin_viewer.wizard._go_next() + interpreter.flush() # Required because of the asynchronous uf call. + + # Spin loading wizard: The spin loading. + self.app.gui.spin_viewer.wizard._go_next() + interpreter.flush() # Required because of the asynchronous uf call. + + # Close the spin viewer window. + self.app.gui.spin_viewer.handler_close() + + # Flush the interpreter in preparation for the synchronous user functions of the peak list wizard. + interpreter.flush() + + # The data path. + data_path = status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'model_free' + sep + 'sphere' + sep + + # Set up the Bruker DC wizard. + analysis.relax_data.wizard_bruker(None) + + # The spectrum. + page = analysis.relax_data.wizard.get_page(analysis.relax_data.page_indices['read']) + page.uf_args['ri_id'].SetValue(str_to_gui('r1_700')) + page.uf_args['file'].SetValue(str_to_gui(status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'bruker_files' + sep + 'T1_demo_1UBQ_H_trunc.txt')) + + # Next to load the data. + analysis.relax_data.wizard._go_next(None) + interpreter.flush() + + # Go to the next page (i.e. finish). + analysis.wizard._go_next(None) + + # The real data. + res_nums = [1, 2, 3] + r1 = [None, 0.455962, 0.428882] + r1_err = [None, 0.0055642, 0.0040993] + + # Check the data. + i = 0 + for spin_cont, mol_name, res_num, res_name in spin_loop(full_info=True): + # Spin info. + self.assertEqual(res_nums[i], res_num) + + # Check the relaxation data and errors. + self.assertEqual(r1[i], spin_cont.ri['r1_700']) + self.assertEqual(r1_err[i], spin_cont.ri_err['r1_700']) Added: trunk/test_suite/shared_data/bruker_files/T1_demo_1UBQ_H_trunc.txt URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/shared_data/bruker_files/T1_demo_1UBQ_H_trunc.txt?rev=17476&view=auto ============================================================================== --- trunk/test_suite/shared_data/bruker_files/T1_demo_1UBQ_H_trunc.txt (added) +++ trunk/test_suite/shared_data/bruker_files/T1_demo_1UBQ_H_trunc.txt Fri Sep 7 09:29:57 2012 @@ -1,0 +1,70 @@ +$##1.0 + +Project: Dynamic method/T1 +Date: Friday, June 1, 2012 10:31:46 PM +User: Mengjun Xue +Computer: MengjunXue +generated by: Dynamics Center 2.0.6 (2012 Aug/27) + + +SECTION: sample information +sample name: ubiquitine +Description/Title: standard demo sample +Origin: in-house +Date of preparation: 06 / 2005 +Solvent: D2O +pH: 7.0 +Sample tube: normal +Tube diameter (mm): 3 +Concentration (mM): 10.00 +Temperature (K): 308.0 +Weight (Daltons): 8900 +Correlation time (ns): 12.40 +Labelling: 15N +AminoAcid storage: FASTA file +AminoAcid file: C:\Users\Mengjun Xue\Desktop\Discussion with Franzen\tutorial_pdc\ubi_fasta.txt + 0 M Q I +PDB file: C:\Users\Mengjun Xue\Desktop\Discussion with Franzen\tutorial_pdc\1UBQ_H.pdb + + +SECTION: relevant parameters +Proton frequency[MHz]: 600.130 +X nucleus frequency[MHz]: 60.811 + + +SECTION: integrals +Mixing time [s]: 0.01000000 0.05000000 0.10000000 0.10000000 0.20000000 0.30000000 0.40000000 0.50000000 0.50000000 0.70000000 1.00000000 1.50000000 +Peak name I0 I1 I2 I3 I4 I5 I6 I7 I8 I9 I10 I11 + Gln [2] 188221907.00000000 170715850.00000000 155029756.00000000 153590916.00000000 122823911.00000000 99589044.00000000 80386192.00000000 64045596.00000000 63158976.00000000 41739761.00000000 21211820.00000000 7618632.00000000 + Ile [3] 181874689.00000000 165473246.00000000 147666938.00000000 148524160.00000000 116288129.00000000 92254697.00000000 73753362.00000000 57608294.00000000 58646397.00000000 35733527.00000000 18548893.00000000 6005615.00000000 + + +SECTION: integral errors +Mixing time [s]: 0.01000000 0.05000000 0.10000000 0.10000000 0.20000000 0.30000000 0.40000000 0.50000000 0.50000000 0.70000000 1.00000000 1.50000000 +Peak name I0 I1 I2 I3 I4 I5 I6 I7 I8 I9 I10 I11 + Gln [2] 897542.47418861 896854.72297723 897490.21067925 878081.13588050 897985.79603740 913382.23030477 888948.93460278 905641.14635477 903540.85559709 912300.24401111 899610.64435054 908895.14915618 + Ile [3] 897542.47418861 896854.72297723 897490.21067925 878081.13588050 897985.79603740 913382.23030477 888948.93460278 905641.14635477 903540.85559709 912300.24401111 899610.64435054 908895.14915618 + + +SECTION: integrals back calculated from fit +Mixing time [s]: 0.01000000 0.05000000 0.10000000 0.10000000 0.20000000 0.30000000 0.40000000 0.50000000 0.50000000 0.70000000 1.00000000 1.50000000 +Peak name I0 I1 I2 I3 I4 I5 I6 I7 I8 I9 I10 I11 + Gln [2] 187542336.12504458 171790887.65616792 153948735.65601960 153948735.65601960 123631213.49175845 99284199.27784644 79731905.46172418 64030095.37063183 64030095.37063183 41294114.70297287 21386719.64789395 7143387.41259164 + Ile [3] 182020644.30116520 165811967.33932748 147565523.64014703 147565523.64014703 116875361.03757486 92568031.34432912 73316055.24803348 58068037.95079300 58068037.95079300 36426150.39432082 18097869.94214024 5640502.21087503 + + +SECTION: details +Fitted function: f(t) = Io * exp (-t/T) +Random error estimation of data: RMS per spectrum (or trace/plane) +Systematic error estimation of data: average variance calculation +Fit parameter Error estimation method: from fit using arbitray y uncertainties +Confidence level: 95% +Used peaks: peaks from C:\Users\Mengjun Xue\Desktop\Discussion with Franzen\tutorial_pdc\2D-Ref\pdata\1\peaklist.xml +Used integrals: peak intensities +Used Mixing time: all values (including replicates) used + + +SECTION: results +Peak name F1 [ppm] F2 [ppm] Io error T1 [s] error errorScale +Gln [2] 122.508 8.898 191700886.375809 1056073.6682084 0.455962 0.0055642 2.2281389 null null +Ile [3] 114.800 8.280 186314579.684507 816404.5451273 0.428882 0.0040993 2.2281389 null null Propchange: trunk/test_suite/shared_data/bruker_files/T1_demo_1UBQ_H_trunc.txt ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/test_suite/shared_data/structures/1UBQ_H_trunc.pdb URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/shared_data/structures/1UBQ_H_trunc.pdb?rev=17476&view=auto ============================================================================== --- trunk/test_suite/shared_data/structures/1UBQ_H_trunc.pdb (added) +++ trunk/test_suite/shared_data/structures/1UBQ_H_trunc.pdb Fri Sep 7 09:29:57 2012 @@ -1,0 +1,4 @@ +ATOM 1 N MET A 1 27.340 24.430 2.614 1.00 9.67 N +ATOM 9 N GLN A 2 26.335 27.770 3.258 1.00 9.27 N +ATOM 18 N ILE A 3 26.849 29.656 6.217 1.00 5.87 N +END