OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
load_and_display.py

Shows how to display one entity with several render modes at once. The sidechains are displayed simple mode, whereas the backbone is displayed with smooth lines.

1 # remove all objects from scene, just in case
2 scene.RemoveAll()
3 # Load chain A of SDH
4 ent = io.LoadPDB('data/sdh.pdb', restrict_chains='A')
5 
6 # create graphics object
7 go = gfx.Entity('SDH', ent)
8 # set rendermode of full graphical object to interpolated spline
9 go.SetRenderMode(gfx.SLINE)
10 # select sidechains (including bond to C-alpha and N in case of proline)
11 sidechains = ent.Select('aname!=CA,C,N,O', mol.EXCLUSIVE_BONDS)
12 # set rendering of sidechains to simple
13 go.SetRenderMode(gfx.SIMPLE, sidechains)
14 
15 # add object to scene
16 scene.Add(go)
17 
18 # center the scene on the geometric center of the SDH
19 scene.CenterOn(go)
20 
21 print 'Demo 1: loading and displaying a pdb file'