[BioPython] Superimposer

Peter biopython at maubp.freeserve.co.uk
Tue Mar 24 11:43:05 UTC 2009


On Tue, Mar 24, 2009 at 11:12 AM, mitlox <mitlox at op.pl> wrote:
> Hello,
> I read that the Superimposer works only with the two lists of atoms which
> contain the same amount of atoms.
>
> So I decided to use "Combinatorial Extension (CE)". This program returns a
> rotation matrix and a translation vector.
>
> After the execution of CE I took the matrix and vector and tried to use it
> with Superimposer:

Why?  Once you know the transformation, why do you need to try and
recreate it with the superimposer?  Are you just doing this as a check?

> ------------------------------------------------------------------------------
> import sys
> import numpy
> from Bio.PDB import *
>
>
> pdb_fix = "../files/1z9g.pdb"
> pdb_mov = "../files/1z9g90.pdb"
> p=PDBParser()
> s1=p.get_structure("FIXED", pdb_fix)
> fixed=Selection.unfold_entities(s1, "A")
>
> s2=p.get_structure("MOVING", pdb_mov)
> moving=Selection.unfold_entities(s2, "A")

You should be loading in the ORGINAL pdb file here, as the moved one
won't exist yet, and if it did, you'd apply the transformation twice.

Note you should expect slight differences due to floating point
calculations.  Your input was:

array([[ 0.19411442, -0.85385352,  0.4829635 ],
       [ 0.94858825,  0.28884873,  0.12940907],
       [-0.24999979,  0.43301335,  0.86602515]], dtype=float32)
array([-0.99996603, -2.00002551, -2.99998283], dtype=float32),

The output was:

array([[ 0.19411439,  0.94858827, -0.24999978],
       [-0.85385353,  0.28884871,  0.43301335],
       [ 0.4829635 ,  0.12940907,  0.86602514]]),
array([-0.06473777,  1.91448618,  3.21410633])

The rotation looks transposed (backwards).  The translation does look
different... however, if you switch this line:
sup.set_atoms(fixed, moving)
to:
sup.set_atoms(moving, fixed)
then things agree.  I suspect something is flipped in the logic of
your script regarding the frames of reference.

Also, at the end you do sup.apply(moving), but you have already
manually moved these atoms, so won't your PDB file have them moved
twice?

Peter



More information about the Biopython mailing list