Spaces:
Sleeping
Sleeping
Commit
·
b7303b4
1
Parent(s):
130287d
Update app.py
Browse files
app.py
CHANGED
@@ -140,6 +140,9 @@ if len(gene_list) > 1:
|
|
140 |
max_display=8
|
141 |
feature_names=df_shap.columns
|
142 |
gene_index = df_shap.index
|
|
|
|
|
|
|
143 |
for i in range(1, len(plotly_fig['data']), 2):
|
144 |
t = gene_index #plotly_fig['data']
|
145 |
plotly_fig['data'][i]['name'] = ''
|
@@ -162,7 +165,7 @@ if len(gene_list) > 1:
|
|
162 |
plotly_fig['layout']['height']=600
|
163 |
plotly_fig['layout']['width']=500
|
164 |
plotly_fig['layout']['xaxis'].update(zeroline=True, showline=True, ticklen=4, showgrid=False)
|
165 |
-
plotly_fig['layout']['yaxis'].update(dict(visible=True))
|
166 |
plotly_fig.add_trace(colorbar_trace)
|
167 |
plotly_fig.layout.update(
|
168 |
annotations=[dict(
|
|
|
140 |
max_display=8
|
141 |
feature_names=df_shap.columns
|
142 |
gene_index = df_shap.index
|
143 |
+
feature_order = np.argsort(np.sum(np.abs(shap_values), axis=0)[:-1])
|
144 |
+
feature_order = feature_order[-min(8, len(feature_order)):]
|
145 |
+
col_order = [df.columns[i] for i in feature_order]
|
146 |
for i in range(1, len(plotly_fig['data']), 2):
|
147 |
t = gene_index #plotly_fig['data']
|
148 |
plotly_fig['data'][i]['name'] = ''
|
|
|
165 |
plotly_fig['layout']['height']=600
|
166 |
plotly_fig['layout']['width']=500
|
167 |
plotly_fig['layout']['xaxis'].update(zeroline=True, showline=True, ticklen=4, showgrid=False)
|
168 |
+
plotly_fig['layout']['yaxis'].update(col_order) #(dict(visible=True))
|
169 |
plotly_fig.add_trace(colorbar_trace)
|
170 |
plotly_fig.layout.update(
|
171 |
annotations=[dict(
|