Spaces:
Sleeping
Sleeping
Commit
·
5e24005
1
Parent(s):
1b01b6f
Update app.py
Browse files
app.py
CHANGED
@@ -69,19 +69,20 @@ def convert_df(df):
|
|
69 |
if len(gene_list) > 1:
|
70 |
df = df_total[df_total.index.isin(gene_list)]
|
71 |
st.dataframe(df)
|
|
|
72 |
df['Gene'] = df.index
|
73 |
output = df[['Gene', 'XGB_Score']]
|
74 |
csv = convert_df(output)
|
75 |
st.download_button(
|
76 |
-
"Download Gene
|
77 |
csv,
|
78 |
"bp_gene_prioritisation.csv",
|
79 |
"text/csv",
|
80 |
key='download-csv'
|
81 |
)
|
82 |
-
|
83 |
-
shap_values = explainer.shap_values(
|
84 |
-
summary_plot = shap.summary_plot(shap_values,
|
85 |
st.caption("SHAP Summary Plot of All Input Genes")
|
86 |
st.pyplot(fig=summary_plot)
|
87 |
|
|
|
69 |
if len(gene_list) > 1:
|
70 |
df = df_total[df_total.index.isin(gene_list)]
|
71 |
st.dataframe(df)
|
72 |
+
df_shap = df
|
73 |
df['Gene'] = df.index
|
74 |
output = df[['Gene', 'XGB_Score']]
|
75 |
csv = convert_df(output)
|
76 |
st.download_button(
|
77 |
+
"Download Gene Prioritisation",
|
78 |
csv,
|
79 |
"bp_gene_prioritisation.csv",
|
80 |
"text/csv",
|
81 |
key='download-csv'
|
82 |
)
|
83 |
+
df_shap.drop(columns='XGB_Score', inplace=True)
|
84 |
+
shap_values = explainer.shap_values(df_shap)
|
85 |
+
summary_plot = shap.summary_plot(shap_values, df_shap, show=False)
|
86 |
st.caption("SHAP Summary Plot of All Input Genes")
|
87 |
st.pyplot(fig=summary_plot)
|
88 |
|