Samad14 commited on
Commit
00a7603
·
verified ·
1 Parent(s): e8003ee

Upload folder using huggingface_hub

Browse files
app/.source-revision CHANGED
@@ -1 +1 @@
1
- 890ab380796fbc019ce3bb08373633e3efe0dc61
 
1
+ 20604c151af7374778f80923511921b945a18199
app/services/rdkit_interactions.py CHANGED
@@ -383,10 +383,21 @@ def calculate_interactions(protein_pdb: str, ligand_pdb: str, ligand_smiles: str
383
  "method": "RDKit Hydrophobe chemical features + heavy-atom distance",
384
  })
385
 
386
- # Formal charge features are required on BOTH partners.
 
 
 
 
 
 
 
 
 
 
 
387
  for positive_mol, positive_ids, negative_mol, negative_ids, label in (
388
- (ligand, lf["PosIonizable"], protein, pf["NegIonizable"], "ligand_positive_protein_negative"),
389
- (protein, pf["PosIonizable"], ligand, lf["NegIonizable"], "protein_positive_ligand_negative"),
390
  ):
391
  for pos in positive_ids:
392
  for neg in negative_ids:
 
383
  "method": "RDKit Hydrophobe chemical features + heavy-atom distance",
384
  })
385
 
386
+ # RDKit PosIonizable/NegIonizable features are pharmacophore patterns,
387
+ # not proof of an actual formal charge. For the submitted ligand, require
388
+ # an explicit formal charge so neutral heteroaromatics (e.g. caffeine)
389
+ # cannot be mislabeled as salt-bridge partners.
390
+ ligand_positive = {
391
+ idx for idx in lf["PosIonizable"]
392
+ if ligand.GetAtomWithIdx(idx).GetFormalCharge() > 0
393
+ }
394
+ ligand_negative = {
395
+ idx for idx in lf["NegIonizable"]
396
+ if ligand.GetAtomWithIdx(idx).GetFormalCharge() < 0
397
+ }
398
  for positive_mol, positive_ids, negative_mol, negative_ids, label in (
399
+ (ligand, ligand_positive, protein, pf["NegIonizable"], "ligand_positive_protein_negative"),
400
+ (protein, pf["PosIonizable"], ligand, ligand_negative, "protein_positive_ligand_negative"),
401
  ):
402
  for pos in positive_ids:
403
  for neg in negative_ids: