Spaces:
Sleeping
Sleeping
Allow setting color
Browse files
hexviz/🧬Attention_Visualization.py
CHANGED
@@ -7,11 +7,7 @@ import stmol
|
|
7 |
import streamlit as st
|
8 |
from stmol import showmol
|
9 |
|
10 |
-
from hexviz.attention import
|
11 |
-
clean_and_validate_sequence,
|
12 |
-
get_attention_pairs,
|
13 |
-
get_chains,
|
14 |
-
)
|
15 |
from hexviz.config import URL
|
16 |
from hexviz.ec_number import ECNumber
|
17 |
from hexviz.models import Model, ModelType
|
@@ -55,8 +51,12 @@ selected_chains = st.sidebar.multiselect(
|
|
55 |
label="Select Chain(s)", options=chains, key="selected_chains"
|
56 |
)
|
57 |
|
58 |
-
show_ligands
|
59 |
-
st.session_state.show_ligands =
|
|
|
|
|
|
|
|
|
60 |
|
61 |
|
62 |
st.sidebar.markdown(
|
@@ -186,7 +186,7 @@ sorted_by_attention = sorted(attention_pairs, key=lambda x: x[0], reverse=True)
|
|
186 |
def get_3dview(pdb):
|
187 |
xyzview = py3Dmol.view()
|
188 |
xyzview.addModel(pdb_str, "pdb")
|
189 |
-
xyzview.setStyle({"cartoon": {"color": "spectrum"}})
|
190 |
stmol.add_hover(xyzview, backgroundColor="black", fontColor="white")
|
191 |
|
192 |
# Show all ligands as stick (heteroatoms)
|
|
|
7 |
import streamlit as st
|
8 |
from stmol import showmol
|
9 |
|
10 |
+
from hexviz.attention import clean_and_validate_sequence, get_attention_pairs, get_chains
|
|
|
|
|
|
|
|
|
11 |
from hexviz.config import URL
|
12 |
from hexviz.ec_number import ECNumber
|
13 |
from hexviz.models import Model, ModelType
|
|
|
51 |
label="Select Chain(s)", options=chains, key="selected_chains"
|
52 |
)
|
53 |
|
54 |
+
if "show_ligands" not in st.session_state:
|
55 |
+
st.session_state.show_ligands = True
|
56 |
+
show_ligands = st.sidebar.checkbox("Show ligands", key="show_ligands")
|
57 |
+
if "color_protein" not in st.session_state:
|
58 |
+
st.session_state.color_protein = True
|
59 |
+
color_protein = st.sidebar.checkbox("Color protein", key="color_protein")
|
60 |
|
61 |
|
62 |
st.sidebar.markdown(
|
|
|
186 |
def get_3dview(pdb):
|
187 |
xyzview = py3Dmol.view()
|
188 |
xyzview.addModel(pdb_str, "pdb")
|
189 |
+
xyzview.setStyle({"cartoon": {"color": "spectrum" if color_protein else "white"}})
|
190 |
stmol.add_hover(xyzview, backgroundColor="black", fontColor="white")
|
191 |
|
192 |
# Show all ligands as stick (heteroatoms)
|