Package test_suite :: Package system_tests :: Module chemical_shift
[hide private]
[frames] | no frames]

Source Code for Module test_suite.system_tests.chemical_shift

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2013 Edward d'Auvergne                                        # 
  4  #                                                                             # 
  5  # This file is part of the program relax (http://www.nmr-relax.com).          # 
  6  #                                                                             # 
  7  # This program is free software: you can redistribute it and/or modify        # 
  8  # it under the terms of the GNU General Public License as published by        # 
  9  # the Free Software Foundation, either version 3 of the License, or           # 
 10  # (at your option) any later version.                                         # 
 11  #                                                                             # 
 12  # This program is distributed in the hope that it will be useful,             # 
 13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
 14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
 15  # GNU General Public License for more details.                                # 
 16  #                                                                             # 
 17  # You should have received a copy of the GNU General Public License           # 
 18  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
 19  #                                                                             # 
 20  ############################################################################### 
 21   
 22  # Module docstring. 
 23  """The module for the system tests for chemical shift support in relax.""" 
 24   
 25   
 26  # Python module imports. 
 27  from os import sep 
 28   
 29  # relax module imports. 
 30  from pipe_control.mol_res_spin import spin_loop 
 31  from status import Status; status = Status() 
 32  from test_suite.system_tests.base_classes import SystemTestCase 
 33   
 34   
35 -class Chemical_shift(SystemTestCase):
36 """System test class for checking the handling of chemical shifts.""" 37 38
39 - def setUp(self):
40 """Set up for all the system tests.""" 41 42 # Create the data pipe. 43 self.interpreter.pipe.create('cs', 'mf')
44 45
46 - def test_read_nmrview(self):
47 """Test the reading of chemical shifts from an NMRView peak list.""" 48 49 # Create the sequence data, and name the spins. 50 self.interpreter.spin.create(res_num=70, spin_name='N') 51 self.interpreter.spin.create(res_num=70, spin_name='HN') 52 self.interpreter.spin.create(res_num=72, spin_name='N') 53 self.interpreter.spin.create(res_num=72, spin_name='HN') 54 55 # Read the peak list. 56 self.interpreter.chemical_shift.read(file="cNTnC.xpk", dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'peak_lists') 57 58 # Test the data. 59 cs = [116.37241, 10.75274, 126.41302, 9.67752] 60 i = 0 61 for spin in spin_loop(): 62 # Check the shift. 63 self.assertEqual(spin.chemical_shift, cs[i]) 64 65 # Increment the index. 66 i += 1
67 68
69 - def test_read_sparky(self):
70 """Test the reading of chemical shifts from a Sparky peak list.""" 71 72 # Create the sequence data, and name the spins. 73 for res_num in [3, 4, 5, 6, 40]: 74 self.interpreter.spin.create(res_num=res_num, spin_name='N') 75 self.interpreter.spin.create(res_num=res_num, spin_name='HN') 76 self.interpreter.spin.create(res_num=40, spin_name='NE1') 77 self.interpreter.spin.create(res_num=40, spin_name='HE1') 78 79 # Load the peak list. 80 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'peak_lists' 81 self.interpreter.chemical_shift.read(file='ref_ave.list', dir=path) 82 83 # Test the data. 84 cs = [122.454, 8.397, 111.978, 8.720, 115.069, 8.177, 120.910, 8.813, 123.335, 8.005, 130.204, 10.294] 85 i = 0 86 for spin in spin_loop(): 87 # No data. 88 if i > 12: 89 self.assert_(not hasattr(spin, 'chemical_shift')) 90 91 # Check the shift. 92 self.assertEqual(spin.chemical_shift, cs[i]) 93 94 # Increment the index. 95 i += 1
96 97
98 - def test_read_xeasy(self):
99 """Test the reading of chemical shifts from a XEasy peak list.""" 100 101 # Create the sequence data, and name the spins. 102 for res_num in [21, 96, 104, 110]: 103 self.interpreter.spin.create(res_num=res_num, spin_name='N') 104 self.interpreter.spin.create(res_num=res_num, spin_name='HN') 105 self.interpreter.spin.create(res_num=79, spin_name='NE1') 106 self.interpreter.spin.create(res_num=79, spin_name='HE1') 107 108 # Load the peak list. 109 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'peak_lists' 110 self.interpreter.chemical_shift.read(file='xeasy_r1_20ms.text', dir=path) 111 112 # Test the data. 113 cs = [134.221, 10.014, 118.450, 8.364, 127.582, 9.211, 129.041, 9.882, 132.592, 10.481] 114 i = 0 115 for spin in spin_loop(): 116 # No data. 117 if i > 10: 118 self.assert_(not hasattr(spin, 'chemical_shift')) 119 120 # Check the shift. 121 self.assertEqual(spin.chemical_shift, cs[i]) 122 123 # Increment the index. 124 i += 1
125