Spaces:
Sleeping
Sleeping
Hide ligands for hidden chains.
Browse files
hexviz/🧬Attention_Visualization.py
CHANGED
@@ -74,10 +74,16 @@ def get_3dview(pdb):
|
|
74 |
xyzview.setStyle({"cartoon": {"color": "spectrum"}})
|
75 |
stmol.add_hover(xyzview, backgroundColor="black", fontColor="white")
|
76 |
|
|
|
|
|
|
|
77 |
|
78 |
hidden_chains = [x for x in chains if x not in selected_chains]
|
79 |
for chain in hidden_chains:
|
80 |
xyzview.setStyle({"chain": chain},{"cross":{"hidden":"true"}})
|
|
|
|
|
|
|
81 |
if len(selected_chains) == 1:
|
82 |
xyzview.zoomTo({'chain': f'{selected_chains[0]}'})
|
83 |
else:
|
@@ -86,9 +92,6 @@ def get_3dview(pdb):
|
|
86 |
for att_weight, first, second, _, _, _ in attention_pairs:
|
87 |
stmol.add_cylinder(xyzview, start=first, end=second, cylradius=att_weight, cylColor='red', dashed=False)
|
88 |
|
89 |
-
xyzview.addStyle({"hetflag": True},
|
90 |
-
{"stick": {"radius": 0.2}})
|
91 |
-
|
92 |
if label_resi:
|
93 |
for hl_resi in hl_resi_list:
|
94 |
xyzview.addResLabels({"chain": hl_chain,"resi": hl_resi},
|
|
|
74 |
xyzview.setStyle({"cartoon": {"color": "spectrum"}})
|
75 |
stmol.add_hover(xyzview, backgroundColor="black", fontColor="white")
|
76 |
|
77 |
+
# Show all ligands as stick (heteroatoms)
|
78 |
+
xyzview.addStyle({"hetflag": True},
|
79 |
+
{"stick": {"radius": 0.2}})
|
80 |
|
81 |
hidden_chains = [x for x in chains if x not in selected_chains]
|
82 |
for chain in hidden_chains:
|
83 |
xyzview.setStyle({"chain": chain},{"cross":{"hidden":"true"}})
|
84 |
+
# Hide ligands for chain too
|
85 |
+
xyzview.addStyle({"chain": chain, "hetflag": True},{"cross": {"hidden": "true"}})
|
86 |
+
|
87 |
if len(selected_chains) == 1:
|
88 |
xyzview.zoomTo({'chain': f'{selected_chains[0]}'})
|
89 |
else:
|
|
|
92 |
for att_weight, first, second, _, _, _ in attention_pairs:
|
93 |
stmol.add_cylinder(xyzview, start=first, end=second, cylradius=att_weight, cylColor='red', dashed=False)
|
94 |
|
|
|
|
|
|
|
95 |
if label_resi:
|
96 |
for hl_resi in hl_resi_list:
|
97 |
xyzview.addResLabels({"chain": hl_chain,"resi": hl_resi},
|