File: conservation.py

package info (click to toggle)
openstructure 2.9.3-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 205,228 kB
  • sloc: cpp: 188,129; python: 35,361; ansic: 34,298; fortran: 3,275; sh: 286; xml: 146; makefile: 29
file content (48 lines) | stat: -rw-r--r-- 1,726 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
scene.RemoveAll()
#-------------------------------------------------------------------------------
# Loading structure and alignment
#-------------------------------------------------------------------------------
m=io.LoadPDB('data/sh2.pdb')
mp=m.Select('ligand=false')
aln=io.LoadAlignment('data/sh2.aln')
aln.AttachView(0, mp)
aln.SetSequenceOffset(0, 1)
#-------------------------------------------------------------------------------
# Calculate conservation of alignment
# First we set all properties to zero, then let alg.Conservation assign the
# conservation scores to the residues
#-------------------------------------------------------------------------------
seq.alg.Conservation(aln)

#-------------------------------------------------------------------------------
# Setup Graphical Objects for Rendering
#-------------------------------------------------------------------------------
g=gfx.Entity('SH2', m)
s=io.LoadSurface('data/sh2.vert')
gs=gfx.Surface('SH2-surf', s)
scene.Add(gs)
scene.Add(g)
scene.CenterOn(g)

s.Attach(mp.Select('ligand=false'), 8.0)

gr=gfx.Gradient()
gr.SetColorAt(0.0, gfx.Color(0.1, 0.1, 0.8))
gr.SetColorAt(1.0, gfx.Color(0.8, 0.1, 0.1))

gs.ColorBy('cons', gr, 0.8, 1.0, 
           mol.Prop.Level.RESIDUE)
g.SetRenderMode(gfx.HSC, 
                m.Select('ligand=false'))
g.SetRenderMode(gfx.CUSTOM, 
                m.Select('ligand=true'))
g.SetColor(gfx.YELLOW, 'ligand=true')

#-------------------------------------------------------------------------------
# Create alignment viewer and show it on the screen
#-------------------------------------------------------------------------------
seq_viewer=gui.SequenceViewer()
seq_viewer.AddAlignment(aln)
seq_viewer.Show()