aksell commited on
Commit
6bb6142
·
1 Parent(s): 4355c21

Move attention parameters to sidebar

Browse files
Files changed (1) hide show
  1. hexviz/app.py +15 -15
hexviz/app.py CHANGED
@@ -35,6 +35,21 @@ hl_resi_list = st.sidebar.multiselect(label="Highlight Residues",options=list(ra
35
  label_resi = st.sidebar.checkbox(label="Label Residues", value=True)
36
 
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  left, right = st.columns(2)
39
  with left:
40
  layer_one = st.number_input("Layer", value=10, min_value=1, max_value=selected_model.layers)
@@ -44,19 +59,6 @@ with right:
44
  head = head_one - 1
45
 
46
 
47
- with st.expander("Attention parameters", expanded=False):
48
- min_attn = st.slider("Minimum attention", min_value=0.0, max_value=0.4, value=0.1)
49
- n_pairs = st.number_input("Num attention pairs labeled", value=2, min_value=1, max_value=100)
50
- label_highest = st.checkbox("Label highest attention pairs", value=True)
51
-
52
- # TODO add avg or max attention as params
53
-
54
- try:
55
- ec_class = structure.header["compound"]["1"]["ec"]
56
- except KeyError:
57
- ec_class = None
58
- if ec_class and selected_model.name == ModelType.ZymCTRL:
59
- ec_class = st.text_input("Enzyme classification number fetched from PDB", ec_class)
60
 
61
  attention_pairs = get_attention_pairs(pdb_id, chain_ids=selected_chains, layer=layer, head=head, threshold=min_attn, model_type=selected_model.name)
62
 
@@ -76,8 +78,6 @@ def get_3dview(pdb):
76
  for att_weight, first, second, _, _, _ in attention_pairs:
77
  stmol.add_cylinder(xyzview, start=first, end=second, cylradius=att_weight, cylColor='red', dashed=False)
78
 
79
- # get_max_attention(n_pairs)
80
-
81
  if label_resi:
82
  for hl_resi in hl_resi_list:
83
  xyzview.addResLabels({"chain": hl_chain,"resi": hl_resi},
 
35
  label_resi = st.sidebar.checkbox(label="Label Residues", value=True)
36
 
37
 
38
+ st.sidebar.text("Attention parameters")
39
+ min_attn = st.sidebar.slider("Minimum attention", min_value=0.0, max_value=0.4, value=0.1)
40
+ n_pairs = st.sidebar.number_input("Num attention pairs labeled", value=2, min_value=1, max_value=100)
41
+ label_highest = st.sidebar.checkbox("Label highest attention pairs", value=True)
42
+ # TODO add avg or max attention as params
43
+
44
+ if selected_model.name == ModelType.ZymCTRL:
45
+ try:
46
+ ec_class = structure.header["compound"]["1"]["ec"]
47
+ except KeyError:
48
+ ec_class = None
49
+ if ec_class and selected_model.name == ModelType.ZymCTRL:
50
+ ec_class = st.sidebar.text_input("Enzyme classification number fetched from PDB", ec_class)
51
+
52
+
53
  left, right = st.columns(2)
54
  with left:
55
  layer_one = st.number_input("Layer", value=10, min_value=1, max_value=selected_model.layers)
 
59
  head = head_one - 1
60
 
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
  attention_pairs = get_attention_pairs(pdb_id, chain_ids=selected_chains, layer=layer, head=head, threshold=min_attn, model_type=selected_model.name)
64
 
 
78
  for att_weight, first, second, _, _, _ in attention_pairs:
79
  stmol.add_cylinder(xyzview, start=first, end=second, cylradius=att_weight, cylColor='red', dashed=False)
80
 
 
 
81
  if label_resi:
82
  for hl_resi in hl_resi_list:
83
  xyzview.addResLabels({"chain": hl_chain,"resi": hl_resi},