Author: bugman Date: Thu Feb 19 14:22:50 2015 New Revision: 27667 URL: http://svn.gna.org/viewcvs/relax?rev=27667&view=rev Log: Created the Structure.test_bug_23293_missing_hetatm system test. This is to catch bug #23293 (https://gna.org/bugs/?23293), the PDB HETATM loading error whereby the last HETATM record is sometimes not read from the PDB file. Added: trunk/test_suite/shared_data/structures/bug_23293_missing_hetatm.pdb Modified: trunk/test_suite/system_tests/structure.py Added: trunk/test_suite/shared_data/structures/bug_23293_missing_hetatm.pdb URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/shared_data/structures/bug_23293_missing_hetatm.pdb?rev=27667&view=auto ============================================================================== --- trunk/test_suite/shared_data/structures/bug_23293_missing_hetatm.pdb (added) +++ trunk/test_suite/shared_data/structures/bug_23293_missing_hetatm.pdb Thu Feb 19 14:22:50 2015 @@ -0,0 +1,27 @@ +HET CA A 501 1 +HET CA A 502 1 +HET CA B 503 1 +HET CA B 504 1 +HET CA B 505 1 +HET CA B 506 1 +HETNAM CA UNKNOWN +FORMUL 1 CA CA1 +MODEL 1 +ATOM 1 N LEU A 1 1.000 -2.000 20.000 1.00 0.00 N +ATOM 2 H LEU A 1 2.000 -2.000 20.000 1.00 0.00 H +TER 3 LEU A 1 +HETATM 4 CA CA A 501 17.000 12.000 14.000 1.00 0.00 CA +HETATM 5 CA CA A 502 6.000 9.000 14.000 1.00 0.00 CA +ATOM 6 N LEU B 1 9.000 -9.000 27.000 1.00 0.00 N +ATOM 7 H LEU B 1 8.000 -8.000 27.000 1.00 0.00 H +TER 8 LEU B 1 +HETATM 9 CA CA B 503 17.000 12.000 14.000 1.00 0.00 CA +HETATM 10 CA CA B 504 6.000 9.000 14.000 1.00 0.00 CA +ATOM 11 N LEU C 1 12.000 -12.000 7.000 1.00 0.00 N +ATOM 12 H LEU C 1 11.000 -12.000 7.000 1.00 0.00 H +TER 13 LEU C 1 +HETATM 14 CA CA C 505 31.000 -10.000 -0.000 1.00 0.00 CA +HETATM 15 CA CA C 506 31.000 -19.000 6.000 1.00 0.00 CA +ENDMDL +MASTER 0 0 6 0 0 0 0 0 12 3 0 0 +END Modified: trunk/test_suite/system_tests/structure.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/structure.py?rev=27667&r1=27666&r2=27667&view=diff ============================================================================== --- trunk/test_suite/system_tests/structure.py (original) +++ trunk/test_suite/system_tests/structure.py Thu Feb 19 14:22:50 2015 @@ -831,6 +831,58 @@ "ATOM 1 N Phe A 1 1.000 1.000 1.000 1.00 0.00 N \n", "TER 2 Phe A 1 \n", "MASTER 0 0 0 0 0 0 0 0 1 1 0 0 \n", + "END \n" + ] + + # Check the created PDB file. + lines = file.readlines() + self.strip_remarks(lines) + self.assertEqual(len(contents), len(lines)) + for i in range(len(lines)): + self.assertEqual(contents[i], lines[i]) + + + def test_bug_23293_missing_hetatm(self): + """Catch U{bug #23293<https://gna.org/bugs/?23293>}, the PDB HETATM loading error whereby the last HETATM record is sometimes not read from the PDB file.""" + + # Path of the structure file. + path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' + + # Load the file. + self.interpreter.structure.read_pdb('bug_23293_missing_hetatm.pdb', dir=path) + + # Create a PDB file. + file = DummyFileObject() + self.interpreter.structure.write_pdb(file=file, force=True) + + # The file contents, without remarks, as they should be. + contents = [ + "HET CA A 501 1 \n", + "HET CA A 502 1 \n", + "HET CA B 503 1 \n", + "HET CA B 504 1 \n", + "HET CA B 505 1 \n", + "HET CA B 506 1 \n", + "HETNAM CA UNKNOWN \n", + "FORMUL 1 CA CA1 \n", + "MODEL 1 \n", + "ATOM 1 N LEU A 1 1.000 -2.000 20.000 1.00 0.00 N \n", + "ATOM 2 H LEU A 1 2.000 -2.000 20.000 1.00 0.00 H \n", + "TER 3 LEU A 1 \n", + "HETATM 4 CA CA A 501 17.000 12.000 14.000 1.00 0.00 CA \n", + "HETATM 5 CA CA A 502 6.000 9.000 14.000 1.00 0.00 CA \n", + "ATOM 6 N LEU B 1 9.000 -9.000 27.000 1.00 0.00 N \n", + "ATOM 7 H LEU B 1 8.000 -8.000 27.000 1.00 0.00 H \n", + "TER 8 LEU B 1 \n", + "HETATM 9 CA CA B 503 17.000 12.000 14.000 1.00 0.00 CA \n", + "HETATM 10 CA CA B 504 6.000 9.000 14.000 1.00 0.00 CA \n", + "ATOM 11 N LEU C 1 12.000 -12.000 7.000 1.00 0.00 N \n", + "ATOM 12 H LEU C 1 11.000 -12.000 7.000 1.00 0.00 H \n", + "TER 13 LEU C 1 \n", + "HETATM 14 CA CA C 505 31.000 -10.000 -0.000 1.00 0.00 CA \n", + "HETATM 15 CA CA C 506 31.000 -19.000 6.000 1.00 0.00 CA \n", + "ENDMDL \n", + "MASTER 0 0 6 0 0 0 0 0 12 3 0 0 \n", "END \n" ]