# [Chimera-users] translation and rotation in MATLAB using transformation matrices from chimera

Tom Goddard goddard at sonic.net
Mon May 8 12:07:36 PDT 2017

```Hi Oleksiy,

I’m not sure the cause of your MATLAB positioning problem, but here is an explanation of the Chimera matrices that may be helpful.

First the Chimera command matrixget gives the position in the Chimera scene including any mouse rotation and translation you did to view the models.  So you would have to consider positioning matrices for both maps.  Even when you first open the maps and don’t move them, then fit one in the other, both maps probably have non-zero translations since the initial centering of the view on the first map does a translation.  So using matrixget is not a good way to get the position of one map relative to another, unless you are going to invert one of the matrices and multiply times the other.  Instead use the “measure rotation” command (e.g. measure rotation #0 #1) which reports a matrix in the reply log giving the motion of map #1 relative to the coordinates of map #2.

Another thing to be aware of is that these 3x4 matrices contain a rotation (the first 3 columns) and a translation (4th column) and the rotation is applied first, followed by the translation.  The rotation is about center x,y,z = (0,0,0) but that is not necessarily grid point i=j=k=0 because the MRC file can have an origin offset.  If you look in the Chimera volume viewer dialog coordinates panel (volume viewer menu Features / Coordinates) the origin grid index is given as “Origin index”.  That is the grid point the rotation is centered on.

Tom

> On Apr 24, 2017, at 9:30 AM, Oleksiy Kovtun <okovtun at mrc-lmb.cam.ac.uk> wrote:
>
>
>
>
>
> Dear all,
> I need to merge two maps in MATLAB using
> alignment data from chimera. Inputs:  two maps of the same box size, origin. I use matrixget -  to report translation and rotation
> matrices for the aligned map . Translation operation works well when transferred into MATLAB (briefly, translation matrix gets converted in eulers and pased on to tom_rotate command in MATLAB, TOM package). However the x y z translation coordinates (the fourth column top to bottom in matrixget - output) are way off the real translation when using tom_shift command in MATLAB, TOM.
> I found out that if I open the rotated map
> and fit it again, it gives close to correct translation
> matrix.
>
> What's going wrong here? Does anyone have a
> solution how to overlay 3D arrays in MATLAB using chimera-reported transformation matrices?
>
> Many
> thanks,
> Oleksiy
>
>
>
> Dr Oleksiy Kovtun
>
> Research Fellow
>
> Briggs group
>
> MRC Laboratory of Molecular Biology
>
> Francis Crick Avenue
>
> Cambridge
>
> CB2 0QH
>
> UK
>
>
>
> Tel: + 44 1223 267551
>
> Email: okovtun at mrc-lmb.cam.ac.uk
>
>
>
> Dr Oleksiy Kovtun
> Research Fellow
> Briggs group
> MRC Laboratory of Molecular Biology
> Francis Crick Avenue
> Cambridge
> CB2 0QH
> UK
>
> Tel: + 44 1223 267551
> Email: okovtun at mrc-lmb.cam.ac.uk
>
> <untitled-[2].html>_______________________________________________
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu
> Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20170508/9b578dc1/attachment.html>
```