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

Source Code for Module test_suite.system_tests.sequence

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2006-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 status import Status; status = Status() 
 30   
 31   
32 -class Sequence(SystemTestCase):
33 """Class for testing the sequence functions.""" 34
35 - def setUp(self):
36 """Set up for all the functional tests.""" 37 38 # Create the data pipe. 39 self.interpreter.pipe.create('mf', 'mf')
40 41
43 """Load all aspartic acid atoms from the single residue in a loaded protein PDB file.""" 44 45 # Read the PDB file. 46 self.interpreter.structure.read_pdb(file='Ap4Aase_res1-12.pdb', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1) 47 48 # Load all the ASP atoms (1 molecule, 1 ASP residue, and all atoms). 49 self.interpreter.structure.load_spins(spin_id=':ASP') 50 51 # Test some of the sequence. 52 self.assertEqual(len(cdp.mol), 1) 53 self.assertEqual(cdp.mol[0].name, 'Ap4Aase_res1-12_mol1') 54 self.assertEqual(len(cdp.mol[0].res), 1) 55 56 # 1st residue. 57 self.assertEqual(cdp.mol[0].res[0].num, 7) 58 self.assertEqual(cdp.mol[0].res[0].name, 'ASP') 59 self.assertEqual(len(cdp.mol[0].res[0].spin), 12) 60 self.assertEqual(cdp.mol[0].res[0].spin[0].num, 91) 61 self.assertEqual(cdp.mol[0].res[0].spin[0].name, 'N') 62 self.assertEqual(cdp.mol[0].res[0].spin[1].num, 92) 63 self.assertEqual(cdp.mol[0].res[0].spin[1].name, 'H') 64 self.assertEqual(cdp.mol[0].res[0].spin[2].num, 93) 65 self.assertEqual(cdp.mol[0].res[0].spin[2].name, 'CA') 66 self.assertEqual(cdp.mol[0].res[0].spin[3].num, 94) 67 self.assertEqual(cdp.mol[0].res[0].spin[3].name, 'HA') 68 self.assertEqual(cdp.mol[0].res[0].spin[4].num, 95) 69 self.assertEqual(cdp.mol[0].res[0].spin[4].name, 'CB') 70 self.assertEqual(cdp.mol[0].res[0].spin[5].num, 96) 71 self.assertEqual(cdp.mol[0].res[0].spin[5].name, '1HB') 72 self.assertEqual(cdp.mol[0].res[0].spin[6].num, 97) 73 self.assertEqual(cdp.mol[0].res[0].spin[6].name, '2HB') 74 self.assertEqual(cdp.mol[0].res[0].spin[7].num, 99) 75 self.assertEqual(cdp.mol[0].res[0].spin[7].name, 'CG') 76 self.assertEqual(cdp.mol[0].res[0].spin[8].num, 100) 77 self.assertEqual(cdp.mol[0].res[0].spin[8].name, 'OD1') 78 self.assertEqual(cdp.mol[0].res[0].spin[9].num, 101) 79 self.assertEqual(cdp.mol[0].res[0].spin[9].name, 'OD2') 80 self.assertEqual(cdp.mol[0].res[0].spin[10].num, 102) 81 self.assertEqual(cdp.mol[0].res[0].spin[10].name, 'C') 82 self.assertEqual(cdp.mol[0].res[0].spin[11].num, 103) 83 self.assertEqual(cdp.mol[0].res[0].spin[11].name, 'O')
84 85
87 """Load the glycine backbone amide N and Ca spins from a loaded protein PDB file.""" 88 89 # Read the PDB file. 90 self.interpreter.structure.read_pdb(file='Ap4Aase_res1-12.pdb', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1) 91 92 # Generate the sequence of nitrogen spins (1 molecule, all GLY residues, and only N spins). 93 self.interpreter.structure.load_spins(spin_id=':GLY@N') 94 95 # Append to the sequence the alpha carbon spins (1 molecule, all GLY residues, and only Ca spins). 96 self.interpreter.structure.load_spins(spin_id=':GLY@CA') 97 98 # Test some of the sequence. 99 self.assertEqual(len(cdp.mol), 1) 100 self.assertEqual(cdp.mol[0].name, 'Ap4Aase_res1-12_mol1') 101 self.assertEqual(len(cdp.mol[0].res), 3) 102 103 # 1st residue. 104 self.assertEqual(cdp.mol[0].res[0].num, 1) 105 self.assertEqual(cdp.mol[0].res[0].name, 'GLY') 106 self.assertEqual(len(cdp.mol[0].res[0].spin), 2) 107 self.assertEqual(cdp.mol[0].res[0].spin[0].num, 1) 108 self.assertEqual(cdp.mol[0].res[0].spin[0].name, 'N') 109 self.assertEqual(cdp.mol[0].res[0].spin[1].num, 2) 110 self.assertEqual(cdp.mol[0].res[0].spin[1].name, 'CA') 111 112 # 2nd residue. 113 self.assertEqual(cdp.mol[0].res[1].num, 4) 114 self.assertEqual(cdp.mol[0].res[1].name, 'GLY') 115 self.assertEqual(len(cdp.mol[0].res[1].spin), 2) 116 self.assertEqual(cdp.mol[0].res[1].spin[0].num, 51) 117 self.assertEqual(cdp.mol[0].res[1].spin[0].name, 'N') 118 self.assertEqual(cdp.mol[0].res[1].spin[1].num, 53) 119 self.assertEqual(cdp.mol[0].res[1].spin[1].name, 'CA') 120 121 # 3rd residue. 122 self.assertEqual(cdp.mol[0].res[2].num, 12) 123 self.assertEqual(cdp.mol[0].res[2].name, 'GLY') 124 self.assertEqual(len(cdp.mol[0].res[2].spin), 2) 125 self.assertEqual(cdp.mol[0].res[2].spin[0].num, 167) 126 self.assertEqual(cdp.mol[0].res[2].spin[0].name, 'N') 127 self.assertEqual(cdp.mol[0].res[2].spin[1].num, 169) 128 self.assertEqual(cdp.mol[0].res[2].spin[1].name, 'CA')
129 130
132 """Load the glycine backbone amide N spins from a loaded protein PDB file.""" 133 134 # Read the PDB file. 135 self.interpreter.structure.read_pdb(file='Ap4Aase_res1-12.pdb', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1) 136 137 # Generate the sequence (1 molecule, all GLY residues, and only N spins). 138 self.interpreter.structure.load_spins(spin_id=':GLY@N') 139 140 # Test some of the sequence. 141 self.assertEqual(len(cdp.mol), 1) 142 self.assertEqual(cdp.mol[0].name, 'Ap4Aase_res1-12_mol1') 143 self.assertEqual(len(cdp.mol[0].res), 3) 144 145 # 1st residue. 146 self.assertEqual(cdp.mol[0].res[0].num, 1) 147 self.assertEqual(cdp.mol[0].res[0].name, 'GLY') 148 self.assertEqual(len(cdp.mol[0].res[0].spin), 1) 149 self.assertEqual(cdp.mol[0].res[0].spin[0].num, 1) 150 self.assertEqual(cdp.mol[0].res[0].spin[0].name, 'N') 151 152 # 2nd residue. 153 self.assertEqual(cdp.mol[0].res[1].num, 4) 154 self.assertEqual(cdp.mol[0].res[1].name, 'GLY') 155 self.assertEqual(len(cdp.mol[0].res[1].spin), 1) 156 self.assertEqual(cdp.mol[0].res[1].spin[0].num, 51) 157 self.assertEqual(cdp.mol[0].res[1].spin[0].name, 'N') 158 159 # 3rd residue. 160 self.assertEqual(cdp.mol[0].res[2].num, 12) 161 self.assertEqual(cdp.mol[0].res[2].name, 'GLY') 162 self.assertEqual(len(cdp.mol[0].res[2].spin), 1) 163 self.assertEqual(cdp.mol[0].res[2].spin[0].num, 167) 164 self.assertEqual(cdp.mol[0].res[2].spin[0].name, 'N')
165 166
168 """Load the protein backbone amide N spins from a loaded PDB file.""" 169 170 # Read the PDB file. 171 self.interpreter.structure.read_pdb(file='Ap4Aase_res1-12.pdb', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1) 172 173 # Generate the sequence (1 molecule, all residues, and only N spins). 174 self.interpreter.structure.load_spins(spin_id='@N') 175 176 # Test some of the sequence. 177 self.assertEqual(len(cdp.mol), 1) 178 self.assertEqual(cdp.mol[0].name, 'Ap4Aase_res1-12_mol1') 179 self.assertEqual(len(cdp.mol[0].res), 12) 180 181 # 1st residue. 182 self.assertEqual(cdp.mol[0].res[0].num, 1) 183 self.assertEqual(cdp.mol[0].res[0].name, 'GLY') 184 self.assertEqual(len(cdp.mol[0].res[0].spin), 1) 185 self.assertEqual(cdp.mol[0].res[0].spin[0].num, 1) 186 self.assertEqual(cdp.mol[0].res[0].spin[0].name, 'N') 187 188 # 2nd residue. 189 self.assertEqual(cdp.mol[0].res[1].num, 2) 190 self.assertEqual(cdp.mol[0].res[1].name, 'PRO') 191 self.assertEqual(len(cdp.mol[0].res[1].spin), 1) 192 self.assertEqual(cdp.mol[0].res[1].spin[0].num, 11) 193 self.assertEqual(cdp.mol[0].res[1].spin[0].name, 'N') 194 195 # 3rd residue. 196 self.assertEqual(cdp.mol[0].res[2].num, 3) 197 self.assertEqual(cdp.mol[0].res[2].name, 'LEU') 198 self.assertEqual(len(cdp.mol[0].res[2].spin), 1) 199 self.assertEqual(cdp.mol[0].res[2].spin[0].num, 28) 200 self.assertEqual(cdp.mol[0].res[2].spin[0].name, 'N') 201 202 # 4th residue. 203 self.assertEqual(cdp.mol[0].res[3].num, 4) 204 self.assertEqual(cdp.mol[0].res[3].name, 'GLY') 205 self.assertEqual(len(cdp.mol[0].res[3].spin), 1) 206 self.assertEqual(cdp.mol[0].res[3].spin[0].num, 51) 207 self.assertEqual(cdp.mol[0].res[3].spin[0].name, 'N') 208 209 # 5th residue. 210 self.assertEqual(cdp.mol[0].res[4].num, 5) 211 self.assertEqual(cdp.mol[0].res[4].name, 'SER') 212 self.assertEqual(len(cdp.mol[0].res[4].spin), 1) 213 self.assertEqual(cdp.mol[0].res[4].spin[0].num, 59) 214 self.assertEqual(cdp.mol[0].res[4].spin[0].name, 'N') 215 216 # 6th residue. 217 self.assertEqual(cdp.mol[0].res[5].num, 6) 218 self.assertEqual(cdp.mol[0].res[5].name, 'MET') 219 self.assertEqual(len(cdp.mol[0].res[5].spin), 1) 220 self.assertEqual(cdp.mol[0].res[5].spin[0].num, 71) 221 self.assertEqual(cdp.mol[0].res[5].spin[0].name, 'N') 222 223 # 7th residue. 224 self.assertEqual(cdp.mol[0].res[6].num, 7) 225 self.assertEqual(cdp.mol[0].res[6].name, 'ASP') 226 self.assertEqual(len(cdp.mol[0].res[6].spin), 1) 227 self.assertEqual(cdp.mol[0].res[6].spin[0].num, 91) 228 self.assertEqual(cdp.mol[0].res[6].spin[0].name, 'N') 229 230 # 8th residue. 231 self.assertEqual(cdp.mol[0].res[7].num, 8) 232 self.assertEqual(cdp.mol[0].res[7].name, 'SER') 233 self.assertEqual(len(cdp.mol[0].res[7].spin), 1) 234 self.assertEqual(cdp.mol[0].res[7].spin[0].num, 104) 235 self.assertEqual(cdp.mol[0].res[7].spin[0].name, 'N') 236 237 # 9th residue. 238 self.assertEqual(cdp.mol[0].res[8].num, 9) 239 self.assertEqual(cdp.mol[0].res[8].name, 'PRO') 240 self.assertEqual(len(cdp.mol[0].res[8].spin), 1) 241 self.assertEqual(cdp.mol[0].res[8].spin[0].num, 116) 242 self.assertEqual(cdp.mol[0].res[8].spin[0].name, 'N') 243 244 # 10th residue. 245 self.assertEqual(cdp.mol[0].res[9].num, 10) 246 self.assertEqual(cdp.mol[0].res[9].name, 'PRO') 247 self.assertEqual(len(cdp.mol[0].res[9].spin), 1) 248 self.assertEqual(cdp.mol[0].res[9].spin[0].num, 133) 249 self.assertEqual(cdp.mol[0].res[9].spin[0].name, 'N') 250 251 # 11th residue. 252 self.assertEqual(cdp.mol[0].res[10].num, 11) 253 self.assertEqual(cdp.mol[0].res[10].name, 'GLU') 254 self.assertEqual(len(cdp.mol[0].res[10].spin), 1) 255 self.assertEqual(cdp.mol[0].res[10].spin[0].num, 150) 256 self.assertEqual(cdp.mol[0].res[10].spin[0].name, 'N') 257 258 # 12th residue. 259 self.assertEqual(cdp.mol[0].res[11].num, 12) 260 self.assertEqual(cdp.mol[0].res[11].name, 'GLY') 261 self.assertEqual(len(cdp.mol[0].res[11].spin), 1) 262 self.assertEqual(cdp.mol[0].res[11].spin[0].num, 167) 263 self.assertEqual(cdp.mol[0].res[11].spin[0].name, 'N')
264 265
266 - def test_read(self):
267 """The sequence.read() test.""" 268 269 # Read the sequence. 270 self.interpreter.sequence.read(file='test_seq', dir=status.install_path + sep+'test_suite'+sep+'shared_data', res_num_col=1, res_name_col=2)
271