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