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 sep 
 24   
 25   
 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   
 33      """Class for testing various aspects specific to NOE restraints.""" 
 34   
 40   
 41   
 43          """Generate the RNA sequence of the noe_rna_hbond.dat restraint file.""" 
 44   
 45           
 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           
 63          for i in range(len(mol_names)): 
 64               
 65              create_molecule(mol_names[i]) 
 66   
 67               
 68              for j in range(len(res_nums[i])): 
 69                   
 70                  create_residue(res_nums[i][j], mol_name=mol_names[i]) 
 71   
 72                   
 73                  for k in range(len(spin_names[i][j])): 
 74                       
 75                      create_spin(spin_names[i][j][k], res_num=res_nums[i][j], mol_name=mol_names[i]) 
 76   
 77           
 78          self.interpreter.sequence.display() 
  79   
 80   
 82          """Test the reading of phthalic acid NOE restraints in generic format.""" 
 83   
 84           
 85          ds.file_name = 'phthalic_acid' 
 86   
 87           
 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           
 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           
145          for i in range(len(restraints)): 
146               
147              self.assertEqual(cdp.noe_restraints[i][0], restraints[i][0]) 
148              self.assertEqual(cdp.noe_restraints[i][1], restraints[i][1]) 
149   
150               
151              self.assertEqual(cdp.noe_restraints[i][2], restraints[i][2]) 
152              self.assertEqual(cdp.noe_restraints[i][3], restraints[i][3]) 
 153   
154   
156          """Test the reading of an Xplor NOE restraints file fragment with a methyl group.""" 
157   
158           
159          ds.file_name = 'pseudo_atoms.dat' 
160   
161           
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           
165          restraints = [ 
166              ['@H28', '@H9',  3.0, 5.0], 
167              ['@H28', '@Q9',  3.0, 6.0] 
168          ] 
169   
170           
171          for i in range(len(restraints)): 
172               
173              self.assertEqual(cdp.noe_restraints[i][0], restraints[i][0]) 
174              self.assertEqual(cdp.noe_restraints[i][1], restraints[i][1]) 
175   
176               
177              self.assertEqual(cdp.noe_restraints[i][2], restraints[i][2]) 
178              self.assertEqual(cdp.noe_restraints[i][3], restraints[i][3]) 
 179   
180   
182          """Test the reading of RNA H-bond restraints in Xplor format.""" 
183   
184           
185          self.rna_seq() 
186   
187           
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           
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           
215          for i in range(len(restraints)): 
216               
217              self.assertEqual(cdp.noe_restraints[i][0], restraints[i][0]) 
218              self.assertEqual(cdp.noe_restraints[i][1], restraints[i][1]) 
219   
220               
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