[BioPython] Bio.PDB rotate/translate

Douglas Kojetin douglas.kojetin at gmail.com
Wed Aug 15 18:30:41 UTC 2007


Hi All,

I would like to rotate a specific H and N vector in my structure  
file, so that it points in a different direction, but keep its  
location fixed in 3D space.  Here is what I've been working with, but  
it seems to move the atoms away from their original location.  I  
grabbed most of this from the Bio.PDB FAQ (the PDF file) and from the  
Bio.PDB documentation online.  I'm not sure if I should be using  
different values for the Vector/rotation line, or in the translation  
array, etc.

###
atom1 = structure[model.id][chain.id][residue.id[1]]['H']
atom2 = structure[model.id][chain.id][residue.id[1]]['N']

rotation = Bio.PDB.rotaxis( math.pi/2.0, Bio.PDB.Vector(1,0,0) )
translation = Numeric.array( (1,0,0), 'f' )

atom1.transform(rotation, translation)
atom2.transform(rotation, translation)
###

Thanks in advance for the help,

Doug




More information about the Biopython mailing list