Author: bugman Date: Fri Feb 20 09:26:53 2015 New Revision: 27678 URL: http://svn.gna.org/viewcvs/relax?rev=27678&view=rev Log: Merged revisions 27676-27677 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r27676 | bugman | 2015-02-19 15:25:40 +0100 (Thu, 19 Feb 2015) | 6 lines Created the Structure.test_multi_model_and_multi_molecule system test. This is used to check the loading and writing of a multi-model and multi-molecule PDB file. The test shows that this functions correctly. ........ r27677 | bugman | 2015-02-19 15:38:54 +0100 (Thu, 19 Feb 2015) | 5 lines Modified the Structure.test_multi_model_and_multi_molecule test to check for model consistency. This is just for better test suite coverage of the handling of PDB structural data. ........ Added: branches/nmrglue/test_suite/shared_data/structures/multi_model_and_mol_test.pdb - copied unchanged from r27677, trunk/test_suite/shared_data/structures/multi_model_and_mol_test.pdb Modified: branches/nmrglue/ (props changed) branches/nmrglue/test_suite/system_tests/structure.py Propchange: branches/nmrglue/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Fri Feb 20 09:26:53 2015 @@ -1 +1 @@ -/trunk:1-27673 +/trunk:1-27677 Modified: branches/nmrglue/test_suite/system_tests/structure.py URL: http://svn.gna.org/viewcvs/relax/branches/nmrglue/test_suite/system_tests/structure.py?rev=27678&r1=27677&r2=27678&view=diff ============================================================================== --- branches/nmrglue/test_suite/system_tests/structure.py (original) +++ branches/nmrglue/test_suite/system_tests/structure.py Fri Feb 20 09:26:53 2015 @@ -3930,6 +3930,58 @@ self.assertEqual(cdp.structure.sheets[1], sheets[1]) + def test_multi_model_and_multi_molecule(self): + """Test the loading and writing of a multi-model and multi-molecule 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('multi_model_and_mol_test.pdb', dir=path) + + # Check the model consistency. + cdp.structure.validate_models() + + # 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 = [ + "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", + "ATOM 4 N LEU B 1 9.000 -9.000 27.000 1.00 0.00 N \n", + "ATOM 5 H LEU B 1 8.000 -8.000 27.000 1.00 0.00 H \n", + "TER 6 LEU B 1 \n", + "ATOM 7 N LEU C 1 12.000 -12.000 7.000 1.00 0.00 N \n", + "ATOM 8 H LEU C 1 11.000 -12.000 7.000 1.00 0.00 H \n", + "TER 9 LEU C 1 \n", + "ENDMDL \n", + "MODEL 2 \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", + "ATOM 4 N LEU B 1 9.000 -9.000 27.000 1.00 0.00 N \n", + "ATOM 5 H LEU B 1 8.000 -8.000 27.000 1.00 0.00 H \n", + "TER 6 LEU B 1 \n", + "ATOM 7 N LEU C 1 12.000 -12.000 7.000 1.00 0.00 N \n", + "ATOM 8 H LEU C 1 11.000 -12.000 7.000 1.00 0.00 H \n", + "TER 9 LEU C 1 \n", + "ENDMDL \n", + "MASTER 0 0 0 0 0 0 0 0 6 3 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_pdb_combined_secondary_structure(self): """Test the handling of secondary structure metadata when combining multiple PDB structures."""