Skip to content

Commit ddf195f

Browse files
committed
✨ add current main state of streamlit report Python files
1 parent f90e4a5 commit ddf195f

File tree

10 files changed

+522
-0
lines changed

10 files changed

+522
-0
lines changed
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
import pandas as pd
2+
import streamlit as st
3+
df_index = 1
4+
from vuegen import table_utils
5+
from st_aggrid import AgGrid, GridOptionsBuilder
6+
7+
st.markdown('''<h3 style='text-align: center; color: #023558;'>All Formats</h3>''', unsafe_allow_html=True)
8+
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Phyla Correlation Network Csv</h4>''', unsafe_allow_html=True)
9+
df = pd.read_csv('docs/example_data/Basic_example_vuegen_demo_notebook/2_Dataframes/1_All_formats/1_phyla_correlation_network_csv.csv')
10+
11+
12+
# Displays a DataFrame using AgGrid with configurable options.
13+
grid_builder = GridOptionsBuilder.from_dataframe(df)
14+
grid_builder.configure_default_column(editable=True, groupable=True, filter=True)
15+
grid_builder.configure_side_bar(filters_panel=True, columns_panel=True)
16+
grid_builder.configure_selection(selection_mode="multiple")
17+
grid_builder.configure_pagination(enabled=True, paginationAutoPageSize=False, paginationPageSize=20)
18+
grid_options = grid_builder.build()
19+
20+
AgGrid(df, gridOptions=grid_options, enable_enterprise_modules=True)
21+
22+
# Button to download the df
23+
df_csv = df.to_csv(sep=',', header=True, index=False).encode('utf-8')
24+
st.download_button(
25+
label="Download dataframe as CSV",
26+
data=df_csv,
27+
file_name=f"dataframe_{df_index}.csv",
28+
mime='text/csv',
29+
key=f"download_button_{df_index}")
30+
df_index += 1
31+
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Abundance Table Example Xls</h4>''', unsafe_allow_html=True)
32+
selected_sheet = 0
33+
sheet_names = table_utils.get_sheet_names("/Users/heweb/Documents/repos/vuegen/docs/example_data/Basic_example_vuegen_demo_notebook/2_Dataframes/1_All_formats/2_abundance_table_example_xls.xls")
34+
selected_sheet = st.selectbox("Select a sheet to display", options=sheet_names)
35+
36+
df = pd.read_excel('/Users/heweb/Documents/repos/vuegen/docs/example_data/Basic_example_vuegen_demo_notebook/2_Dataframes/1_All_formats/2_abundance_table_example_xls.xls', sheet_name=selected_sheet)
37+
38+
39+
# Displays a DataFrame using AgGrid with configurable options.
40+
grid_builder = GridOptionsBuilder.from_dataframe(df)
41+
grid_builder.configure_default_column(editable=True, groupable=True, filter=True)
42+
grid_builder.configure_side_bar(filters_panel=True, columns_panel=True)
43+
grid_builder.configure_selection(selection_mode="multiple")
44+
grid_builder.configure_pagination(enabled=True, paginationAutoPageSize=False, paginationPageSize=20)
45+
grid_options = grid_builder.build()
46+
47+
AgGrid(df, gridOptions=grid_options, enable_enterprise_modules=True)
48+
49+
# Button to download the df
50+
df_csv = df.to_csv(sep=',', header=True, index=False).encode('utf-8')
51+
st.download_button(
52+
label="Download dataframe as CSV",
53+
data=df_csv,
54+
file_name=f"dataframe_{df_index}.csv",
55+
mime='text/csv',
56+
key=f"download_button_{df_index}")
57+
df_index += 1
58+
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Sample Info Example Txt</h4>''', unsafe_allow_html=True)
59+
df = pd.read_table('docs/example_data/Basic_example_vuegen_demo_notebook/2_Dataframes/1_All_formats/3_sample_info_example_txt.txt')
60+
61+
62+
# Displays a DataFrame using AgGrid with configurable options.
63+
grid_builder = GridOptionsBuilder.from_dataframe(df)
64+
grid_builder.configure_default_column(editable=True, groupable=True, filter=True)
65+
grid_builder.configure_side_bar(filters_panel=True, columns_panel=True)
66+
grid_builder.configure_selection(selection_mode="multiple")
67+
grid_builder.configure_pagination(enabled=True, paginationAutoPageSize=False, paginationPageSize=20)
68+
grid_options = grid_builder.build()
69+
70+
AgGrid(df, gridOptions=grid_options, enable_enterprise_modules=True)
71+
72+
# Button to download the df
73+
df_csv = df.to_csv(sep=',', header=True, index=False).encode('utf-8')
74+
st.download_button(
75+
label="Download dataframe as CSV",
76+
data=df_csv,
77+
file_name=f"dataframe_{df_index}.csv",
78+
mime='text/csv',
79+
key=f"download_button_{df_index}")
80+
df_index += 1
81+
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Sample Info Example Parquet</h4>''', unsafe_allow_html=True)
82+
df = pd.read_parquet('docs/example_data/Basic_example_vuegen_demo_notebook/2_Dataframes/1_All_formats/4_sample_info_example_parquet.parquet')
83+
84+
85+
# Displays a DataFrame using AgGrid with configurable options.
86+
grid_builder = GridOptionsBuilder.from_dataframe(df)
87+
grid_builder.configure_default_column(editable=True, groupable=True, filter=True)
88+
grid_builder.configure_side_bar(filters_panel=True, columns_panel=True)
89+
grid_builder.configure_selection(selection_mode="multiple")
90+
grid_builder.configure_pagination(enabled=True, paginationAutoPageSize=False, paginationPageSize=20)
91+
grid_options = grid_builder.build()
92+
93+
AgGrid(df, gridOptions=grid_options, enable_enterprise_modules=True)
94+
95+
# Button to download the df
96+
df_csv = df.to_csv(sep=',', header=True, index=False).encode('utf-8')
97+
st.download_button(
98+
label="Download dataframe as CSV",
99+
data=df_csv,
100+
file_name=f"dataframe_{df_index}.csv",
101+
mime='text/csv',
102+
key=f"download_button_{df_index}")
103+
df_index += 1
104+
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Example Xlsx</h4>''', unsafe_allow_html=True)
105+
selected_sheet = 0
106+
df = pd.read_excel('/Users/heweb/Documents/repos/vuegen/docs/example_data/Basic_example_vuegen_demo_notebook/2_Dataframes/1_All_formats/5_example_xlsx.xlsx', sheet_name=selected_sheet)
107+
108+
109+
# Displays a DataFrame using AgGrid with configurable options.
110+
grid_builder = GridOptionsBuilder.from_dataframe(df)
111+
grid_builder.configure_default_column(editable=True, groupable=True, filter=True)
112+
grid_builder.configure_side_bar(filters_panel=True, columns_panel=True)
113+
grid_builder.configure_selection(selection_mode="multiple")
114+
grid_builder.configure_pagination(enabled=True, paginationAutoPageSize=False, paginationPageSize=20)
115+
grid_options = grid_builder.build()
116+
117+
AgGrid(df, gridOptions=grid_options, enable_enterprise_modules=True)
118+
119+
# Button to download the df
120+
df_csv = df.to_csv(sep=',', header=True, index=False).encode('utf-8')
121+
st.download_button(
122+
label="Download dataframe as CSV",
123+
data=df_csv,
124+
file_name=f"dataframe_{df_index}.csv",
125+
mime='text/csv',
126+
key=f"download_button_{df_index}")
127+
df_index += 1
128+
footer = '''<style type="text/css">
129+
.footer {
130+
position: relative;
131+
left: 0;
132+
width: 100%;
133+
text-align: center;
134+
}
135+
</style>
136+
<footer class="footer">
137+
This report was generated with
138+
<a href="https://github.com/Multiomics-Analytics-Group/vuegen" target="_blank">
139+
<img src="https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_logo.svg" alt="VueGen" width="65px">
140+
</a>
141+
| Copyright 2025 <a href="https://github.com/Multiomics-Analytics-Group" target="_blank">
142+
Multiomics Network Analytics Group (MoNA)
143+
</a>
144+
</footer>'''
145+
146+
st.markdown(footer, unsafe_allow_html=True)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import streamlit as st
2+
import streamlit as st
3+
import requests
4+
st.markdown('''<p style='text-align: center; color: #000000;'>A general description of the report.
5+
</p>''', unsafe_allow_html=True)
6+
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Description</h4>''', unsafe_allow_html=True)
7+
8+
with open('docs/example_data/Basic_example_vuegen_demo_notebook/description.md', 'r') as markdown_file:
9+
markdown_content = markdown_file.read()
10+
11+
st.markdown(markdown_content, unsafe_allow_html=True)
12+
13+
footer = '''<style type="text/css">
14+
.footer {
15+
position: relative;
16+
left: 0;
17+
width: 100%;
18+
text-align: center;
19+
}
20+
</style>
21+
<footer class="footer">
22+
This report was generated with
23+
<a href="https://github.com/Multiomics-Analytics-Group/vuegen" target="_blank">
24+
<img src="https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_logo.svg" alt="VueGen" width="65px">
25+
</a>
26+
| Copyright 2025 <a href="https://github.com/Multiomics-Analytics-Group" target="_blank">
27+
Multiomics Network Analytics Group (MoNA)
28+
</a>
29+
</footer>'''
30+
31+
st.markdown(footer, unsafe_allow_html=True)
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import streamlit as st
2+
import requests
3+
4+
st.markdown('''<h3 style='text-align: center; color: #023558;'>All Html</h3>''', unsafe_allow_html=True)
5+
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Plot</h4>''', unsafe_allow_html=True)
6+
7+
with open('docs/example_data/Basic_example_vuegen_demo_notebook/4_Html/1_All_html/1_plot.html', 'r', encoding='utf-8') as html_file:
8+
html_content = html_file.read()
9+
10+
st.components.v1.html(html_content, height=600, scrolling=True)
11+
12+
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Ckg Network</h4>''', unsafe_allow_html=True)
13+
14+
with open('docs/example_data/Basic_example_vuegen_demo_notebook/4_Html/1_All_html/2_ckg_network.html', 'r') as html_file:
15+
html_content = html_file.read()
16+
17+
18+
st.markdown(f"<p style='text-align: center; color: black;'> <b>Number of nodes:</b> 33 </p>", unsafe_allow_html=True)
19+
st.markdown(f"<p style='text-align: center; color: black;'> <b>Number of relationships:</b> 35 </p>", unsafe_allow_html=True)
20+
21+
# Streamlit checkbox for controlling the layout
22+
control_layout = st.checkbox('Add panel to control layout', value=True)
23+
net_html_height = 1200 if control_layout else 630
24+
# Load HTML into HTML component for display on Streamlit
25+
st.components.v1.html(html_content, height=net_html_height)
26+
27+
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Multiqc Report</h4>''', unsafe_allow_html=True)
28+
29+
with open('docs/example_data/Basic_example_vuegen_demo_notebook/4_Html/1_All_html/3_multiqc_report.html', 'r', encoding='utf-8') as html_file:
30+
html_content = html_file.read()
31+
32+
st.components.v1.html(html_content, height=600, scrolling=True)
33+
34+
footer = '''<style type="text/css">
35+
.footer {
36+
position: relative;
37+
left: 0;
38+
width: 100%;
39+
text-align: center;
40+
}
41+
</style>
42+
<footer class="footer">
43+
This report was generated with
44+
<a href="https://github.com/Multiomics-Analytics-Group/vuegen" target="_blank">
45+
<img src="https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_logo.svg" alt="VueGen" width="65px">
46+
</a>
47+
| Copyright 2025 <a href="https://github.com/Multiomics-Analytics-Group" target="_blank">
48+
Multiomics Network Analytics Group (MoNA)
49+
</a>
50+
</footer>'''
51+
52+
st.markdown(footer, unsafe_allow_html=True)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import streamlit as st
2+
import requests
3+
4+
st.markdown('''<h3 style='text-align: center; color: #023558;'>All Markdown</h3>''', unsafe_allow_html=True)
5+
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Readme</h4>''', unsafe_allow_html=True)
6+
7+
with open('docs/example_data/Basic_example_vuegen_demo_notebook/5_Markdown/1_All_markdown/README.md', 'r') as markdown_file:
8+
markdown_content = markdown_file.read()
9+
10+
st.markdown(markdown_content, unsafe_allow_html=True)
11+
12+
footer = '''<style type="text/css">
13+
.footer {
14+
position: relative;
15+
left: 0;
16+
width: 100%;
17+
text-align: center;
18+
}
19+
</style>
20+
<footer class="footer">
21+
This report was generated with
22+
<a href="https://github.com/Multiomics-Analytics-Group/vuegen" target="_blank">
23+
<img src="https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_logo.svg" alt="VueGen" width="65px">
24+
</a>
25+
| Copyright 2025 <a href="https://github.com/Multiomics-Analytics-Group" target="_blank">
26+
Multiomics Network Analytics Group (MoNA)
27+
</a>
28+
</footer>'''
29+
30+
st.markdown(footer, unsafe_allow_html=True)
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import streamlit as st
2+
import requests
3+
4+
st.markdown('''<h3 style='text-align: center; color: #023558;'>Interactive Networks</h3>''', unsafe_allow_html=True)
5+
st.markdown('''<p style='text-align: center; color: #000000;'>Optional description for subsection.
6+
</p>''', unsafe_allow_html=True)
7+
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Man Example</h4>''', unsafe_allow_html=True)
8+
9+
with open('tests/report_examples/Basic_example_vuegen_demo_notebook/streamlit_report/static/Man_Example.html', 'r') as html_file:
10+
html_content = html_file.read()
11+
12+
13+
st.markdown(f"<p style='text-align: center; color: black;'> <b>Number of nodes:</b> 9 </p>", unsafe_allow_html=True)
14+
st.markdown(f"<p style='text-align: center; color: black;'> <b>Number of relationships:</b> 14 </p>", unsafe_allow_html=True)
15+
16+
# Streamlit checkbox for controlling the layout
17+
control_layout = st.checkbox('Add panel to control layout', value=True)
18+
net_html_height = 1200 if control_layout else 630
19+
# Load HTML into HTML component for display on Streamlit
20+
st.components.v1.html(html_content, height=net_html_height)
21+
22+
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Description</h4>''', unsafe_allow_html=True)
23+
24+
with open('docs/example_data/Basic_example_vuegen_demo_notebook/3_Networks/1_Interactive_networks/description.md', 'r') as markdown_file:
25+
markdown_content = markdown_file.read()
26+
27+
st.markdown(markdown_content, unsafe_allow_html=True)
28+
29+
footer = '''<style type="text/css">
30+
.footer {
31+
position: relative;
32+
left: 0;
33+
width: 100%;
34+
text-align: center;
35+
}
36+
</style>
37+
<footer class="footer">
38+
This report was generated with
39+
<a href="https://github.com/Multiomics-Analytics-Group/vuegen" target="_blank">
40+
<img src="https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_logo.svg" alt="VueGen" width="65px">
41+
</a>
42+
| Copyright 2025 <a href="https://github.com/Multiomics-Analytics-Group" target="_blank">
43+
Multiomics Network Analytics Group (MoNA)
44+
</a>
45+
</footer>'''
46+
47+
st.markdown(footer, unsafe_allow_html=True)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import streamlit as st
2+
3+
st.markdown('''<h3 style='text-align: center; color: #023558;'>Static Networks</h3>''', unsafe_allow_html=True)
4+
st.markdown('''<h4 style='text-align: center; color: #2b8cbe;'>Phyla Correlation Network</h4>''', unsafe_allow_html=True)
5+
6+
st.image('docs/example_data/Basic_example_vuegen_demo_notebook/3_Networks/2_Static_networks/1_phyla_correlation_network.png', caption='', use_column_width=True)
7+
8+
footer = '''<style type="text/css">
9+
.footer {
10+
position: relative;
11+
left: 0;
12+
width: 100%;
13+
text-align: center;
14+
}
15+
</style>
16+
<footer class="footer">
17+
This report was generated with
18+
<a href="https://github.com/Multiomics-Analytics-Group/vuegen" target="_blank">
19+
<img src="https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_logo.svg" alt="VueGen" width="65px">
20+
</a>
21+
| Copyright 2025 <a href="https://github.com/Multiomics-Analytics-Group" target="_blank">
22+
Multiomics Network Analytics Group (MoNA)
23+
</a>
24+
</footer>'''
25+
26+
st.markdown(footer, unsafe_allow_html=True)

0 commit comments

Comments
 (0)