maom commited on
Commit
29713c0
·
verified ·
1 Parent(s): 11a2967

try using aggrid

Browse files
Files changed (1) hide show
  1. app.py +26 -7
app.py CHANGED
@@ -1,8 +1,7 @@
1
  import datasets
2
  import streamlit as st
3
- import numpy as np
4
- import pandas as pd
5
- import altair as alt
6
 
7
  st.markdown("""
8
  # CryptoCEN Top50 co-expressed partners
@@ -46,9 +45,29 @@ top_coexp_hits.reset_index()
46
 
47
  with col2:
48
  st.download_button(
49
- label="Download data as TSV",
50
  data = top_coexp_hits.to_csv(sep ='\t').encode('utf-8'),
51
- file_name= f"top_coexp_hits_{gene_id}.tsv",
52
- mime="text/csv")
53
 
54
- st.table(top_coexp_hits)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import datasets
2
  import streamlit as st
3
+ from st_aggrid import AgGrid, GridOptionsBuilder
4
+
 
5
 
6
  st.markdown("""
7
  # CryptoCEN Top50 co-expressed partners
 
45
 
46
  with col2:
47
  st.download_button(
48
+ label = "Download data as TSV",
49
  data = top_coexp_hits.to_csv(sep ='\t').encode('utf-8'),
50
+ file_name = f"top_coexp_hits_{gene_id}.tsv",
51
+ mime = "text/csv")
52
 
53
+ AgGrid(
54
+ dataframe = top_coexp_hits,
55
+ gridOptions = GridOptionsBuilder()
56
+ .configure_default_column(
57
+ filterable=False,
58
+ groupable=False,
59
+ editable=False,
60
+ wrapText=True,
61
+ autoHeight=True)
62
+ .configure_column("gene_id_1", header_name="Gene ID 1", {"pinned": "left"})
63
+ .configure_column("gene_symbol_1", header_name="Gene 1", {"pinned": "left", "width": 10})
64
+ .configure_column("description_1", header_name="Description 1", {"width": 50})
65
+ .configure_column("gene_id_2", header_name="Gene ID 2", {"pinned": "left"})
66
+ .configure_column("gene_symbol_2", header_name="Gene 2", {"pinned": "left", "width": 10})
67
+ .configure_column("description_2", header_name="Description 2", {"width": 50})
68
+ .configure_column("coexp_score", header_name="Coexp Score", {"type": ["numericColumn", "customNumericFormat"], "precision": 3})
69
+ .configure_column("blast_EValue", header_name="Blast E-value", {"type": ["numericColumn", "customNumericFormat"], "precision": 3})
70
+ .configure_selection(selection_mode=False, use_checkbox=False)
71
+ .build(),
72
+ fit_columns_on_grid_load=True,
73
+ theme="streamlit")