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.
Create the Conda environment:
conda env create -f environment.yml
conda activate SRPModel 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
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)
- Required columns:
-
Protein embeddings: embeddings/
- Per-Protein folder:
embeddings/{uniprot_id}/... - Latest
*.ptfile 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)
- Per-Protein folder:
-
Drug embeddings: drug/embeddings_atomic/
- Per-Drug file:
{drug_id}.ptor{drug_id}_unimol.pt(containsatomic_reprs→ reshaped to(L_atoms, 512)).
- Per-Drug file:
You can change paths in config/cfg.py:
DATA.TRAIN_CSV_PATH,DATA.VAL_CSV_PATH,DATA.TEST_CSV_PATHDATA.PROTEIN_DIR,DATA.DRUG_DIR
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.pyThis writes drug/embeddings_atomic/{drug_id}.pt with atomic representations.
Run the training loop in solver.py:
python solver.pyOutputs
- Checkpoints: saved/ and best models in best_models/ (created on first run).
- Metrics log: logs/training_log_YYYYMMDD_HHMMSS.csv with loss, accuracy, MCC, AUC, AUPRC, confusion counts, epoch time.
Adjust training config in config/cfg.py:
SOLVER.BATCH_SIZE,SOLVER.EPOCHS,SOLVER.LR,SOLVER.WEIGHT_DECAY,SOLVER.DROPOUTSOLVER.LOSS_FN:"cross_entropy"- Model dims:
DRUG.*,PROTEIN.*,MLP.*
Set your checkpoint path in eval.py (CKPT_PATH at the top), then:
python eval.pyUse 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_plotsFlags (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 (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 pandasFetch structures
- Use protein/01_fetch_structures_v2.py to download mmCIF/PDB per UniProt ID:
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 1Embeddings can be computed using protein/02_embed_protein_3D.py