jfaustin commited on
Commit
304c449
·
1 Parent(s): 9213ba3

remove bad score

Browse files
Files changed (2) hide show
  1. .gitignore +3 -1
  2. app.py +12 -6
.gitignore CHANGED
@@ -1,3 +1,5 @@
1
  .envrc
2
 
3
- boltz_results/
 
 
 
1
  .envrc
2
 
3
+ boltz_results/
4
+
5
+ **/__pycache__/
app.py CHANGED
@@ -191,12 +191,18 @@ def add_plddt_plot(plddt_vals: list[float]) -> str:
191
  def fake_predict_and_correlate(spr_data_with_scores: pd.DataFrame, score_cols: list[str]) -> tuple[pd.DataFrame, go.Figure]:
192
  """Fake predict structures of all complexes and correlate the results."""
193
  corr_data = []
 
 
194
  for score_col in score_cols:
195
- logging.info("Computing correlation between %s and KD (nM)", score_col)
196
- res = spearmanr(spr_data_with_scores["KD (nM)"], spr_data_with_scores[score_col])
197
  corr_data.append({"score": score_col, "correlation": res.statistic, "p-value": res.pvalue})
 
198
 
199
  corr_data = pd.DataFrame(corr_data)
 
 
 
200
  # Sort correlation data by correlation value
201
  corr_data = corr_data.sort_values('correlation', ascending=True)
202
 
@@ -223,16 +229,16 @@ def fake_predict_and_correlate(spr_data_with_scores: pd.DataFrame, score_cols: l
223
  for score_col in score_cols:
224
  scatters.append(
225
  go.Scatter(
226
- x=spr_data_with_scores["KD (nM)"],
227
  y=spr_data_with_scores[score_col],
228
- name=f"KD (nM) vs {score_col}",
229
  mode='markers', # Only show markers/dots, no lines
230
- hovertemplate="<i>Score:</i> %{y}<br><i>KD (nM):</i> %{x:.2f}<br>"
231
  )
232
  )
233
  corr_plot = go.Figure(data=scatters)
234
 
235
- cols_to_show = ["KD (nM)"]
236
  cols_to_show.extend(score_cols)
237
 
238
  return spr_data_with_scores[cols_to_show], corr_ranking_plot, corr_plot
 
191
  def fake_predict_and_correlate(spr_data_with_scores: pd.DataFrame, score_cols: list[str]) -> tuple[pd.DataFrame, go.Figure]:
192
  """Fake predict structures of all complexes and correlate the results."""
193
  corr_data = []
194
+ spr_data_with_scores["log_kd"] = np.log10(spr_data_with_scores["KD (nM)"])
195
+ kd_col = "KD (nM)"
196
  for score_col in score_cols:
197
+ logger.info(f"Computing correlation between {score_col} and KD (nM)")
198
+ res = spearmanr(spr_data_with_scores[kd_col], spr_data_with_scores[score_col])
199
  corr_data.append({"score": score_col, "correlation": res.statistic, "p-value": res.pvalue})
200
+ logger.info(f"Correlation between {score_col} and KD (nM): {res.statistic}")
201
 
202
  corr_data = pd.DataFrame(corr_data)
203
+ # Find the lines in corr_data with NaN values and remove them
204
+ corr_data = corr_data[corr_data["correlation"].notna()]
205
+ logger.info("Correlation data: %s", corr_data)
206
  # Sort correlation data by correlation value
207
  corr_data = corr_data.sort_values('correlation', ascending=True)
208
 
 
229
  for score_col in score_cols:
230
  scatters.append(
231
  go.Scatter(
232
+ x=spr_data_with_scores[kd_col],
233
  y=spr_data_with_scores[score_col],
234
+ name=f"{kd_col} vs {score_col}",
235
  mode='markers', # Only show markers/dots, no lines
236
+ hovertemplate="<i>Score:</i> %{y}<br><i>KD:</i> %{x:.2f}<br>"
237
  )
238
  )
239
  corr_plot = go.Figure(data=scatters)
240
 
241
+ cols_to_show = [kd_col]
242
  cols_to_show.extend(score_cols)
243
 
244
  return spr_data_with_scores[cols_to_show], corr_ranking_plot, corr_plot