Spaces:
Sleeping
Sleeping
Commit
·
89c1ddc
1
Parent(s):
6ccef40
Update app.py
Browse files
app.py
CHANGED
@@ -79,6 +79,12 @@ explainer = shap.TreeExplainer(xgb)
|
|
79 |
def convert_df(df):
|
80 |
return df.to_csv(index=False).encode('utf-8')
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
if len(gene_list) > 1:
|
84 |
df = df_total[df_total.index.isin(gene_list)]
|
@@ -104,7 +110,7 @@ if len(gene_list) > 1:
|
|
104 |
df_shap.drop(columns='XGB_Score', inplace=True)
|
105 |
shap_values = explainer.shap_values(df_shap)
|
106 |
#summary_plot = shap.summary_plot(shap_values, df_shap)
|
107 |
-
summary_plot = shap_summary_plot(shap_values, features=
|
108 |
st.pyplot(fig=summary_plot)
|
109 |
st.caption("SHAP Summary Plot of All Input Genes")
|
110 |
feature_order = np.argsort(np.sum(np.abs(shap_values), axis=0)[:-1])
|
@@ -128,7 +134,7 @@ st.dataframe(df2)
|
|
128 |
|
129 |
if input_gene:
|
130 |
if ' ' in input_gene or ',' in input_gene:
|
131 |
-
st.write('Please input only a single HGNC gene name.')
|
132 |
else:
|
133 |
df2_shap = df_total[df_total.index == input_gene]
|
134 |
df2_shap.drop(columns='XGB_Score', inplace=True)
|
@@ -146,7 +152,7 @@ else:
|
|
146 |
pass
|
147 |
|
148 |
st.markdown("""
|
149 |
-
Total Gene Prioritisation Results:
|
150 |
""")
|
151 |
|
152 |
df_total_output = df_total
|
|
|
79 |
def convert_df(df):
|
80 |
return df.to_csv(index=False).encode('utf-8')
|
81 |
|
82 |
+
features = df[['Gene','XGB_Score', 'mousescore_Exomiser',
|
83 |
+
'SDI', 'Liver_GTExTPM', 'pLI_ExAC',
|
84 |
+
'HIPred',
|
85 |
+
'Cells - EBV-transformed lymphocytes_GTExTPM',
|
86 |
+
'Pituitary_GTExTPM',
|
87 |
+
'IPA_BP_annotation']]
|
88 |
|
89 |
if len(gene_list) > 1:
|
90 |
df = df_total[df_total.index.isin(gene_list)]
|
|
|
110 |
df_shap.drop(columns='XGB_Score', inplace=True)
|
111 |
shap_values = explainer.shap_values(df_shap)
|
112 |
#summary_plot = shap.summary_plot(shap_values, df_shap)
|
113 |
+
summary_plot = shap_summary_plot(shap_values, features=features, feature_names=features.columns, max_display=8)
|
114 |
st.pyplot(fig=summary_plot)
|
115 |
st.caption("SHAP Summary Plot of All Input Genes")
|
116 |
feature_order = np.argsort(np.sum(np.abs(shap_values), axis=0)[:-1])
|
|
|
134 |
|
135 |
if input_gene:
|
136 |
if ' ' in input_gene or ',' in input_gene:
|
137 |
+
st.write('Input Error: Please input only a single HGNC gene name with no white spaces or commas.')
|
138 |
else:
|
139 |
df2_shap = df_total[df_total.index == input_gene]
|
140 |
df2_shap.drop(columns='XGB_Score', inplace=True)
|
|
|
152 |
pass
|
153 |
|
154 |
st.markdown("""
|
155 |
+
### Total Gene Prioritisation Results:
|
156 |
""")
|
157 |
|
158 |
df_total_output = df_total
|