-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstreamlit_app.py
75 lines (60 loc) · 1.74 KB
/
streamlit_app.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import streamlit as st
import base64
from streamlit_extras.switch_page_button import switch_page
from streamlit_extras.add_vertical_space import add_vertical_space
from utils import (
set_page_config,
sidebar_image,
set_css,
author_link,
set_pages,
read_index_html,
)
import warnings
warnings.filterwarnings("ignore")
def page_info():
st.markdown(
"<h1 style='text-align: center; color: #7A3777;'><strong>Explore <em>Mycobacterium tuberculosis</em> complex</strong></h1>",
unsafe_allow_html=True,
)
def buttons():
bt1, bt2, bt3, bt4, bt5, bt6 = st.columns([3, 0.9, 0.9, 0.9, 0.9, 3])
with bt1:
pass
with bt2:
genotype_user_data = st.button("Genotype VCF")
with bt3:
phylogeny = st.button("Explore Phylogeny")
with bt4:
dataset = st.button("Reference Dataset")
with bt5:
barcodes = st.button("Barcoding SNPs")
with bt6:
pass
if genotype_user_data:
switch_page("genotype lineage")
if phylogeny:
switch_page("phylogeny")
if dataset:
switch_page("reference dataset")
if barcodes:
switch_page("barcoding snps")
read_index_html()
@st.cache_data(show_spinner=False)
def show_svg_tree():
with open("./assets/mtbc_tree.svg", "rb") as f:
base64_svg = base64.b64encode(f.read()).decode("utf-8")
svg_display = f'<center><iframe src="data:image/svg+xml;base64,{base64_svg}" width="650" height="650"></iframe></center>'
st.markdown(svg_display, unsafe_allow_html=True)
def main():
set_page_config()
sidebar_image()
set_css()
author_link()
set_pages()
page_info()
add_vertical_space(1)
buttons()
show_svg_tree()
if __name__ == "__main__":
main()