File: cgo_label_hack.py

package info (click to toggle)
pymol 2.4.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 43,312 kB
  • sloc: cpp: 480,106; python: 79,860; ansic: 28,343; javascript: 6,792; sh: 47; makefile: 30; csh: 8
file content (70 lines) | stat: -rw-r--r-- 1,508 bytes parent folder | download | duplicates (2)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import math
import time
from pymol.cgo import *
from pymol import cmd

axes = [
   LINEWIDTH, 3.0,
   BEGIN, LINES,
   COLOR, 0.2, 1.0, 0.2,
   
   VERTEX, 0.0, 0.0, 0.0,
   VERTEX, 3.0, 0.0, 0.0,

   COLOR, 1.0, 0.2, 0.2,
   VERTEX, 0.0, 0.0, 0.0,
   VERTEX, 0.0, 3.0, 0.0,

   COLOR, 0.2, 0.2, 1.0,   
   VERTEX, 0.0, 0.0, 0.0,
   VERTEX, 00, 0.0, 3.0,
   END
   ]



c=0
for a in range(0,63):
   balls = [
      COLOR,  0.2, 1.0, 0.2,
      SPHERE, 1.0+math.cos(a/10.0), 1.0+math.sin(a/20.0), 1.0+math.cos(a/10.0), 0.2+math.cos(a/5.0)/10.0,

      COLOR,  1.0, 0.2, 0.2,      
      SPHERE, 2.0-math.cos(a/10.0), 1.0+math.sin(0.5+a/10.0), 1.0+math.cos(a/10.0), 0.2+math.cos(a/5.0)/10.0,      
      ]
   obj = axes + balls
   cmd.load_cgo(obj,'cgo01',c)
   c = c + 1
   
   # counter label
   
   pdb_list = [
      "HETATM%5d  C   UNK     1    %8.3f%8.3f%8.3f  1.00 10.00\n"%(c,2.0,0,2.0),
      ]
   cmd.read_pdbstr(''.join(pdb_list),'lab1',c,discrete=1)
   cmd.label("(lab1 and id %d)"%c,"'frame %d %6.3f'"%(c,math.sin(a/10.0)))


cmd.hide("nonbonded","lab1")

# axes labels


pdb_list = [
"HETATM    1  X   UNK     1    %8.3f%8.3f%8.3f  1.00 10.00\n"%(3.2,0,0),
"HETATM    2  Y   UNK     2    %8.3f%8.3f%8.3f  1.00 10.00\n"%(0,3.2,0),
"HETATM    3  Z   UNK     3    %8.3f%8.3f%8.3f  1.00 10.00\n"%(0,0,3.2),]
cmd.read_pdbstr(''.join(pdb_list),'lab2')
cmd.hide('(lab2)')
cmd.label('lab2','name')
cmd.color('white','lab2')


cmd.zoom('cgo01')
cmd.clip('far',-5)

cmd.mplay()

time.sleep(3)

cmd.mstop()