-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInterfaceUtils_ori.py
More file actions
112 lines (85 loc) · 3.68 KB
/
InterfaceUtils_ori.py
File metadata and controls
112 lines (85 loc) · 3.68 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import pymol
from pymol import cmd
import sys,os
from .MoleculeUtils import selectPolarProtons
from .MoleculeUtils import selectApolarProtons
from .MoleculeUtils import colorCPK
from .PackingMeasureUtils import loadPackingPDB
def loadInterfacePDB(file,name=None,native=None):
print(" Loading interface PDB %s"%(file))
if name is None:
name = name = os.path.basename(file)
if name.endswith('.pdb'):
name = name[:-4]
# Call Will's packing PDB loading function
# Note: proteins will be cartoons, cavities will be spheres
# Rosetta radii will be enabled
name = loadPackingPDB(file,name,native)
cavselname = name+"cavities"
protselname = name+"protein"
cmd.hide("lines",protselname)
backbone_colorlist = ['green', 'yellow', 'violet', 'cyan', \
'salmon', 'lime', 'slate', 'magenta', 'orange', 'marine', \
'olive', 'forest', 'firebrick', 'chocolate' ]
curr_bb_color = 0
carbon_colorlist = ['teal', 'wheat', 'grey', 'pink' ]
curr_carbon_color = 0
# Derive selections for the interface, color by chain
cmd.select("interface", "none")
cmd.select("heavy_interface", "none")
selectPolarProtons("polar_protons")
selectApolarProtons("apolar_protons")
alphabet = list(('abcdefghijklmnopqrstuvwxyz').upper())
for letter in alphabet:
chainname = "chain"+letter
cmd.select( chainname, "chain %s and not hetatm and not symbol w"%(letter) )
# Check whether any protein atoms exist with this chain ID
# JK Later, put in a special "non-interface" case for L/H antibody chains
if cmd.count_atoms("chain%s"%(letter))>0:
interfacename = "interface"+letter
cmd.select("not_this_chain", "not hetatm and not symbol w and not %s"%(chainname) )
cmd.select(interfacename, "byres %s and (not_this_chain around 4.0)"%(chainname) )
cmd.select("heavy_%s"%(interfacename), "%s and not apolar_protons"%(interfacename))
cmd.select("interface", "interface or %s"%(interfacename) )
cmd.select("heavy_interface", "heavy_interface or heavy_%s"%(interfacename) )
cmd.delete("not_this_chain")
cmd.color(backbone_colorlist[curr_bb_color], chainname)
curr_bb_color = curr_bb_color+1
if(curr_bb_color == len(backbone_colorlist)):
curr_bb_color = 0
colorCPK(interfacename,carbon_colorlist[curr_carbon_color])
curr_carbon_color = curr_carbon_color+1
if(curr_carbon_color == len(carbon_colorlist)):
curr_carbon_color = 0
cmd.color("white", "%s and polar_protons"%(interfacename))
else:
cmd.delete(chainname)
cmd.delete("apolar_protons")
cmd.delete("polar_protons")
# Show the interface in sticks, colored cpk
#cmd.hide( "cartoon", "interface" )
cmd.show( "sticks", "heavy_interface" )
cmd.zoom("interface")
cmd.show( "cartoon", "(not interface) or byres(neighbor(interface)) or byres(neighbor(byres(neighbor(interface))))" )
# Show interface waters as small purple spheres
cmd.select( "interface_water", "(symbol w or resn HOH) and (interface around 8.0)")
if cmd.count_atoms("interface_water")>0:
# Put the waters in a separate object, so that we can scale their radii
newwatername = name+"waters"
cmd.create(newwatername, "interface_water")
cmd.remove("interface_water")
cmd.color("purple", newwatername)
cmd.show( "spheres", newwatername )
cmd.set( "sphere_scale", 0.5, newwatername )
else:
cmd.delete("interface_water")
# Show interface ligands as pink sticks
cmd.select( "interface_hetero", "(not symbol w and not resn HOH) and (hetatm and not symbol w and not resn WSS) and (interface around 4.5)")
if cmd.count_atoms("interface_hetero")>0:
cmd.color("pink", "interface_hetero")
cmd.show( "sticks", "interface_hetero" )
else:
cmd.delete("interface_hetero")
cmd.select("none")
return name
cmd.extend("loadInterfacePDB",loadInterfacePDB)