hlnicholls commited on
Commit
2ab2dc2
·
1 Parent(s): 33c190e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -11
app.py CHANGED
@@ -7,17 +7,14 @@ import xgboost
7
  import shap
8
  st.set_option('deprecation.showPyplotGlobalUse', False)
9
 
10
- # CSS to inject contained in a string
11
- hide_table_row_index = """
12
  <style>
13
- thead tr th:first-child {display:none}
14
- tbody th {display:none}
15
  </style>
16
  """
17
 
18
- # Inject CSS with Markdown
19
- st.markdown(hide_table_row_index, unsafe_allow_html=True)
20
-
21
  seed=42
22
 
23
  annotations = pd.read_csv("annotations_dataset.csv")
@@ -109,18 +106,18 @@ else:
109
 
110
  input_gene = st.text_input("Input individual HGNC gene:")
111
  df2 = df_total[df_total.index == input_gene]
112
- df2_shap = df_total[df_total.index == input_gene]
113
  df2['Gene'] = df2.index
114
  st.dataframe(df2)
115
- df2.drop(columns='XGB_Score', inplace=True)
116
 
117
  if input_gene:
 
 
118
  shap_values = explainer.shap_values(df2_shap)
119
  shap.getjs()
120
  force_plot = shap.force_plot(
121
  explainer.expected_value,
122
  shap_values,
123
- df2_shap ,
124
  matplotlib = True,show=False)
125
  st.pyplot(fig=force_plot)
126
  else:
@@ -130,5 +127,6 @@ st.markdown("""
130
  Total Gene Prioritisation Results:
131
  """)
132
 
133
- df_total['Gene'] = df_total.index
 
134
  st.dataframe(df_total)
 
7
  import shap
8
  st.set_option('deprecation.showPyplotGlobalUse', False)
9
 
10
+ hide_dataframe_row_index = """
 
11
  <style>
12
+ .row_heading.level0 {display:none}
13
+ .blank {display:none}
14
  </style>
15
  """
16
 
17
+ st.markdown(hide_dataframe_row_index, unsafe_allow_html=True)
 
 
18
  seed=42
19
 
20
  annotations = pd.read_csv("annotations_dataset.csv")
 
106
 
107
  input_gene = st.text_input("Input individual HGNC gene:")
108
  df2 = df_total[df_total.index == input_gene]
 
109
  df2['Gene'] = df2.index
110
  st.dataframe(df2)
 
111
 
112
  if input_gene:
113
+ df2_shap = df_total[df_total.index == input_gene]
114
+ df2_shap.drop(columns='XGB_Score', inplace=True)
115
  shap_values = explainer.shap_values(df2_shap)
116
  shap.getjs()
117
  force_plot = shap.force_plot(
118
  explainer.expected_value,
119
  shap_values,
120
+ df2_shap,
121
  matplotlib = True,show=False)
122
  st.pyplot(fig=force_plot)
123
  else:
 
127
  Total Gene Prioritisation Results:
128
  """)
129
 
130
+ df_total_output = df_total
131
+ df_total_output['Gene'] = df_total_output.index
132
  st.dataframe(df_total)