Author: bugman
Date: Thu Feb 19 15:25:40 2015
New Revision: 27676

URL: http://svn.gna.org/viewcvs/relax?rev=27676&view=rev
Log:
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.


Added:
    trunk/test_suite/shared_data/structures/multi_model_and_mol_test.pdb
Modified:
    trunk/test_suite/system_tests/structure.py

Added: trunk/test_suite/shared_data/structures/multi_model_and_mol_test.pdb
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/shared_data/structures/multi_model_and_mol_test.pdb?rev=27676&view=auto
==============================================================================
--- trunk/test_suite/shared_data/structures/multi_model_and_mol_test.pdb        
(added)
+++ trunk/test_suite/shared_data/structures/multi_model_and_mol_test.pdb        
Thu Feb 19 15:25:40 2015
@@ -0,0 +1,24 @@
+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                                                     
 
+ATOM      4  N   LEU B   1       9.000  -9.000  27.000  1.00  0.00           N 
 
+ATOM      5  H   LEU B   1       8.000  -8.000  27.000  1.00  0.00           H 
 
+TER       6      LEU B   1                                                     
 
+ATOM      7  N   LEU C   1      12.000 -12.000   7.000  1.00  0.00           N 
 
+ATOM      8  H   LEU C   1      11.000 -12.000   7.000  1.00  0.00           H 
 
+TER       9      LEU C   1                                                     
 
+ENDMDL                                                                         
 
+MODEL        2                                                                 
 
+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                                                     
 
+ATOM      4  N   LEU B   1       9.000  -9.000  27.000  1.00  0.00           N 
 
+ATOM      5  H   LEU B   1       8.000  -8.000  27.000  1.00  0.00           H 
 
+TER       6      LEU B   1                                                     
 
+ATOM      7  N   LEU C   1      12.000 -12.000   7.000  1.00  0.00           N 
 
+ATOM      8  H   LEU C   1      11.000 -12.000   7.000  1.00  0.00           H 
 
+TER       9      LEU C   1                                                     
 
+ENDMDL                                                                         
 
+MASTER        0    0    0    0    0    0    0    0    6    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=27676&r1=27675&r2=27676&view=diff
==============================================================================
--- trunk/test_suite/system_tests/structure.py  (original)
+++ trunk/test_suite/system_tests/structure.py  Thu Feb 19 15:25:40 2015
@@ -3930,6 +3930,55 @@
         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)
+
+        # 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."""
 


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
[email protected]

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits

Reply via email to