Bio.SVDSuperimposer package

Module contents

Align on protein structure onto another using SVD alignment.

SVDSuperimposer finds the best rotation and translation to put two point sets on top of each other (minimizing the RMSD). This is eg. useful to superimpose crystal structures. SVD stands for singular value decomposition, which is used in the algorithm.

class Bio.SVDSuperimposer.SVDSuperimposer

Bases: object

Class to run SVD alignment.

SVDSuperimposer finds the best rotation and translation to put two point sets on top of each other (minimizing the RMSD). This is eg. useful to superimpose crystal structures.

SVD stands for Singular Value Decomposition, which is used to calculate the superposition.

Reference:

Matrix computations, 2nd ed. Golub, G. & Van Loan, CF., The Johns Hopkins University Press, Baltimore, 1989

start with two coordinate sets (Nx3 arrays - float)

>>> from Bio.SVDSuperimposer import SVDSuperimposer
>>> from numpy import array, dot, set_printoptions
>>>
>>> x = array([[51.65, -1.90, 50.07],
...      [50.40, -1.23, 50.65],
...      [50.68, -0.04, 51.54],
...      [50.22, -0.02, 52.85]], 'f')
>>>
>>> y = array([[51.30, -2.99, 46.54],
...      [51.09, -1.88, 47.58],
...      [52.36, -1.20, 48.03],
...      [52.71, -1.18, 49.38]], 'f')

start

>>> sup = SVDSuperimposer()

set the coords y will be rotated and translated on x

>>> sup.set(x, y)

do the lsq fit

>>> sup.run()

get the rmsd

>>> rms = sup.get_rms()

get rotation (right multiplying!) and the translation

>>> rot, tran = sup.get_rotran()

rotate y on x

>>> y_on_x1 = dot(y, rot) + tran

same thing

>>> y_on_x2 = sup.get_transformed()
>>> set_printoptions(precision=2)
>>> print(y_on_x1)
[[  5.17e+01  -1.90e+00   5.01e+01]
 [  5.04e+01  -1.23e+00   5.06e+01]
 [  5.07e+01  -4.16e-02   5.15e+01]
 [  5.02e+01  -1.94e-02   5.29e+01]]
>>> print(y_on_x2)
[[  5.17e+01  -1.90e+00   5.01e+01]
 [  5.04e+01  -1.23e+00   5.06e+01]
 [  5.07e+01  -4.16e-02   5.15e+01]
 [  5.02e+01  -1.94e-02   5.29e+01]]
>>> print("%.2f" % rms)
0.00
__init__()

Initialize the class.

set(reference_coords, coords)

Set the coordinates to be superimposed.

coords will be put on top of reference_coords.

  • reference_coords: an NxDIM array

  • coords: an NxDIM array

DIM is the dimension of the points, N is the number of points to be superimposed.

run()

Superimpose the coordinate sets.

get_transformed()

Get the transformed coordinate set.

get_rotran()

Right multiplying rotation matrix and translation.

get_init_rms()

Root mean square deviation of untransformed coordinates.

get_rms()

Root mean square deviation of superimposed coordinates.