[Chimera-users] Automatic Bond Rotating Script

Lisa Rohrwasser rohrwasser at thphys.uni-heidelberg.de
Tue Mar 29 08:27:53 PDT 2016


Hello,

I am currently trying to write a python script to rotate different bonds 
automatically many many times. The idea is to randomly chose a bond of a 
.pdb-File and rotate it by a certain angle.
In principle the command line tool "rotation" is exactly what I would 
like to use, but i have difficulties implementing it.

To start with rotating only one bond I already got:
import chimera
from chimera import runCommand as rc

opened = chimera.openModels.open('~/Documents/rho.pdb')

#open protein
rho = opened[0]

#get random bond (it is set to bond 10 for now)
b = rho.bonds[10]

#gives back both atoms corresponding to the bond (atom IDs are needed 
for command line tool "rotation")
b.atoms

#select bond-atoms
a1 = b.atoms[0]
a2 = b.atoms[1]

#now i would like to use command line tool "rotation", which gives many 
errors
rc("rotation a1 a2 <angle>")

So i think the problems are
1) objects a1, a2 have the wrong datatype
2) rc does not have access to a1, a2

Now i wonder if there is a solution at all to these problems or if i 
have to think of a completely different way?

Thanks in advance,
Lisa


More information about the Chimera-users mailing list