forked from OpenMS/streamlit-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
142 lines (132 loc) · 4.29 KB
/
app.py
File metadata and controls
142 lines (132 loc) · 4.29 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import streamlit as st
from pathlib import Path
import json
import base64
# For some reason the windows version only works if this is imported here
import pyopenms
def get_base64_of_bin_file(png_file: str) -> str:
with open(png_file, "rb") as f:
return base64.b64encode(f.read()).decode()
@st.cache_resource
def build_markup_for_logo(png_file: str) -> str:
binary_string = get_base64_of_bin_file(png_file)
return f"""
<style>
[data-testid="stSidebarHeader"] {{
background-image: url("data:image/png;base64,{binary_string}");
background-repeat: no-repeat;
background-size: contain;
background-position: top center;
}}
</style>
"""
if "settings" not in st.session_state:
with open("settings.json", "r") as f:
st.session_state.settings = json.load(f)
if __name__ == "__main__":
st.markdown(
build_markup_for_logo(str(Path("assets", "OpenDIAKiosk_logo_portrait.png"))),
unsafe_allow_html=True,
)
pages = {
"Getting started with DIA": [
st.Page(
Path("content", "dia_00_concepts.py"),
title="Concepts",
icon="📚",
),
st.Page(
Path("content", "dia_01_targeted_data_extraction.py"),
title="Targeted Data Extraction",
icon="🎯",
),
st.Page(
Path(
"content",
"dia_02_extracted_ion_chromatgoram_peak_picking_and_feature_scoring.py",
),
title="Peak Detection and Feature Scoring",
icon="🔍",
),
st.Page(
Path("content", "dia_03_feature_scoring.py"),
title="Feature Scoring",
icon="⭐️",
),
st.Page(
Path("content", "dia_04_statistical_validation.py"),
title="Statistical Validation",
icon="📊",
),
],
"Proteome Database": [
st.Page(
Path("content", "fasta_database.py"),
title="FASTA Database",
icon="📖",
),
],
"Spectral Library Generation": [
st.Page(
Path("content", "insilico_spectral_library_generation.py"),
title="Predicted Library",
icon="📚",
),
st.Page(
Path("content", "openswathassay_generation.py"),
title="Filter and Optimize Library",
icon="🔧",
),
st.Page(
Path("content", "openswathdecoy_generation.py"),
title="Generate/Append Decoys",
icon="🎭",
),
],
"OpenSwath": [
st.Page(
Path("content", "openswath_file_upload.py"),
title="File Upload",
icon="📁",
),
st.Page(
Path("content", "openswath_configuration.py"),
title="Configuration",
icon="⚙️",
),
st.Page(
Path("content", "openswath_workflow.py"),
title="Run Workflow",
icon="🔁",
),
st.Page(
Path("content", "openswath_results_viewer.py"),
title="Results Viewer",
icon="📈",
),
st.Page(
Path("content", "xic_chromatogram_viewer.py"),
title="XIC Chromatogram Viewer",
icon="📊",
),
st.Page(
Path("content", "openswath_results_comparison.py"),
title="Results Comparison",
icon="🧪",
),
],
"Others": [
st.Page(
Path("content", "log_viewer.py"),
title="Log Viewer",
icon="🧾",
),
st.Page(
Path("content", "workspace_viewer.py"),
title="Workspace Viewer",
icon="📁",
),
],
}
pg = st.navigation(pages)
pg.run()