## Re: [PyMOL] PyMol question?

 Re: [PyMOL] PyMol question? From: Tsjerk Wassenaar - 2006-07-03 08:25:44 ```Hi, You can do this using alter_state: alter_state 1,selection,(x,y,z) = (a11*x+a12*y+a13*z+d1, a21*x+a22*y+a23*z+d2, a31*x+a32*y+a33*z+d3) where a11-a33 are the matrix elements (check whether they have to be transposed) and d1-d3 are the elements of the shift vector. It may be convenient to make this a function which you can load at startup time (especially if you have to do this many times). For example, paste the following in a file mtransform.py: from pymol import cmd def mtransform( selection="all", matrix=[[1,0,0],[0,1,0],[0,0,1],[0,0,0]] ): if ( len(matrix) == 3 ): # In this way it is also valid to give a 3x3 matrix for rotation only matrix.append( [0,0,0] ) a11, a12, a13 = matrix[0][0], matrix[0][1], matrix[0][2] a21, a22, a23 = matrix[1][0], matrix[1][1], matrix[1][2] a31, a32, a33 = matrix[2][0], matrix[2][1], matrix[2][2] d1, d2, d3 = matrix[0][0], matrix[0][1], matrix[0][2] cmd.alter_state( 1, selection, "(x,y,z) = (%f*x+%f*y+%f*z+%f, %f*x+%f*y+%f*z+%f, %f*x+%f*y+%f*z+%f )" % (a11,a12,a13,d1,a21,a22,a23,d2,a31,a32,a33,d3) #============ Of course it could be done more efficiently, better looking, but that is left as an exercise for the reader ;) (Think of changing coordinates directly, adding an option to make a copy of the selection first, and parse a string for the matrix, such that you can use cmd.extend and can run the command using: mtransform all, [[0,1,0],[-1,0,0],[0,0,1],[3,1,2]] rather than: mtransform("all", [[0,1,0],[-1,0,0],[0,0,1],[3,1,2]]) which is the way to invoke the command with the given code. Hope this helps, Tsjerk On 6/30/06, Peter Adrian Meyer wrote: > The easiest way I'm aware of to do this would be to use the ccp4 program > pdbset, but there are numerous other ways/programs that will do this (if > pymol has this capacity, I'm not aware of it; but someone else will > correct me). > > Pete > > > > >> I've been looking through the PyMol reference and wiki page and I can't > find a command for moving a molecule through a matrix, I > >> would like to move one pdb onto the other using the info below. Is > there such a command? > >> ## MATRICES: UX+T is the least-squares superimposition of STRID2 (X) > onto STRID1 > >> NR. STRID1 STRID2 U(.,1) U(.,2) U(., > >> 3) T(.) > >> 1: 9506-A 1ris U(1,.) -0.230692 -0.010007 > >> -0.972975 50.701385 > >> 1: 9506-A 1ris U(2,.) 0.443459 0.888979 > >> -0.114287 31.716473 > >> 1: 9506-A 1ris U(3,.) 0.866098 -0.457839 > >> -0.200643 26.479412 > > > > Pete Meyer > Fu Lab > BMCB grad student > Cornell University > > > > > > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > PyMOL-users mailing list > PyMOL-users@... > https://lists.sourceforge.net/lists/listinfo/pymol-users > -- Tsjerk A. Wassenaar, M.Sc. Groningen Biomolecular Sciences and Biotechnology Institute (GBB) Dept. of Biophysical Chemistry University of Groningen Nijenborgh 4 9747AG Groningen, The Netherlands +31 50 363 4336 ```

 Re: [PyMOL] PyMol question? From: William Scott - 2006-06-30 15:27:35 ```Hi Mark: Most likely there is, but I don't know the answer to your question. I'm posting this to the pymol users list (via cc) so hopefully someone else will know the answer. I trust all is going well for you. Bill On Jun 30, 2006, at 8:19 AM, Mark Collins wrote: > Hi Bill, > > I've been looking through the PyMol reference and wiki page and I > can't find a command for moving a molecule through a matrix, I > would like to move one pdb onto the other using the info below. Is > there such a command? > > ## MATRICES: UX+T is the least-squares superimposition of STRID2 > (X) onto STRID1 > NR. STRID1 STRID2 U(.,1) U(.,2) U(., > 3) T(.) > 1: 9506-A 1ris U(1,.) -0.230692 -0.010007 > -0.972975 50.701385 > 1: 9506-A 1ris U(2,.) 0.443459 0.888979 > -0.114287 31.716473 > 1: 9506-A 1ris U(3,.) 0.866098 -0.457839 > -0.200643 26.479412 > > Thanks Mark ```
 Re: [PyMOL] PyMol question? From: Peter Adrian Meyer - 2006-06-30 16:35:14 ```The easiest way I'm aware of to do this would be to use the ccp4 program pdbset, but there are numerous other ways/programs that will do this (if pymol has this capacity, I'm not aware of it; but someone else will correct me). Pete >> I've been looking through the PyMol reference and wiki page and I can't find a command for moving a molecule through a matrix, I >> would like to move one pdb onto the other using the info below. Is there such a command? >> ## MATRICES: UX+T is the least-squares superimposition of STRID2 (X) onto STRID1 >> NR. STRID1 STRID2 U(.,1) U(.,2) U(., >> 3) T(.) >> 1: 9506-A 1ris U(1,.) -0.230692 -0.010007 >> -0.972975 50.701385 >> 1: 9506-A 1ris U(2,.) 0.443459 0.888979 >> -0.114287 31.716473 >> 1: 9506-A 1ris U(3,.) 0.866098 -0.457839 >> -0.200643 26.479412 Pete Meyer Fu Lab BMCB grad student Cornell University ```
 Re: [PyMOL] PyMol question? From: Tsjerk Wassenaar - 2006-07-03 08:25:44 ```Hi, You can do this using alter_state: alter_state 1,selection,(x,y,z) = (a11*x+a12*y+a13*z+d1, a21*x+a22*y+a23*z+d2, a31*x+a32*y+a33*z+d3) where a11-a33 are the matrix elements (check whether they have to be transposed) and d1-d3 are the elements of the shift vector. It may be convenient to make this a function which you can load at startup time (especially if you have to do this many times). For example, paste the following in a file mtransform.py: from pymol import cmd def mtransform( selection="all", matrix=[[1,0,0],[0,1,0],[0,0,1],[0,0,0]] ): if ( len(matrix) == 3 ): # In this way it is also valid to give a 3x3 matrix for rotation only matrix.append( [0,0,0] ) a11, a12, a13 = matrix[0][0], matrix[0][1], matrix[0][2] a21, a22, a23 = matrix[1][0], matrix[1][1], matrix[1][2] a31, a32, a33 = matrix[2][0], matrix[2][1], matrix[2][2] d1, d2, d3 = matrix[0][0], matrix[0][1], matrix[0][2] cmd.alter_state( 1, selection, "(x,y,z) = (%f*x+%f*y+%f*z+%f, %f*x+%f*y+%f*z+%f, %f*x+%f*y+%f*z+%f )" % (a11,a12,a13,d1,a21,a22,a23,d2,a31,a32,a33,d3) #============ Of course it could be done more efficiently, better looking, but that is left as an exercise for the reader ;) (Think of changing coordinates directly, adding an option to make a copy of the selection first, and parse a string for the matrix, such that you can use cmd.extend and can run the command using: mtransform all, [[0,1,0],[-1,0,0],[0,0,1],[3,1,2]] rather than: mtransform("all", [[0,1,0],[-1,0,0],[0,0,1],[3,1,2]]) which is the way to invoke the command with the given code. Hope this helps, Tsjerk On 6/30/06, Peter Adrian Meyer wrote: > The easiest way I'm aware of to do this would be to use the ccp4 program > pdbset, but there are numerous other ways/programs that will do this (if > pymol has this capacity, I'm not aware of it; but someone else will > correct me). > > Pete > > > > >> I've been looking through the PyMol reference and wiki page and I can't > find a command for moving a molecule through a matrix, I > >> would like to move one pdb onto the other using the info below. Is > there such a command? > >> ## MATRICES: UX+T is the least-squares superimposition of STRID2 (X) > onto STRID1 > >> NR. STRID1 STRID2 U(.,1) U(.,2) U(., > >> 3) T(.) > >> 1: 9506-A 1ris U(1,.) -0.230692 -0.010007 > >> -0.972975 50.701385 > >> 1: 9506-A 1ris U(2,.) 0.443459 0.888979 > >> -0.114287 31.716473 > >> 1: 9506-A 1ris U(3,.) 0.866098 -0.457839 > >> -0.200643 26.479412 > > > > Pete Meyer > Fu Lab > BMCB grad student > Cornell University > > > > > > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > PyMOL-users mailing list > PyMOL-users@... > https://lists.sourceforge.net/lists/listinfo/pymol-users > -- Tsjerk A. Wassenaar, M.Sc. Groningen Biomolecular Sciences and Biotechnology Institute (GBB) Dept. of Biophysical Chemistry University of Groningen Nijenborgh 4 9747AG Groningen, The Netherlands +31 50 363 4336 ```