mailr27337 - /trunk/test_suite/system_tests/structure.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on January 28, 2015 - 11:48:
Author: bugman
Date: Wed Jan 28 11:48:50 2015
New Revision: 27337

URL: http://svn.gna.org/viewcvs/relax?rev=27337&view=rev
Log:
Created the Structure.test_align_molecules2 system test.

This is to demonstrate a failure condition in the structure.align user 
function.


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=27337&r1=27336&r2=27337&view=diff
==============================================================================
--- trunk/test_suite/system_tests/structure.py  (original)
+++ trunk/test_suite/system_tests/structure.py  Wed Jan 28 11:48:50 2015
@@ -339,6 +339,39 @@
             self.assertAlmostEqual(pos[0][1], data[i][4])
             self.assertAlmostEqual(pos[0][2], data[i][5])
             i += 1
+
+
+    def test_align_molecules2(self):
+        """Test of the structure.align user function, fitting to the mean 
structure."""
+
+        # Path of the structure file.
+        path = status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam'
+
+        # Load the two rotated structures.
+        self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, 
set_model_num=1, set_mol_name='CaM A')
+        self.interpreter.structure.read_pdb('1J7P_1st_NH_rot.pdb', dir=path, 
set_model_num=1, set_mol_name='CaM B')
+
+        # Add an atom that should not be superimposed.
+        self.interpreter.structure.add_atom(mol_name='CaM A', 
atom_name='Ti', res_name='TST', res_num=1, pos=[1.0, 2.0, 3.0], element='Ti', 
pdb_record='HETATM')
+        self.interpreter.structure.add_atom(mol_name='CaM B', 
atom_name='Ti', res_name='TST', res_num=1, pos=[2.0, 3.0, 4.0], element='Ti', 
pdb_record='HETATM')
+
+        # Superimpose the backbone heavy atoms.
+        self.interpreter.structure.align(method='fit to mean', 
atom_id='@N,C,CA,O', displace_id=':82-5000')
+
+        # Check that the two structures now have the same atomic coordinates.
+        mol1 = cdp.structure.structural_data[0].mol[0]
+        mol2 = cdp.structure.structural_data[0].mol[1]
+        for i in range(len(mol1.atom_name)):
+            if mol1.res_num[i] == 1:
+                continue
+            self.assertAlmostEqual(mol1.x[i], mol2.x[i], 2)
+            self.assertAlmostEqual(mol1.y[i], mol2.y[i], 2)
+            self.assertAlmostEqual(mol1.z[i], mol2.z[i], 2)
+
+        # The last atom must be different - it is not displaced.
+        self.assertAlmostEqual(mol1.x[-1] - mol2.x[-1], -1.0, 2)
+        self.assertAlmostEqual(mol1.y[-1] - mol2.y[-1], -1.0, 2)
+        self.assertAlmostEqual(mol1.z[-1] - mol2.z[-1], -1.0, 2)
 
 
     def test_align_CaM_BLOSUM62(self):




Related Messages


Powered by MHonArc, Updated Wed Jan 28 12:40:02 2015