File: superpose.py

package info (click to toggle)
openstructure 2.11.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 206,256 kB
  • sloc: cpp: 188,571; python: 36,686; ansic: 34,298; fortran: 3,275; sh: 312; xml: 146; makefile: 29
file content (26 lines) | stat: -rw-r--r-- 827 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import math
import ost.mol.alg as a

#loading the two entities to be superposed
one=io.LoadEntity('pdb1ake.ent')
two=io.LoadEntity('pdb4ake.ent')

#generate a set of exactly corresponding entity views
ev_a=one.Select('cname=A and (rnum=1:100) and aname=C,CA,N,O')
ev_b=two.Select('cname=A and (rnum=1:100) and aname=C,CA,N,O')

#superposing the first entity view onto the second
#the transformation is directly applied to ev_a
res=a.SuperposeSVD(ev_a, ev_b)
#the superposition result res contains the rmsd between the two entity views
# and additionally more information in case IterativeSuperposition was called

#add the two entities to the scene, color them individually and center
g=gfx.Entity("second", ev_b)
scene.Add(g)
h=gfx.Entity("first",ev_a)
scene.Add(h)
h.SetColor(gfx.RED)
g.SetColor(gfx.BLUE)
scene.CenterOn(g)