roman-bushuiev commited on
Commit
586f664
·
1 Parent(s): 85d915b

Fix similarity threshold

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -343,9 +343,9 @@ def _create_result_row(i, j, n, msdata, msdata_lib, sims, cos_sim, embs, calcula
343
  'precursor_mz': msdata.get_prec_mzs(i),
344
  'topk': n + 1,
345
  'library_j': j,
346
- 'library_SMILES': smiles_to_html_img(smiles) if dreams_similarity >= SIMILARITY_THRESHOLD else None,
347
  'library_SMILES_raw': smiles,
348
- 'Spectrum': spectrum_to_html_img(spec1, spec2) if dreams_similarity >= SIMILARITY_THRESHOLD else None,
349
  'Spectrum_raw': su.unpad_peak_list(spec1),
350
  'library_ID': msdata_lib.get_values('IDENTIFIER', j),
351
  'DreaMS_similarity': dreams_similarity,
@@ -423,7 +423,7 @@ def _process_results_dataframe(df, in_pth, calculate_modified_cosine=False):
423
  df = df.drop(columns=['DreaMS embedding', "SMILES", "Input Spectrum"])
424
  df = df[df['Top k'] == 1].sort_values('DreaMS similarity', ascending=False)
425
  df = df.drop(columns=['Top k'])
426
- df = df[df["DreaMS similarity"] >= SIMILARITY_THRESHOLD]
427
 
428
  # Add row numbers
429
  df.insert(0, 'Row', range(1, len(df) + 1))
 
343
  'precursor_mz': msdata.get_prec_mzs(i),
344
  'topk': n + 1,
345
  'library_j': j,
346
+ 'library_SMILES': smiles_to_html_img(smiles) if dreams_similarity > SIMILARITY_THRESHOLD else None,
347
  'library_SMILES_raw': smiles,
348
+ 'Spectrum': spectrum_to_html_img(spec1, spec2) if dreams_similarity > SIMILARITY_THRESHOLD else None,
349
  'Spectrum_raw': su.unpad_peak_list(spec1),
350
  'library_ID': msdata_lib.get_values('IDENTIFIER', j),
351
  'DreaMS_similarity': dreams_similarity,
 
423
  df = df.drop(columns=['DreaMS embedding', "SMILES", "Input Spectrum"])
424
  df = df[df['Top k'] == 1].sort_values('DreaMS similarity', ascending=False)
425
  df = df.drop(columns=['Top k'])
426
+ df = df[df["DreaMS similarity"] > SIMILARITY_THRESHOLD]
427
 
428
  # Add row numbers
429
  df.insert(0, 'Row', range(1, len(df) + 1))