neuroGPCRs: Evaluation of Deep Learning Architectures for Predicting Ligand Interactions with Neurologically Relevant GPCRs
G protein-coupled receptors (GPCRs) are therapeutic targets for over 30% of approved drugs, yet specific GPCR subtypes act as molecular initiating events in several neurotoxic adverse outcome pathways. This repository implements seven deep learning architectures for predicting GPCR-ligand binding interactions, systematically evaluating the impact of encoder fine-tuning strategies.
- Training Set: 110 GPCRs with ligand binding data
- Validation Set: Random split from training distribution
- Test Set (Unseen ligands): Ligands not seen during training (cluster split)
- Test Set (Unseen proteins): 9 GPCRs not seen during training (random split)
- CosSim - Dual-projection cosine similarity networks
- Transformers - Transformer encoders on concatenated protein-ligand embeddings
- CA-Base - Cross-Attention with frozen protein and ligand encoders
- CA-Lig - Cross-Attention with fine-tuned ligand encoder
- CA-Prot - Cross-Attention with fine-tuned protein encoder
- CA-Full - Cross-Attention with fine-tuned protein and ligand encoders
- XGB - XGBoost baseline
All models leverage pre-trained language models (ProtBert for proteins, MolFormer for ligands) and are evaluated on multiple model generalization scenarios including unseen ligands and unseen proteins.
| Model | Accuracy | Sensitivity | Specificity | MCC | AUROC |
|---|---|---|---|---|---|
| CosSim | 0.715 ± 0.005 | 0.604 ± 0.015 | 0.819 ± 0.023 | 0.435 ± 0.013 | 0.786 ± 0.002 |
| Transformers | 0.706 ± 0.006 | 0.652 ± 0.030 | 0.756 ± 0.018 | 0.410 ± 0.012 | 0.763 ± 0.008 |
| CA-Base | 0.741 ± 0.010 | 0.679 ± 0.042 | 0.798 ± 0.030 | 0.483 ± 0.017 | 0.809 ± 0.007 |
| CA-Lig | 0.737 ± 0.009 | 0.656 ± 0.037 | 0.813 ± 0.026 | 0.476 ± 0.018 | 0.811 ± 0.007 |
| CA-Prot | 0.670 ± 0.003 | 0.576 ± 0.011 | 0.758 ± 0.011 | 0.340 ± 0.007 | 0.687 ± 0.013 |
| CA-Full | 0.693 ± 0.007 | 0.586 ± 0.028 | 0.792 ± 0.017 | 0.388 ± 0.014 | 0.700 ± 0.024 |
| XGB | 0.683 ± 0.005 | 0.546 ± 0.020 | 0.810 ± 0.009 | 0.371 ± 0.009 | 0.754 ± 0.002 |
Key Finding: CA-Base and CA-Lig achieves the best performance, suggesting that task-specific training of pre-trained protein encoders may lead to overfitting for this dataset.
# Clone the repository
git clone https://github.com/BHSAI/neuroGPCRs.git
cd neuroGPCRs
# Create a virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtAll the data are placed in the data/ directory:
training_set.csvvalidation_set.csvtest_set_unseen_ligands.csvtest_set_unseen_protein.csv
Data Format: Each CSV contains the following columns:
UniProt: UniProt ID of the proteinTarget Sequence: Amino acid sequence of the proteinSMILES: SMILES string of the moleculeLabel: Binary label (0 or 1) indicating binding
For CosSim, Transformers, and XGBoost models, pre-compute embeddings using ProtBert and MolFormer. These are generated automatically if the feature files are missing when you run the training scripts. You can also generate them explicitly:
python scripts/generate_embeddings.py \
--data_files data/training_set.csv data/validation_set.csv \
data/test_set_unseen_protein.csv data/test_set_unseen_ligands.csvNote: Cross-attention models can compute embeddings on-the-fly, eliminating the need for pre-computed features.
python scripts/train_cosine.py --config config.yamlpython scripts/train_transformer.py --config config.yamlpython scripts/train_xgb.py --config config.yaml# CA-Base: Both encoders frozen (best performance)
python scripts/train_cross_attention_unified.py \
--freeze_protein --freeze_molecule
# CA-Lig: Fine-tune ligand encoder only
python scripts/train_cross_attention_unified.py \
--freeze_protein
# CA-Prot: Fine-tune protein encoder only
python scripts/train_cross_attention_unified.py \
--freeze_molecule
# CA-Full: Fine-tune both encoders
python scripts/train_cross_attention_unified.pyConfiguration Options:
--freeze_protein: Freeze ProtBert encoder weights--freeze_molecule: Freeze MolFormer encoder weights--config: Path to configuration file (default:config.yaml)
| Script | Purpose |
|---|---|
scripts/representation_analysis.py |
Embedding drift, joint UMAP, effective-rank collapse, and layer-wise Frobenius drift of the fine-tuned ProtBERT encoder. |
scripts/calibration_analysis.py |
Reliability diagrams, ECE, and Brier scores on the ligand-selectivity subset. |
scripts/per_ligand_analysis.py |
Per-ligand AUROC/AUPRC, top-k sensitivity, and active–inactive probability gap. |
Each takes --results_dir results (or a similar flag) and writes its
outputs under that directory.
Once you have a trained cross-attention model, you can predict GPCR-ligand interactions for new compounds using the predict_interactions.py script:
python scripts/predict_interactions.py \
--smiles "CCOCc1sc(NC(=O)c2ccco2)nc1-c1ccccc1" \
--model /path/to/model.pth \
--output my_predictions.csv \
--top_k 10# Create a file with SMILES (one per line)
cat > compounds.txt << EOF
CCOCc1sc(NC(=O)c2ccco2)nc1-c1ccccc1
COc1cc(N(C)CCN(C)C)c2nc(C(=O)Nc3ccc(N4CCOCC4)cc3)cc(O)c2c1
COc1ccccc1OCCNCCCc1c[nH]c2ccccc12
EOF
# Run predictions
python scripts/predict_interactions.py \
--smiles_file compounds.txt \
--model /path/to/model.pth \
--output batch_predictions.csv \
--threshold 0.5Prediction Options:
--smiles: Single SMILES string for interaction prediction--smiles_file: File containing SMILES strings (one per line) for interaction prediction--model: Path to trained model checkpoint (.pth file)--data: Path to training CSV (to extract GPCR sequences, default:data/training_set.csv)--output: Output CSV file for predictions--top_k: Only save top K predictions per compound--threshold: Only save predictions above this probability threshold--batch_size: Batch size for inference (default: 16)
Output Format:
The predictions are saved as a CSV file with the following columns:
SMILES: Input compound SMILESUniProt: UniProt ID of the GPCRTarget_Sequence: Amino acid sequence of the GPCRBinding_Probability: Predicted binding probability (0-1)
Results are sorted by binding probability (highest first).
Example Output:
SMILES,UniProt,Target_Sequence,Binding_Probability
CCOCc1sc...,P29274,MPIMGSSVYITVELAIAVLAILGNVLVCWAVWLNS...,0.8523
CCOCc1sc...,P30542,MPPSISAFQAAYIGIEVLIALVSVPGNVLVIWAVK...,0.7891
CCOCc1sc...,P28222,MEEPGAQCAPPPPAGSETWVPQANLSSAPSQNCSA...,0.7234
Edit config.yaml to customize:
- Data paths and file names
- Model architecture parameters
- Training hyperparameters (learning rate, batch size, etc.)
- Device settings (CPU/GPU)
- Output directories
Example configuration for cross-attention models:
finetune:
protein_model: "Rostlab/prot_bert"
molecule_model: "ibm/MolFormer-XL-both-10pct"
d_model: 512
n_heads: 4
dropout: 0.1
num_epochs: 10
batch_size: 8
learning_rate: 0.00005 # Task-specific layers
encoder_lr: 0.00001 # Pre-trained encoders (if trainable)Projects protein and ligand embeddings to a shared 1024-dimensional space using linear layers, then computes cosine similarity as the binding score.
Key Features:
- Simple and interpretable
- Low computational cost
- Good baseline performance
- Requires pre-computed embeddings
Concatenates projected protein and ligand embeddings, processes through a multi-head transformer encoder, and classifies with an MLP.
Key Features:
- Self-attention mechanism
- Captures complex interactions
- Moderate computational cost
- Requires pre-computed embeddings
Uses bidirectional cross-attention layers to allow proteins and ligands to attend to each other, capturing fine-grained interaction patterns.
Architecture Flow:
- Encoders (ProtBert 1024-dim, MolFormer 768-dim)
- Projectors to 512-dim shared space
- Self-attention on both modalities
- Bidirectional cross-attention (protein ↔ ligand)
- Masked mean pooling
- Concatenation (1024-dim)
- MLP classifier (1024 → 512 → 256 → 1)
Four Variants:
- CA-Base: Both encoders frozen (Best Performance)
- CA-Lig: Fine-tune ligand encoder, freeze protein encoder
- CA-Prot: Fine-tune protein encoder, freeze ligand encoder
- CA-Full: Fine-tune both encoders
Key Features:
- Bidirectional attention mechanism
- Most expressive architecture
- Requires on-the-fly embedding computation
- Supports flexible encoder freezing strategies
Projects protein and ligand embeddings to a shared latent space, concatenates them into a 2048-dim feature vector, and trains an XGBoost classifier on top.
Key Features:
- Traditional ML baseline for comparison
- Same pre-computed embeddings as CosSim / Transformer
If you use this code in your research, please cite:
Dey, S et al. (2026) Evaluation of Deep Learning Architectures for Predicting Ligand Interactions with Neurologically Relevant GPCRs, Manuscript under review
@article{dey2024neurogpcrs,
title={Evaluation of Deep Learning Architectures for Predicting Ligand Interactions with Neurologically Relevant GPCRs},
author={Dey, Souvik and Lu, Pinyi and Wallqvist, Anders and AbdulHameed, Mohamed Diwan M.},
journal={Manuscript under review},
year={2026},
}