From: Christoph G. <cg...@uc...> - 2010-05-30 18:22:49
|
On 5/29/2010 8:21 AM, J. Fleming wrote: > Hello, > > I've been using 'super' to align the C-alphas within one domain of two > different models of the same protein while leaving the second domain > to move freely. I can do this using: > > super (A and resid 1-100 and name ca), (B and resid 1-100 and name ca) > > What I would like to do is determine the rotation and translation of > model B's second domain as it moves away from A's second domain. > > I can output a matrix after running super using: > > print cmd.get_object_matrix("A") > > How do I go from the matrix to an angle and distance? > > Thanks for any thoughts, > Jon > To extract Euler rotation angles from the superimposition matrix you can use the euler_from_matrix function of the transformations.py module at <http://www.lfd.uci.edu/~gohlke/code/transformations.py.html>. If you rather have a rotation angle and axis use the rotation_from_matrix function. You might have to use the transpose of the matrix returned by PyMOL, not sure. The extraction of the translation vector has already been explained. To find how domain #2 is translated and rotated in molecule B relative to A when the domains #1 of A and B are superimposed, you can write a Python script outside of PyMOL. The following untested (!) script assumes that you have (1) the C-alpha coordinates of molecule A and B as homogeneous coordinate numpy arrays of shape (4, *), and (2) the C-alpha atom indices that belong to domain 1 and 2 as Python sequences or slices: import numpy import transformations # transform B such that domain1 of A and B overlap S0 = transformations.superimposition_matrix( B[:, domain1], A[:, domain1]) B = numpy.dot(S0, B) # calculate matrix to transform domain2 of A to B S1 = transformations.superimposition_matrix( A[:, domain2], B[:, domain2]) # extract translation vector and Euler rotation angles from S1 translation = S1[:3, 3].copy() eulerangles = transformations.euler_from_matrix(S1) -- Christoph |