Spaces:
Sleeping
Sleeping
Commit
·
4c9462b
1
Parent(s):
793b6bd
Update app.py
Browse files
app.py
CHANGED
@@ -58,37 +58,37 @@ st.set_option('deprecation.showPyplotGlobalUse', False)
|
|
58 |
cwd=os.getcwd()+'/'#+'data/'
|
59 |
@st.cache_data
|
60 |
def get_data():
|
61 |
-
if 'adata_annot' not in st.session_state or 'cell_type' not in st.session_state or 'broad_type' not in st.session_state:
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
|
79 |
#Also load Go Terms
|
80 |
-
if 'go_table' not in st.session_state:
|
81 |
-
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
#done load Data
|
93 |
|
94 |
|
|
|
58 |
cwd=os.getcwd()+'/'#+'data/'
|
59 |
@st.cache_data
|
60 |
def get_data():
|
61 |
+
#if 'adata_annot' not in st.session_state or 'cell_type' not in st.session_state or 'broad_type' not in st.session_state:
|
62 |
+
adata_annot = sc.read_h5ad(cwd+'multiregion_brainaging_annotated.h5ad')
|
63 |
+
st.session_state['adata_annot'] = adata_annot
|
64 |
+
if 'genes_list' not in st.session_state:
|
65 |
+
genes=adata_annot.var.index
|
66 |
+
#genes_list=sorted(genes.unique())
|
67 |
+
st.session_state['genes_list'] = sorted(genes.unique())
|
68 |
+
if 'cell_type' not in st.session_state:
|
69 |
+
#cell_type=diff_fdr[diff_fdr.type=='cell_type']['tissue']
|
70 |
+
#cell_type=sorted(cell_type.unique())
|
71 |
+
anno=adata_annot.obs.new_anno
|
72 |
+
#cell_type=sorted(anno.unique())
|
73 |
+
st.session_state['cell_type'] = sorted(anno.unique())
|
74 |
+
if 'broad_type' not in st.session_state:
|
75 |
+
broad_celltype=adata_annot.obs.broad_celltype
|
76 |
+
#broad_type=sorted(broad_type.unique())
|
77 |
+
st.session_state['broad_type'] = sorted(broad_celltype.unique())
|
78 |
|
79 |
#Also load Go Terms
|
80 |
+
# if 'go_table' not in st.session_state:
|
81 |
+
bp = pathway_analyses.read_pathways('pathway_databases/GO_Biological_Process_2021.txt')
|
82 |
|
83 |
+
go_bp_paths = bp.set_index(0)
|
84 |
+
go_bp_paths.fillna("", inplace=True)
|
85 |
+
go_bp_paths_dict = go_bp_paths.to_dict(orient='index')
|
86 |
|
87 |
|
88 |
+
gene_set_by_path = {key: [val for val in value.values() if val != ""] for key, value in go_bp_paths_dict.items()}
|
89 |
+
gene_set_by_path = pd.DataFrame.from_dict(gene_set_by_path, orient='index').transpose()
|
90 |
+
st.session_state['path_ways']=gene_set_by_path.columns
|
91 |
+
st.session_state['go_table']=gene_set_by_path
|
92 |
#done load Data
|
93 |
|
94 |
|