Skip to content

Commit

Permalink
Merge pull request #359 from MannLabs/refactor_volcano_I
Browse files Browse the repository at this point in the history
Refactor volcano i
  • Loading branch information
mschwoer authored Nov 14, 2024
2 parents 85a9409 + adc02c7 commit d2411eb
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 343 deletions.
27 changes: 13 additions & 14 deletions alphastats/gui/pages/05_LLM.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,36 +93,35 @@ def llm_config():
c1, c2 = st.columns((1, 2))

with c1:
# TODO move this to volcano anyway ?
genes_of_interest_colored_df = volcano_plot.get_colored_labels_df()

genes_of_interest_df = volcano_plot.get_colored_labels_df()
gene_names_colname = st.session_state[StateKeys.LOADER].gene_names
prot_ids_colname = st.session_state[StateKeys.LOADER].index_column

gene_to_prot_id_map = dict( # TODO move this logic to dataset
zip(
genes_of_interest_colored_df[gene_names_colname].tolist(),
genes_of_interest_colored_df[prot_ids_colname].tolist(),
genes_of_interest_df[gene_names_colname].tolist(),
genes_of_interest_df[prot_ids_colname].tolist(),
)
)

with c2:
display_figure(volcano_plot.plot)

genes_of_interest_colored = volcano_plot.get_colored_labels()
if not genes_of_interest_colored:
st.text("No proteins of interest found.")
labels = [
";".join([i for i in j.split(";") if i])
for j in genes_of_interest_df.res["label"].tolist()
]
genes_of_interest = dict(zip(labels, genes_of_interest_df.res["color"].tolist()))

if not genes_of_interest:
st.text("No genes of interest found.")
st.stop()

upregulated_genes = [
key
for key in genes_of_interest_colored
if genes_of_interest_colored[key] == "up"
key for key in genes_of_interest if genes_of_interest[key] == "up"
]
downregulated_genes = [
key
for key in genes_of_interest_colored
if genes_of_interest_colored[key] == "down"
key for key in genes_of_interest if genes_of_interest[key] == "down"
]

st.markdown("##### Genes of interest")
Expand Down
Loading

0 comments on commit d2411eb

Please sign in to comment.