aksell commited on
Commit
e9d64be
·
1 Parent(s): 13af878

Allow selecting chain ID in heatmap

Browse files
hexviz/pages/Identify_interesting_Heads.py CHANGED
@@ -23,9 +23,17 @@ pdb_id = st.sidebar.text_input(
23
 
24
 
25
  structure = get_structure(pdb_id)
 
26
  chains = list(structure.get_chains())
 
 
 
 
 
 
 
 
27
 
28
- sequence = get_sequence(chains[0])
29
  l = len(sequence)
30
  st.sidebar.markdown("Sequence segment to plot")
31
  slice_start, slice_end = st.sidebar.slider("Sequence", min_value=1, max_value=l, value=(1, 50), step=1)
@@ -40,7 +48,7 @@ layer_sequence = list(range(layer_range[0]-1, layer_range[1], step_size))
40
  head_sequence = list(range(head_range[0]-1, head_range[1], step_size))
41
 
42
 
43
- st.markdown(f"Each tile is a heatmap of attention for a section of {pdb_id}(A) from residue {slice_start} to {slice_end}. Adjust the section length and starting point in the sidebar.")
44
 
45
  # TODO: Decide if you should get attention for the full sequence or just the truncated sequence
46
  # Attention values will change depending on what we do.
 
23
 
24
 
25
  structure = get_structure(pdb_id)
26
+
27
  chains = list(structure.get_chains())
28
+ chain_ids = [chain.id for chain in chains]
29
+ chain_selection = st.sidebar.selectbox(
30
+ label="Select Chain",
31
+ options=chain_ids,
32
+ )
33
+
34
+ selected_chain = next(chain for chain in chains if chain.id == chain_selection)
35
+ sequence = get_sequence(selected_chain)
36
 
 
37
  l = len(sequence)
38
  st.sidebar.markdown("Sequence segment to plot")
39
  slice_start, slice_end = st.sidebar.slider("Sequence", min_value=1, max_value=l, value=(1, 50), step=1)
 
48
  head_sequence = list(range(head_range[0]-1, head_range[1], step_size))
49
 
50
 
51
+ st.markdown(f"Each tile is a heatmap of attention for a section of {pdb_id}({chain_selection}) from residue {slice_start} to {slice_end}. Adjust the section length and starting point in the sidebar.")
52
 
53
  # TODO: Decide if you should get attention for the full sequence or just the truncated sequence
54
  # Attention values will change depending on what we do.