File size: 742 Bytes
08dc5f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import py3Dmol
import stmol
import streamlit as st
from stmol import showmol

st.sidebar.title("pLM Attention Visualization")

st.title("pLM Attention Visualization")

pdb_id = st.text_input("PDB ID", "4RW0")
chain_id = None

left, right = st.columns(2)
with left:
    layer = st.number_input("Layer", value=8)
with right:
    head = st.number_input("Head", value=5)

min_attn = st.slider("Minimum attention", min_value=0.0, max_value=0.4, value=0.15)


def get_3dview(pdb):
    xyzview = py3Dmol.view(query=f"pdb:{pdb}")
    xyzview.setStyle({"cartoon": {"color": "spectrum"}})
    stmol.add_hover(xyzview, backgroundColor="black", fontColor="white")
    return xyzview


xyzview = get_3dview(pdb_id)
showmol(xyzview, height=500, width=800)