## jmol-users

 [Jmol-users] Applying rotation and translation matrices from alignment programs From: Daniel Lundin - 2009-12-21 16:41:37 ```Hi, I'm new to the list, but have searched the net for a couple of days for hints as to solve the below described problem, but to no avail. In brief, I have plenty of rotation matrices and translation vectors mainly from EBI's SSM service, but also from the Dali protein structure aligner. What I'd like to do is take any pair of structures, look up the rotation matrix and translation vector for the target structure and view the query and target superposed in Jmol. After reading what I could find about quaternions, I have tried the approach below (which is SSM data, but Dali matrices/vectors fail also), but the second structure ends up far away from the first. Whether it's rotated correctly or not, I don't know for sure, but it seems to be close at least. The loaded structure files are straight from PDB. \$ show _version _version = 1109011 \$ load 1mxr.pdb \$ select * \$ cpk off \$ wireframe off \$ select :A \$ cartoon \$ colour blue \$ appendNew=true \$ load append 1afr.pdb \$ frame * \$ select */2 \$ cpk off \$ wireframe off \$ select :C/2 \$ cartoon \$ colour red \$ r = [ [ 0.49441794888, 0.6513774372, -0.5755504549 ], [ 0.68161107155, -0.70143415565, -0.20831819995 ], [ -0.53940452257, -0.28930530516, -0.79078770946 ] ] \$ rq = quaternion(r.col(1), r.col(2)) \$ t = { 24.48061828, 16.111736935, 99.953849304 } \$ rotateSelected @rq \$ translateSelected @t I have also tried applying the matrix/vector to the first (query) structure. Does anyone know what the problem is? /D -- Daniel Lundin Department of Molecular Biology & Functional Genomics Arrhenius Laboratories for Natural Sciences Stockholm University, SE-106 91 Stockholm, Sweden tel. +46 (0)8 16 41 95, mobile: +46 (0)708 123 922, fax. +46 (0)8 16 64 88 Email: daniel.lundin@... ```
 Re: [Jmol-users] Applying rotation and translation matrices from alignment programs From: Robert Hanson - 2009-12-21 18:51:36 Attachments: Message as HTML ```Daniel, first, it's important to have the two brackets without whitespace: [[ not [ [ I know, why should that be, right? .... second, for rotateSelected you need to indicate that you want a MOLECULAR rotation, not one that is defined by the window. The code is: r = [[ 0.49441794888, 0.6513774372, -0.5755504549 ], [0.68161107155, -0.70143415565, -0.20831819995 ], [ -0.53940452257,-0.28930530516, -0.79078770946 ]] rq = quaternion(r) t = { 24.48061828, 16.111736935, 99.953849304 } rotateSelected MOLECULAR @rq translateSelected @t On Mon, Dec 21, 2009 at 10:25 AM, Daniel Lundin wrote: > Hi, > > I'm new to the list, but have searched the net for a couple of days for > hints as to solve the below described problem, but to no avail. In > brief, I have plenty of rotation matrices and translation vectors mainly > from EBI's SSM service, but also from the Dali protein structure > aligner. What I'd like to do is take any pair of structures, look up the > rotation matrix and translation vector for the target structure and view > the query and target superposed in Jmol. After reading what I could find > about quaternions, I have tried the approach below (which is SSM data, > but Dali matrices/vectors fail also), but the second structure ends up > far away from the first. Whether it's rotated correctly or not, I don't > know for sure, but it seems to be close at least. The loaded structure > files are straight from PDB. > > \$ show _version > _version = 1109011 > \$ load 1mxr.pdb > \$ select * > \$ cpk off > \$ wireframe off > \$ select :A > \$ cartoon > \$ colour blue > \$ appendNew=true > \$ load append 1afr.pdb > \$ frame * > \$ select */2 > \$ cpk off > \$ wireframe off > \$ select :C/2 > \$ cartoon > \$ colour red > \$ r = [ [ 0.49441794888, 0.6513774372, -0.5755504549 ], [ > 0.68161107155, -0.70143415565, -0.20831819995 ], [ -0.53940452257, > -0.28930530516, -0.79078770946 ] ] > \$ rq = quaternion(r.col(1), r.col(2)) > \$ t = { 24.48061828, 16.111736935, 99.953849304 } > \$ rotateSelected @rq > \$ translateSelected @t > > I have also tried applying the matrix/vector to the first (query) > structure. Does anyone know what the problem is? > > /D > > -- > Daniel Lundin > > Department of Molecular Biology & Functional Genomics > Arrhenius Laboratories for Natural Sciences > Stockholm University, SE-106 91 Stockholm, Sweden > > tel. +46 (0)8 16 41 95, mobile: +46 (0)708 123 922, fax. +46 (0)8 16 64 88 > > Email: daniel.lundin@... > > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and > easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Jmol-users mailing list > Jmol-users@... > https://lists.sourceforge.net/lists/listinfo/jmol-users > -- Robert M. Hanson Professor of Chemistry St. Olaf College 1520 St. Olaf Ave. Northfield, MN 55057 http://www.stolaf.edu/people/hansonr phone: 507-786-3107 If nature does not answer first what we want, it is better to take what answer we get. -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900 ```
 Re: [Jmol-users] Applying rotation and translation matrices from alignment programs From: Daniel Lundin - 2009-12-21 20:13:05 ```Robert Hanson skrev: Thanks a lot for your quick reply. > Daniel, > > first, it's important to have the two brackets without whitespace: > > [[ > > not > > [ [ > > I know, why should that be, right? .... > Well, I don't have a clue ;-) And whitespace seems to work fine... (On a similar note, I must confess that I don't really understand why one should sometimes use straight brackets and othertimes curly, though I'm guessing that the former is for matrices, while the other's for vectors.) > second, for rotateSelected you need to indicate that you want a MOLECULAR > rotation, not one that is defined by the window. > > The code is: > > > r = [[ 0.49441794888, 0.6513774372, -0.5755504549 ], [0.68161107155, > -0.70143415565, -0.20831819995 ], [ > > -0.53940452257,-0.28930530516, -0.79078770946 ]] > rq = quaternion(r) Nice that one doesn't need the r.col(1), r.col(2) construct I found in a quite recent list discussion. It made me nervous that I was throwing away something. > t = { 24.48061828, 16.111736935, 99.953849304 } > rotateSelected MOLECULAR @rq > translateSelected @t > Thanks a lot, that works perfectly. /Daniel > > > On Mon, Dec 21, 2009 at 10:25 AM, Daniel Lundin > wrote: > >> Hi, >> >> I'm new to the list, but have searched the net for a couple of days for >> hints as to solve the below described problem, but to no avail. In >> brief, I have plenty of rotation matrices and translation vectors mainly >> from EBI's SSM service, but also from the Dali protein structure >> aligner. What I'd like to do is take any pair of structures, look up the >> rotation matrix and translation vector for the target structure and view >> the query and target superposed in Jmol. After reading what I could find >> about quaternions, I have tried the approach below (which is SSM data, >> but Dali matrices/vectors fail also), but the second structure ends up >> far away from the first. Whether it's rotated correctly or not, I don't >> know for sure, but it seems to be close at least. The loaded structure >> files are straight from PDB. >> >> \$ show _version >> _version = 1109011 >> \$ load 1mxr.pdb >> \$ select * >> \$ cpk off >> \$ wireframe off >> \$ select :A >> \$ cartoon >> \$ colour blue >> \$ appendNew=true >> \$ load append 1afr.pdb >> \$ frame * >> \$ select */2 >> \$ cpk off >> \$ wireframe off >> \$ select :C/2 >> \$ cartoon >> \$ colour red >> \$ r = [ [ 0.49441794888, 0.6513774372, -0.5755504549 ], [ >> 0.68161107155, -0.70143415565, -0.20831819995 ], [ -0.53940452257, >> -0.28930530516, -0.79078770946 ] ] >> \$ rq = quaternion(r.col(1), r.col(2)) >> \$ t = { 24.48061828, 16.111736935, 99.953849304 } >> \$ rotateSelected @rq >> \$ translateSelected @t >> >> I have also tried applying the matrix/vector to the first (query) >> structure. Does anyone know what the problem is? >> >> /D >> >> -- >> Daniel Lundin >> >> Department of Molecular Biology & Functional Genomics >> Arrhenius Laboratories for Natural Sciences >> Stockholm University, SE-106 91 Stockholm, Sweden >> >> tel. +46 (0)8 16 41 95, mobile: +46 (0)708 123 922, fax. +46 (0)8 16 64 88 >> >> Email: daniel.lundin@... >> >> >> ------------------------------------------------------------------------------ >> This SF.Net email is sponsored by the Verizon Developer Community >> Take advantage of Verizon's best-in-class app development support >> A streamlined, 14 day to market process makes app distribution fast and >> easy >> Join now and get one step closer to millions of Verizon customers >> http://p.sf.net/sfu/verizon-dev2dev >> _______________________________________________ >> Jmol-users mailing list >> Jmol-users@... >> https://lists.sourceforge.net/lists/listinfo/jmol-users >> > > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > > > ------------------------------------------------------------------------ > > _______________________________________________ > Jmol-users mailing list > Jmol-users@... > https://lists.sourceforge.net/lists/listinfo/jmol-users -- Daniel Lundin Department of Molecular Biology & Functional Genomics Arrhenius Laboratories for Natural Sciences Stockholm University, SE-106 91 Stockholm, Sweden tel. +46 (0)8 16 41 95, mobile: +46 (0)708 123 922, fax. +46 (0)8 16 64 88 Email: daniel.lundin@... ```
 Re: [Jmol-users] Applying rotation and translation matrices from alignment programs From: Robert Hanson - 2009-12-21 20:28:48 Attachments: Message as HTML ```On Mon, Dec 21, 2009 at 1:43 PM, Daniel Lundin wrote: > Robert Hanson skrev: > > Thanks a lot for your quick reply. > > > Daniel, > > > > first, it's important to have the two brackets without whitespace: > > > > [[ > > > > not > > > > [ [ > > > > I know, why should that be, right? .... > > > Well, I don't have a clue ;-) And whitespace seems to work fine... > > (I was wrong about that --- nevermind!) > (On a similar note, I must confess that I don't really understand why > one should sometimes use straight brackets and othertimes curly, though > I'm guessing that the former is for matrices, while the other's for > vectors.) > > yeah, that's a bit tricky. { } are used for several things. Could be a point or vector {x y z}, x = {1.0 3.0 2.0} could be a quaternion: \$ show orientation rotation {0.74129415 0.006376769 -0.33657235 0.580656} could be a set of atoms if in a math context: \$ print {*/2.1} ({6461:23786}) \$ select {*/2.1} 17,326 atoms selected after an '@' it is a math expression embedded in a standard command: load @{"c:/temp/" + filename} Pretty much unambiguous. > Nice that one doesn't need the r.col(1), r.col(2) construct I found in a > quite recent list discussion. It made me nervous that I was throwing > away something. > > The rotational matrix only needs 6 elements; the others are redundant. The columns of the vectors are the transformed X, Y, and Z vectors, so if you have two you can always get the third. > > t = { 24.48061828, 16.111736935, 99.953849304 } > > rotateSelected MOLECULAR @rq > > translateSelected @t > > > Thanks a lot, that works perfectly. > > Oh, good! > /Daniel > > > > > > On Mon, Dec 21, 2009 at 10:25 AM, Daniel Lundin > > wrote: > > > >> Hi, > >> > >> I'm new to the list, but have searched the net for a couple of days for > >> hints as to solve the below described problem, but to no avail. In > >> brief, I have plenty of rotation matrices and translation vectors mainly > >> from EBI's SSM service, but also from the Dali protein structure > >> aligner. What I'd like to do is take any pair of structures, look up the > >> rotation matrix and translation vector for the target structure and view > >> the query and target superposed in Jmol. After reading what I could find > >> about quaternions, I have tried the approach below (which is SSM data, > >> but Dali matrices/vectors fail also), but the second structure ends up > >> far away from the first. Whether it's rotated correctly or not, I don't > >> know for sure, but it seems to be close at least. The loaded structure > >> files are straight from PDB. > >> > >> \$ show _version > >> _version = 1109011 > >> \$ load 1mxr.pdb > >> \$ select * > >> \$ cpk off > >> \$ wireframe off > >> \$ select :A > >> \$ cartoon > >> \$ colour blue > >> \$ appendNew=true > >> \$ load append 1afr.pdb > >> \$ frame * > >> \$ select */2 > >> \$ cpk off > >> \$ wireframe off > >> \$ select :C/2 > >> \$ cartoon > >> \$ colour red > >> \$ r = [ [ 0.49441794888, 0.6513774372, -0.5755504549 ], [ > >> 0.68161107155, -0.70143415565, -0.20831819995 ], [ -0.53940452257, > >> -0.28930530516, -0.79078770946 ] ] > >> \$ rq = quaternion(r.col(1), r.col(2)) > >> \$ t = { 24.48061828, 16.111736935, 99.953849304 } > >> \$ rotateSelected @rq > >> \$ translateSelected @t > >> > >> I have also tried applying the matrix/vector to the first (query) > >> structure. Does anyone know what the problem is? > >> > >> /D > >> > >> -- > >> Daniel Lundin > >> > >> Department of Molecular Biology & Functional Genomics > >> Arrhenius Laboratories for Natural Sciences > >> Stockholm University, SE-106 91 Stockholm, Sweden > >> > >> tel. +46 (0)8 16 41 95, mobile: +46 (0)708 123 922, fax. +46 (0)8 16 64 > 88 > >> > >> Email: daniel.lundin@... > >> > >> > >> > ------------------------------------------------------------------------------ > >> This SF.Net email is sponsored by the Verizon Developer Community > >> Take advantage of Verizon's best-in-class app development support > >> A streamlined, 14 day to market process makes app distribution fast and > >> easy > >> Join now and get one step closer to millions of Verizon customers > >> http://p.sf.net/sfu/verizon-dev2dev > >> _______________________________________________ > >> Jmol-users mailing list > >> Jmol-users@... > >> https://lists.sourceforge.net/lists/listinfo/jmol-users > >> > > > > > > > > > > ------------------------------------------------------------------------ > > > > > ------------------------------------------------------------------------------ > > This SF.Net email is sponsored by the Verizon Developer Community > > Take advantage of Verizon's best-in-class app development support > > A streamlined, 14 day to market process makes app distribution fast and > easy > > Join now and get one step closer to millions of Verizon customers > > http://p.sf.net/sfu/verizon-dev2dev > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Jmol-users mailing list > > Jmol-users@... > > https://lists.sourceforge.net/lists/listinfo/jmol-users > > > -- > Daniel Lundin > > Department of Molecular Biology & Functional Genomics > Arrhenius Laboratories for Natural Sciences > Stockholm University, SE-106 91 Stockholm, Sweden > > tel. +46 (0)8 16 41 95, mobile: +46 (0)708 123 922, fax. +46 (0)8 16 64 88 > > Email: daniel.lundin@... > > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and > easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Jmol-users mailing list > Jmol-users@... > https://lists.sourceforge.net/lists/listinfo/jmol-users > -- Robert M. Hanson Professor of Chemistry St. Olaf College 1520 St. Olaf Ave. Northfield, MN 55057 http://www.stolaf.edu/people/hansonr phone: 507-786-3107 If nature does not answer first what we want, it is better to take what answer we get. -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900 ```