IlPakoZ commited on
Commit
1df61c5
·
verified ·
1 Parent(s): 061dd46

Fixed implementation

Browse files
Files changed (1) hide show
  1. app.py +15 -13
app.py CHANGED
@@ -334,23 +334,25 @@ class DrugTargetInteractionApp:
334
  # Initialize the app
335
  app = DrugTargetInteractionApp()
336
 
337
- def smiles_preprocessing(drug_smiles):
338
  drugs = drug_smiles.strip().split("\n")
339
 
340
  # Remove molecule duplicates in O(n) while preserving the order
341
- seen = set()
342
- sorted_drugs = []
 
343
 
344
- kept = 0
345
-
346
- for x in drugs:
347
- if x not in seen:
348
- seen.add(x)
349
- sorted_drugs.append(x)
350
- kept += 1
351
 
352
- logger.info(f"{kept-len(drugs)} duplicate smiles removed!")
353
- return sorted_drugs
 
354
 
355
  def predict_wrapper(target_seq, drug_smiles, remove_dups):
356
  """Wrapper function for Gradio interface"""
@@ -417,7 +419,7 @@ with gr.Blocks(title="Drug-Target Interaction Predictor", theme=gr.themes.Soft()
417
 
418
  remove_dups_checkbox = gr.Checkbox(
419
  label="Remove duplicate SMILES",
420
- value=True
421
  )
422
 
423
  with gr.Row():
 
334
  # Initialize the app
335
  app = DrugTargetInteractionApp()
336
 
337
+ def smiles_preprocessing(drug_smiles, remove_dupl):
338
  drugs = drug_smiles.strip().split("\n")
339
 
340
  # Remove molecule duplicates in O(n) while preserving the order
341
+ if remove_dupl:
342
+ seen = set()
343
+ sorted_drugs = []
344
 
345
+ kept = 0
346
+
347
+ for x in drugs:
348
+ if x not in seen:
349
+ seen.add(x)
350
+ sorted_drugs.append(x)
351
+ kept += 1
352
 
353
+ logger.info(f"{kept-len(drugs)} duplicate smiles removed!")
354
+ return sorted_drugs
355
+ return drugs
356
 
357
  def predict_wrapper(target_seq, drug_smiles, remove_dups):
358
  """Wrapper function for Gradio interface"""
 
419
 
420
  remove_dups_checkbox = gr.Checkbox(
421
  label="Remove duplicate SMILES",
422
+ value=False
423
  )
424
 
425
  with gr.Row():