Skip to content

Latest commit

 

History

145 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

3DICE: Interpretable 3D Cross-Modal Learning for Drug–Target Interaction Prediction

Drug–target interaction (DTI) prediction is a crucial step in modern drug discovery. Accurate and efficient predictions can substantially reduce costs and development time. Applications of deep learning methods for this purpose have been extensively studied in recent years, yielding instrumental contributions to this field. However, existing methods face issues pertaining to efficient learning of drug and target feature representations, which is detrimental to generalisability and performance in cold-start scenarios. Most approaches extract representations from SMILES strings for drugs and FASTA sequences for target proteins, which encode limited 3D structural information. Additionally, many models lack explainability, being black boxes that provide little physical insight into the underlying mechanisms behind such interactions. To address these limitations, we propose 3DICE, a novel framework leveraging cross-attention-based fusion and massively pre-trained 3D structural encoders for both drugs and proteins. UniMol and ESM-IF1 are employed to generate high-fidelity, 3D structure-aware embeddings which enable richer geometric and chemical understanding. Cross-modal fusion modules further augment representations to model intermolecular binding relationships. Importantly, this mechanism also provides intrinsic interpretability, highlighting and enabling qualitative analysis of most influential atoms or residues. Experiments conducted on two canonical benchmark datasets display the competitiveness of our model in real-world scenarios. 3DICE outperformed state-of-the-art models across multiple metrics on the DrugBank and KIBA datasets. Additional experiments provide a more rigorous analysis of interpretability than is typically reported in prior DTI studies, and we find that attention consistently highlights decision-critical regions which is not intrinsically class-specific.

Quick Start

1) Environment

Create the Conda environment:

conda env create -f environment.yml
conda activate SRP

Model dependencies (from environment.yml):

  • Core: PyTorch (torch), NumPy, pandas
  • Protein embeddings: fair-esm, biotite, gemmi
  • Drug embeddings: unimol-tools, rdkit
  • GNN/graph utilities: torch-geometric, torch-scatter
  • Config + metrics: yacs, scikit-learn
  • Plotting + utilities: matplotlib, tqdm

2) Data Layout

3DICE expects three CSV splits and embedding folders (defaults in config/cfg.py):

  • CSVs: lists/db_train.csv, lists/db_val.csv, lists/db_test.csv

    • Required columns: uniprot_id, drug_id, interaction (0/1)
    • Optional column: SMILES (used by drug embedding script)
  • Protein embeddings: embeddings/

    • Per-Protein folder: embeddings/{uniprot_id}/...
    • Latest *.pt file in each folder is loaded as the token sequence (e.g., per-residue 512-D vectors).
    • Protein embeddings should be computed with Python 3.10 (see ESM‑IF1 section)
  • Drug embeddings: drug/embeddings_atomic/

    • Per-Drug file: {drug_id}.pt or {drug_id}_unimol.pt (contains atomic_reprs → reshaped to (L_atoms, 512)).

You can change paths in config/cfg.py:

  • DATA.TRAIN_CSV_PATH, DATA.VAL_CSV_PATH, DATA.TEST_CSV_PATH
  • DATA.PROTEIN_DIR, DATA.DRUG_DIR

3) Generate Drug Embeddings (UniMol)

If your CSVs include SMILES, generate UniMol atomic embeddings:

Edit input/output in drug/02_embed_drugs.py if needed (defaults to lists/db_train.csv and drug/embeddings_atomic/), then run:

python drug/02_embed_drugs.py

This writes drug/embeddings_atomic/{drug_id}.pt with atomic representations.

4) Train

Run the training loop in solver.py:

python solver.py

Outputs

Adjust training config in config/cfg.py:

  • SOLVER.BATCH_SIZE, SOLVER.EPOCHS, SOLVER.LR, SOLVER.WEIGHT_DECAY, SOLVER.DROPOUT
  • SOLVER.LOSS_FN: "cross_entropy"
  • Model dims: DRUG.*, PROTEIN.*, MLP.*

5) Evaluate

Set your checkpoint path in eval.py (CKPT_PATH at the top), then:

python eval.py

Interpretability

Use attentiontest.py to inspect residue–atom attention for a specific pair.

Example (choose your own IDs and checkpoint):

python attentiontest.py \
	--ckpt saved/model_XXXXXXXX_epoch_YY.pt \
	--csv lists/db_train.csv \
	--drug_id DB00001 \
	--uniprot_id P00533 \
	--top_k 20 \
	--plot_style poster \
	--save_plots

Flags (selected)

  • --joint_mode {geom,arith,harm,prod,min}: combine bidirectional attentions into joint scores.
  • --atom_labels {none,topk,all} and --label_with_weight: control py3Dmol labeling in 3D views.
  • --save_plots, --save_dir, --save_formats: persist figures for papers/posters.

ESM‑IF1 Embeddings (Python 3.10)

ESM‑IF1 (inverse folding) embeddings are structure‑conditioned per‑residue features (512‑D) computed from PDB/mmCIF backbones. We create a separate Python 3.10 env for maximum compatibility with fair-esm and geometry parsers.

Environment (separate env)

conda create -n 3DICE-ESMIF1 python=3.10 -y
conda activate 3DICE-ESMIF1

pip install torch torchvision torchaudio
pip install fair-esm biotite gemmi tqdm numpy pandas

Fetch structures

python protein/01_fetch_structures_v2.py \
  --input_csv lists/db_train.csv \
  --uniprot_col uniprot_id \
  --out_dir structures \
  --format mmcif \
  --min_coverage 0.2 \
  --alphafold_fallback 1

Embeddings can be computed using protein/02_embed_protein_3D.py

About

3DICE: Interpretable 3D Cross-Modal Learning for Drug—Target Interaction Prediction and Large-Scale Drug Discovery

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages