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

Source Code for Module test_suite.system_tests.mol_res_spin

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2012-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  """System tests of the molecule, residue, and spin sequence operators.""" 
24   
25   
26  # Python module imports. 
27  from os import sep 
28   
29  # relax module imports. 
30  from data_store import Relax_data_store; ds = Relax_data_store() 
31  from status import Status; status = Status() 
32  from test_suite.system_tests.base_classes import SystemTestCase 
33   
34   
35 -class Mol_res_spin(SystemTestCase):
36 """Class for testing the mol_res_spin functions.""" 37
38 - def setUp(self):
39 """Set up for all the functional tests.""" 40 41 # Create the data pipe. 42 self.interpreter.pipe.create('mf', 'mf')
43 44
45 - def test_prune_metadata(self):
46 """Check the proper pruning of the spin ID metadata.""" 47 48 # Create a data pipe for all the data. 49 self.interpreter.pipe.create('CaM N-dom', 'N-state') 50 51 # Create some spins. 52 self.interpreter.spin.create(spin_name='N', spin_num=1, res_name='Gly', res_num=3, mol_name='CaM') 53 self.interpreter.spin.create(spin_name='H', spin_num=2, res_name='Gly', res_num=3, mol_name='CaM') 54 55 # Make sure that certain spin IDs have been removed. 56 print("The spin ID lookup table:\n%s" % cdp.mol._spin_id_lookup) 57 self.assert_(':3' not in cdp.mol._spin_id_lookup) 58 self.assert_('#CaM' not in cdp.mol._spin_id_lookup) 59 60 # Create some more spins. 61 self.interpreter.spin.create(spin_name='N', spin_num=3, res_name='Gly', res_num=4, mol_name='CaM') 62 self.interpreter.spin.create(spin_name='H', spin_num=4, res_name='Gly', res_num=4, mol_name='CaM') 63 64 # Make sure that certain spin IDs have been removed. 65 print("The spin ID lookup table:\n%s" % cdp.mol._spin_id_lookup) 66 self.assert_('@N' not in cdp.mol._spin_id_lookup) 67 self.assert_('@H' not in cdp.mol._spin_id_lookup)
68 69
70 - def test_residue_delete(self):
71 """Test residue deletion.""" 72 73 # Read a PDB file. 74 self.interpreter.structure.read_pdb(file='sphere.pdb', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'sphere') 75 76 # Load the spins. 77 self.interpreter.structure.load_spins() 78 79 # Test the original sequence data. 80 self.assertEqual(len(cdp.mol), 1) 81 self.assertEqual(len(cdp.mol[0].res), 9) 82 83 # Delete the first residue. 84 self.interpreter.residue.delete(res_id='#sphere_mol1:1') 85 86 # Test the remaining sequence data. 87 self.assertEqual(len(cdp.mol), 1) 88 self.assertEqual(len(cdp.mol[0].res), 8)
89