Author: bugman Date: Tue Oct 21 14:43:36 2014 New Revision: 26325 URL: http://svn.gna.org/viewcvs/relax?rev=26325&view=rev Log: Created the Structure.test_load_spins_multi_mol system test. This is to test yet to be implemented functionality of the structure.load_spins user function. This is the loading of spin information similar, but not necessarily identical molecules all loaded into the same structural model. For this, the from_mols argument will be added. Modified: trunk/test_suite/system_tests/structure.py Modified: trunk/test_suite/system_tests/structure.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/structure.py?rev=26325&r1=26324&r2=26325&view=diff ============================================================================== --- trunk/test_suite/system_tests/structure.py (original) +++ trunk/test_suite/system_tests/structure.py Tue Oct 21 14:43:36 2014 @@ -2921,6 +2921,65 @@ self.assertEqual(cdp.mol[0].res[0].spin[1].num, 2) + def test_load_spins_multi_mol(self): + """Test the structure.load_spins user function for loading the same spins from multiple molecules.""" + + # Path of the files. + path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' + + # Read the PDBs. + self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path, set_mol_name='L1') + self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_2.pdb', dir=path, set_mol_name='L2') + + # Delete one of the atoms. + self.interpreter.structure.delete(atom_id='#L2:900@C1') + self.interpreter.structure.delete(atom_id='#L1:900@C3') + + # Atom renumbering of the second molecule, to follow from the last atom 103 of the first structure (simulate a single PDB file). + for i in range(len(cdp.structure.structural_data[0].mol[1].atom_num)): + cdp.structure.structural_data[0].mol[1].atom_num[i] = i + 104 + + # Load a few carbons. + self.interpreter.structure.load_spins(':900@C1', from_mols=['L1', 'L2'], mol_name_target='Lactose') + self.interpreter.structure.load_spins(':900@C2', from_mols=['L1', 'L2'], mol_name_target='Lactose') + self.interpreter.structure.load_spins(':900@C3', from_mols=['L1', 'L2'], mol_name_target='Lactose') + + # Check the sequence data. + self.assertEqual(len(cdp.mol), 1) + self.assertEqual(cdp.mol[0].name, 'Lactose') + self.assertEqual(len(cdp.mol[0].res), 1) + self.assertEqual(cdp.mol[0].res[0].name, 'UNK') + self.assertEqual(cdp.mol[0].res[0].num, 900) + self.assertEqual(len(cdp.mol[0].res[0].spin), 3) + + # Check the @C1 spin data. + self.assertEqual(cdp.mol[0].res[0].spin[0].name, 'C1') + self.assertEqual(cdp.mol[0].res[0].spin[0].num, None) + self.assertEqual(len(cdp.mol[0].res[0].spin[0].pos), 1) + self.assertEqual(cdp.mol[0].res[0].spin[0].pos[0][0], 6.250) + self.assertEqual(cdp.mol[0].res[0].spin[0].pos[0][1], 0.948) + self.assertEqual(cdp.mol[0].res[0].spin[0].pos[0][2], 1.968) + + # Check the @C2 spin data. + self.assertEqual(cdp.mol[0].res[0].spin[1].name, 'C2') + self.assertEqual(cdp.mol[0].res[0].spin[1].num, None) + self.assertEqual(len(cdp.mol[0].res[0].spin[0].pos), 2) + self.assertEqual(cdp.mol[0].res[0].spin[1].pos[0][0], 6.250) + self.assertEqual(cdp.mol[0].res[0].spin[1].pos[0][1], 2.488) + self.assertEqual(cdp.mol[0].res[0].spin[1].pos[0][2], 2.102) + self.assertEqual(cdp.mol[0].res[0].spin[1].pos[1][0], 6.824) + self.assertEqual(cdp.mol[0].res[0].spin[1].pos[1][1], 0.916) + self.assertEqual(cdp.mol[0].res[0].spin[1].pos[1][2], 2.283) + + # Check the @C3 spin data. + self.assertEqual(cdp.mol[0].res[0].spin[0].name, 'C3') + self.assertEqual(cdp.mol[0].res[0].spin[0].num, None) + self.assertEqual(len(cdp.mol[0].res[0].spin[0].pos), 1) + self.assertEqual(cdp.mol[0].res[0].spin[0].pos[0][0], 8.062) + self.assertEqual(cdp.mol[0].res[0].spin[0].pos[0][1], 0.431) + self.assertEqual(cdp.mol[0].res[0].spin[0].pos[0][2], 3.048) + + def test_load_internal_results(self): """Load the PDB file using the information in a results file (using the internal structural object)."""