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

Source Code for Module test_suite.system_tests.noe_restraints

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2008-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  # Python module imports. 
 23  from os import sep 
 24   
 25  # relax module imports. 
 26  from data_store import Relax_data_store; ds = Relax_data_store() 
 27  from pipe_control.mol_res_spin import create_molecule, create_residue, create_spin 
 28  from status import Status; status = Status() 
 29  from test_suite.system_tests.base_classes import SystemTestCase 
 30   
 31   
32 -class Noe_restraints(SystemTestCase):
33 """Class for testing various aspects specific to NOE restraints.""" 34
35 - def setUp(self):
36 """Set up for all the functional tests.""" 37 38 # Create the data pipe. 39 self.interpreter.pipe.create('test', 'N-state')
40 41
42 - def rna_seq(self):
43 """Generate the RNA sequence of the noe_rna_hbond.dat restraint file.""" 44 45 # Info. 46 mol_names = ['A', 'B'] 47 res_nums = [ 48 [1, 2, 3, 4], 49 [4, 3, 2, 1] 50 ] 51 spin_names = [ 52 [['N1', 'N6', 'H62'], 53 ['H3', 'N3', 'O4'], 54 ['H1', 'N1', 'H22', 'N2', 'O6'], 55 ['N3', 'O2', 'H42', 'N4']], 56 [['H3', 'N3', 'O4'], 57 ['N1', 'N6', 'H62'], 58 ['N3', 'O2', 'H42', 'N4'], 59 ['H1', 'N1', 'H22', 'N2', 'O6']] 60 ] 61 62 # Loop over the molecules. 63 for i in range(len(mol_names)): 64 # Create the molecule. 65 create_molecule(mol_names[i]) 66 67 # Loop over the residues. 68 for j in range(len(res_nums[i])): 69 # Create the residue. 70 create_residue(res_nums[i][j], mol_name=mol_names[i]) 71 72 # Loop over the atoms. 73 for k in range(len(spin_names[i][j])): 74 # Create the spin. 75 create_spin(spin_names[i][j][k], res_num=res_nums[i][j], mol_name=mol_names[i]) 76 77 # Display the sequence for debugging. 78 self.interpreter.sequence.display()
79 80
82 """Test the reading of phthalic acid NOE restraints in generic format.""" 83 84 # Set the file name. 85 ds.file_name = 'phthalic_acid' 86 87 # Execute the script. 88 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'phthalic_acid_noes.py') 89 90 # The restraint data. 91 restraints = [ 92 ['@H1', '@H6', 3.0, 5.0], 93 ['@H3', '@H9', 3.0, 5.0], 94 ['@H3', '@H10', 3.0, 5.0], 95 ['@H3', '@H11', 3.0, 5.0], 96 ['@H3', '@H19', 3.0, 5.0], 97 ['@H3', '@Q9', 3.0, 6.0], 98 ['@H4', '@H8', 3.0, 5.0], 99 ['@H4', '@H9', 3.0, 5.0], 100 ['@H4', '@H10', 3.0, 5.0], 101 ['@H4', '@H11', 3.0, 5.0], 102 ['@H4', '@H15', 3.0, 5.0], 103 ['@H4', '@H19', 3.0, 5.0], 104 ['@H4', '@Q9', 3.0, 6.0], 105 ['@H5', '@H9', 3.0, 5.0], 106 ['@H5', '@Q7', 3.0, 6.0], 107 ['@H5', '@Q9', 3.0, 6.0], 108 ['@H6', '@H8', 3.0, 5.0], 109 ['@H6', '@H9', 3.0, 5.0], 110 ['@H6', '@H10', 3.0, 5.0], 111 ['@H6', '@H11', 3.0, 5.0], 112 ['@H6', '@H15', 3.0, 5.0], 113 ['@H6', '@Q7', 3.0, 6.0], 114 ['@H6', '@H19', 3.0, 5.0], 115 ['@H6', '@Q9', 3.0, 6.0], 116 ['@H26', '@H1', 3.0, 5.0], 117 ['@H26', '@H8', 3.0, 5.0], 118 ['@H26', '@H9', 3.0, 5.0], 119 ['@H26', '@H10', 3.0, 5.0], 120 ['@H26', '@H11', 3.0, 5.0], 121 ['@H26', '@H15', 3.0, 5.0], 122 ['@H26', '@Q7', 3.0, 6.0], 123 ['@H26', '@H19', 3.0, 5.0], 124 ['@H26', '@Q9', 3.0, 6.0], 125 ['@H27', '@H1', 3.0, 5.0], 126 ['@H27', '@H8', 3.0, 5.0], 127 ['@H27', '@H9', 3.0, 5.0], 128 ['@H27', '@H11', 3.0, 5.0], 129 ['@H27', '@H13', 3.0, 5.0], 130 ['@H27', '@H15', 3.0, 5.0], 131 ['@H27', '@Q7', 3.0, 6.0], 132 ['@H27', '@H19', 3.0, 5.0], 133 ['@H27', '@Q9', 3.0, 6.0], 134 ['@H28', '@H1', 3.0, 5.0], 135 ['@H28', '@H8', 3.0, 5.0], 136 ['@H28', '@H9', 3.0, 5.0], 137 ['@H28', '@H11', 3.0, 5.0], 138 ['@H28', '@H15', 3.0, 5.0], 139 ['@H28', '@Q7', 3.0, 6.0], 140 ['@H28', '@H19', 3.0, 5.0], 141 ['@H28', '@Q9', 3.0, 6.0] 142 ] 143 144 # Test that the restraints are properly set. 145 for i in range(len(restraints)): 146 # Atom ids. 147 self.assertEqual(cdp.noe_restraints[i][0], restraints[i][0]) 148 self.assertEqual(cdp.noe_restraints[i][1], restraints[i][1]) 149 150 # Lower and upper bound. 151 self.assertEqual(cdp.noe_restraints[i][2], restraints[i][2]) 152 self.assertEqual(cdp.noe_restraints[i][3], restraints[i][3])
153 154
155 - def test_read_xplor_methyl(self):
156 """Test the reading of an Xplor NOE restraints file fragment with a methyl group.""" 157 158 # Set the file name. 159 ds.file_name = 'pseudo_atoms.dat' 160 161 # Execute the script. 162 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'phthalic_acid_noes.py') 163 164 # The restraint data. 165 restraints = [ 166 ['@H28', '@H9', 3.0, 5.0], 167 ['@H28', '@Q9', 3.0, 6.0] 168 ] 169 170 # Test that the restraints are properly set. 171 for i in range(len(restraints)): 172 # Atom ids. 173 self.assertEqual(cdp.noe_restraints[i][0], restraints[i][0]) 174 self.assertEqual(cdp.noe_restraints[i][1], restraints[i][1]) 175 176 # Lower and upper bound. 177 self.assertEqual(cdp.noe_restraints[i][2], restraints[i][2]) 178 self.assertEqual(cdp.noe_restraints[i][3], restraints[i][3])
179 180
181 - def test_read_xplor_rna(self):
182 """Test the reading of RNA H-bond restraints in Xplor format.""" 183 184 # Generate the RNA sequence. 185 self.rna_seq() 186 187 # Read the Xplor input file. 188 self.interpreter.noe.read_restraints(file='noe_rna_hbond.dat', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'noe_restraints') 189 190 # The restraint data. 191 restraints = [ 192 ['#A:1@N1', '#B:4@H3', 1.93, 0.20, 0.20], 193 ['#A:1@N1', '#B:4@N3', 2.95, 0.20, 0.20], 194 ['#A:1@N6', '#B:4@O4', 2.83, 0.20, 0.20], 195 ['#A:1@H62', '#B:4@O4', 1.82, 0.20, 0.20], 196 ['#A:2@H3', '#B:3@N1', 1.93, 0.20, 0.20], 197 ['#A:2@N3', '#B:3@N1', 2.95, 0.20, 0.20], 198 ['#A:2@O4', '#B:3@N6', 2.83, 0.20, 0.20], 199 ['#A:2@O4', '#B:3@H62', 1.82, 0.20, 0.20], 200 ['#A:3@H1', '#B:2@N3', 1.89, 0.20, 0.20], 201 ['#A:3@N1', '#B:2@N3', 2.91, 0.20, 0.20], 202 ['#A:3@H22', '#B:2@O2', 2.08, 0.20, 0.20], 203 ['#A:3@N2', '#B:2@O2', 3.08, 0.20, 0.20], 204 ['#A:3@O6', '#B:2@H42', 1.71, 0.20, 0.20], 205 ['#A:3@O6', '#B:2@N4', 2.72, 0.20, 0.20], 206 ['#A:4@N3', '#B:1@H1', 1.89, 0.20, 0.20], 207 ['#A:4@N3', '#B:1@N1', 2.91, 0.20, 0.20], 208 ['#A:4@O2', '#B:1@H22', 2.08, 0.20, 0.20], 209 ['#A:4@O2', '#B:1@N2', 3.08, 0.20, 0.20], 210 ['#A:4@H42', '#B:1@O6', 1.71, 0.20, 0.20], 211 ['#A:4@N4', '#B:1@O6', 2.72, 0.20, 0.20] 212 ] 213 214 # Test that the restraints are properly set. 215 for i in range(len(restraints)): 216 # Atom ids. 217 self.assertEqual(cdp.noe_restraints[i][0], restraints[i][0]) 218 self.assertEqual(cdp.noe_restraints[i][1], restraints[i][1]) 219 220 # Lower and upper bound. 221 self.assertEqual(cdp.noe_restraints[i][2], restraints[i][2]-restraints[i][3]) 222 self.assertEqual(cdp.noe_restraints[i][3], restraints[i][2]+restraints[i][4])
223