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