PDB rotation along parallel axis using biopython
1
2
Entering edit mode
8.4 years ago
Mateusz ▴ 70

Hi,

I am trying to do random rotation of a structure in a PDB file. I am using for that rotaxis from Bio.PDB module. Everything works fine if center of the structure lies in the beginning of the coordinate system. To rotate such structure along "X" axis by 90 degrees I am using:

rotaxis(90, Vector(1,0,0))

Problem starts if center of the structure lies outside the center of coordinate system. If structure center is defined by let's say coordinates (-10,20,44) using:

rotaxis(90, Vector(-9,20,44))

returns false result.

Does anyone know how to define custom rotation axis parallel to x / y / z?

Thank you in advance!

BIOPYTHON rotation PDB vector • 4.9k views
ADD COMMENT
0
Entering edit mode

Could you please add the code for how you determine the structure center? Also, which structure are you using?

ADD REPLY
1
Entering edit mode
8.3 years ago
Felix_Sim ▴ 260

I have attempted to solve your problem; although, your question did not provide me with a lot of information.

The following code reads a pdb structure (1eaz in this case) and rotates it 90 degrees around your provided vector.

from Bio.PDB import *
import numpy

# Parse the structure file
structure = PDBParser().get_structure("1eaz", "1eaz.pdb")[0]

# Iterate through all atoms and rotate by 90 degress
rotation_matrix = rotaxis2m(90, Vector(-9,20,44))

translation_matrix = numpy.array((0, 0, 0), 'f')
for atom in structure.get_atoms():
    atom.transform(rotation_matrix, translation_matrix)

io = PDBIO()
io.set_structure(structure)
io.save("1eaz_rotated.pdb")
ADD COMMENT
0
Entering edit mode

90 degrees should be 3.14/2. rotaxis2m take in radian.

ADD REPLY

Login before adding your answer.

Traffic: 2006 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6