jfaustin commited on
Commit
03588ca
Β·
1 Parent(s): a4dc94e
Files changed (1) hide show
  1. folding_studio_demo/app.py +54 -54
folding_studio_demo/app.py CHANGED
@@ -158,7 +158,6 @@ def fake_predict_and_correlate(spr_data_with_scores: pd.DataFrame, score_cols: l
158
  corr_data = pd.DataFrame(corr_data)
159
  # Find the lines in corr_data with NaN values and remove them
160
  corr_data = corr_data[corr_data["correlation"].notna()]
161
- logger.info("Correlation data: %s", corr_data)
162
  # Sort correlation data by correlation value
163
  corr_data = corr_data.sort_values('correlation', ascending=True)
164
 
@@ -199,6 +198,59 @@ def fake_predict_and_correlate(spr_data_with_scores: pd.DataFrame, score_cols: l
199
 
200
  return spr_data_with_scores[cols_to_show], corr_ranking_plot, corr_plot
201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  def __main__():
203
  with gr.Blocks(title="Folding Studio Demo") as demo:
204
  gr.Markdown(
@@ -222,58 +274,6 @@ def __main__():
222
  with gr.Tab("πŸ“Š Model Comparison"):
223
  model_comparison(api_key)
224
  with gr.Tab("πŸ” Correlations"):
225
- gr.Markdown("# Upload binding affinity data")
226
- spr_data_with_scores = pd.read_csv("spr_af_scores_mapped.csv")
227
- with gr.Row():
228
- csv_file = gr.File(label="Upload CSV file", file_types=[".csv"])
229
- with gr.Row():
230
- dataframe = gr.Dataframe(label="Binding Affinity Data")
231
-
232
- gr.Markdown("# Prediction and correlation")
233
- with gr.Row():
234
- with gr.Column():
235
- with gr.Row():
236
- fake_predict_btn = gr.Button("Predict structures of all complexes")
237
- with gr.Row():
238
- prediction_dataframe = gr.Dataframe(label="Predicted Structures Data")
239
- with gr.Column():
240
- correlation_ranking_plot = gr.Plot(label="Correlation ranking")
241
- correlation_plot = gr.Plot(label="Correlation with binding affinity")
242
-
243
-
244
-
245
- cols = [
246
- "confidence_score_boltz",
247
- "ptm_boltz",
248
- "iptm_boltz",
249
- "complex_plddt_boltz",
250
- "complex_iplddt_boltz",
251
- "complex_pde_boltz",
252
- "complex_ipde_boltz",
253
- "interchain_pae_monomer",
254
- "interface_pae_monomer",
255
- "overall_pae_monomer",
256
- "interface_plddt_monomer",
257
- "average_plddt_monomer",
258
- "ptm_monomer",
259
- "interface_ptm_monomer",
260
- "interchain_pae_multimer",
261
- "interface_pae_multimer",
262
- "overall_pae_multimer",
263
- "interface_plddt_multimer",
264
- "average_plddt_multimer",
265
- "ptm_multimer",
266
- "interface_ptm_multimer"
267
- ]
268
- csv_file.change(
269
- fn=lambda file: spr_data_with_scores.drop(columns=cols) if file else None,
270
- inputs=csv_file,
271
- outputs=dataframe
272
- )
273
- fake_predict_btn.click(
274
- fn=lambda x: fake_predict_and_correlate(spr_data_with_scores, cols),
275
- inputs=None,
276
- outputs=[prediction_dataframe, correlation_ranking_plot, correlation_plot]
277
- )
278
 
279
  demo.launch()
 
158
  corr_data = pd.DataFrame(corr_data)
159
  # Find the lines in corr_data with NaN values and remove them
160
  corr_data = corr_data[corr_data["correlation"].notna()]
 
161
  # Sort correlation data by correlation value
162
  corr_data = corr_data.sort_values('correlation', ascending=True)
163
 
 
198
 
199
  return spr_data_with_scores[cols_to_show], corr_ranking_plot, corr_plot
200
 
201
+ def create_correlation_tab():
202
+ gr.Markdown("# Upload binding affinity data")
203
+ spr_data_with_scores = pd.read_csv("spr_af_scores_mapped.csv")
204
+ with gr.Row():
205
+ csv_file = gr.File(label="Upload CSV file", file_types=[".csv"])
206
+ with gr.Row():
207
+ dataframe = gr.Dataframe(label="Binding Affinity Data")
208
+
209
+ gr.Markdown("# Prediction and correlation")
210
+ with gr.Row():
211
+ with gr.Column():
212
+ with gr.Row():
213
+ fake_predict_btn = gr.Button("Predict structures of all complexes")
214
+ with gr.Row():
215
+ prediction_dataframe = gr.Dataframe(label="Predicted Structures Data")
216
+ with gr.Column():
217
+ correlation_ranking_plot = gr.Plot(label="Correlation ranking")
218
+ correlation_plot = gr.Plot(label="Correlation with binding affinity")
219
+
220
+ cols = [
221
+ "confidence_score_boltz",
222
+ "ptm_boltz",
223
+ "iptm_boltz",
224
+ "complex_plddt_boltz",
225
+ "complex_iplddt_boltz",
226
+ "complex_pde_boltz",
227
+ "complex_ipde_boltz",
228
+ "interchain_pae_monomer",
229
+ "interface_pae_monomer",
230
+ "overall_pae_monomer",
231
+ "interface_plddt_monomer",
232
+ "average_plddt_monomer",
233
+ "ptm_monomer",
234
+ "interface_ptm_monomer",
235
+ "interchain_pae_multimer",
236
+ "interface_pae_multimer",
237
+ "overall_pae_multimer",
238
+ "interface_plddt_multimer",
239
+ "average_plddt_multimer",
240
+ "ptm_multimer",
241
+ "interface_ptm_multimer"
242
+ ]
243
+ csv_file.change(
244
+ fn=lambda file: spr_data_with_scores.drop(columns=cols) if file else None,
245
+ inputs=csv_file,
246
+ outputs=dataframe
247
+ )
248
+ fake_predict_btn.click(
249
+ fn=lambda x: fake_predict_and_correlate(spr_data_with_scores, cols),
250
+ inputs=None,
251
+ outputs=[prediction_dataframe, correlation_ranking_plot, correlation_plot]
252
+ )
253
+
254
  def __main__():
255
  with gr.Blocks(title="Folding Studio Demo") as demo:
256
  gr.Markdown(
 
274
  with gr.Tab("πŸ“Š Model Comparison"):
275
  model_comparison(api_key)
276
  with gr.Tab("πŸ” Correlations"):
277
+ create_correlation_tab()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
 
279
  demo.launch()