Author: bugman Date: Tue Jan 27 09:48:41 2015 New Revision: 27321 URL: http://svn.gna.org/viewcvs/relax?rev=27321&view=rev Log: Created the Structure.test_pdb_combined_secondary_structure system test. This is used to demonstrate a problem in the handling of secondary structure metadata when combining multiple PDB structures. It appears as if the chain ID is preserved as the original ID and is not updated to match the new IDs in the output PDB. 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=27321&r1=27320&r2=27321&view=diff ============================================================================== --- trunk/test_suite/system_tests/structure.py (original) +++ trunk/test_suite/system_tests/structure.py Tue Jan 27 09:48:41 2015 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2008-2014 Edward d'Auvergne # +# Copyright (C) 2008-2015 Edward d'Auvergne # # # # This file is part of the program relax (http://www.nmr-relax.com). # # # @@ -3676,6 +3676,49 @@ self.assertEqual(cdp.structure.sheets[1], sheets[1]) + def test_pdb_combined_secondary_structure(self): + """Test the handling of secondary structure metadata when combining multiple PDB structures.""" + + # Path of the structure file. + path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' + + # Read a PDB file twice as two different molecules. + self.interpreter.structure.read_pdb('1J7O.pdb', dir=path, set_mol_name='N-dom', read_model=1, set_model_num=1) + self.interpreter.structure.read_pdb('1J7P.pdb', dir=path, set_mol_name='C-dom', read_model=1, set_model_num=1) + + # Create a PDB file. + file = DummyFileObject() + self.interpreter.structure.write_pdb(file=file, force=True) + + # The file secondary structure contents, as they should be. + contents = [ + "HELIX 1 1 THR A 5 ASP A 20 1 16 \n", + "HELIX 2 2 THR A 28 LEU A 39 1 12 \n", + "HELIX 3 3 THR A 44 GLU A 54 1 11 \n", + "HELIX 4 4 ASP A 64 MET A 76 1 13 \n", + "HELIX 5 1 GLU B 82 ASP B 93 1 12 \n", + "HELIX 6 2 SER B 101 LEU B 112 1 12 \n", + "HELIX 7 3 THR B 117 ASP B 129 1 13 \n", + "HELIX 8 4 TYR B 138 THR B 146 1 9 \n", + "SHEET 1 A 2 TYR B 99 ILE B 100 0 \n", + "SHEET 2 A 2 VAL B 136 ASN B 137 -1 OVAL B 136 NILE B 100 \n" + ] + + # Check secondary structure contents of the created PDB file. + lines = file.readlines() + index = 0 + print("\n\nChecking the records:\n") + for i in range(len(lines)): + # Only secondary structure records. + if lines[i][:5] not in ['HELIX', 'SHEET']: + continue + + # Check and increment the index. + print(lines[i][:-1]) + self.assertEqual(contents[index], lines[i]) + index += 1 + + def test_read_gaussian_strychnine(self): """Load the structure from the 'strychnine_opt_cdcl3_b3lyp_gaussian.log.bz2' compressed Gaussian log file."""