[BioPython] transformation and PDBIO

Thomas Hamelryck thamelry at binf.ku.dk
Tue Jun 22 04:42:13 EDT 2004


On Tuesday 22 June 2004 10:05, Hua Wong wrote:

> Tried atom.transform(90,0)

atom.transform expects a right multiplying rotation matrix (3x3 
Numpy array) and a translation vector (size 3 Numpy array). 

> For example, how to tell him to do a rotation on one axis only?
> A 90° degree rotation on X for example?

Use the Vector module. The rotmat function calculates
a rotation matrix based on an axis and an angle.

rotation_90_around_X=rotmat(pi/2.0, Vector(1,0,0))
translation=array((1,0,0),  'f')

atom.transform(rotation_90_around_X, translation)

> Second part of my question is more PDBIO specific.
> I want to save only the part I modified...

That's explained in the FAQ:
 http://www.biopython.org/docs/cookbook/biopdb_faq.pdf

Basically, you need to make a subclass of the Select class,
and then use PDBIO.

Cheers,

-Thomas




More information about the BioPython mailing list