Skip to content

eightmm/BA-Pred

Repository files navigation

BA-Pred

Protein-Ligand Binding Affinity Prediction using Graph Neural Networks

Python PyTorch DGL License CASP16 GitHub stars

High-performance protein-ligand binding affinity prediction model - 2nd place in CASP16 ligand affinity challenge

Features

  • CASP16: 2nd place in the prestigious CASP16 ligand affinity prediction challenge
  • High Accuracy: Graph Neural Network-based architecture for precise binding affinity prediction
  • Research Ready: Pre-trained models ready for immediate use
  • Easy Integration: Simple Python API and command-line interface
  • Scalable: Batch processing for high-throughput screening

Quick Start

Installation

Choose your preferred installation method:

Option 1: Install from PyPI (Simplest)
pip install bapred
Option 2: Using Conda (Recommended for Development)
git clone https://github.com/eightmm/BA-Pred.git
cd BA-Pred
conda env create -f env.yaml
conda activate BAPred
pip install -e .
Option 3: From Source
git clone https://github.com/eightmm/BA-Pred.git
cd BA-Pred
pip install -r requirements.txt
pip install -e .

Run Your First Prediction

python run_inference.py -r example/1KLT.pdb -l example/ligands.sdf -o results.csv

That's it! Your binding affinity predictions will be saved in results.csv.

Usage Examples

Basic Usage

# Predict binding affinities
python run_inference.py -r example/1KLT.pdb -l example/ligands.sdf -o results.csv

Advanced Options

# Use CPU instead of GPU
python run_inference.py -r protein.pdb -l ligands.sdf -o results.csv --device cpu

# Custom batch size for memory optimization
python run_inference.py -r protein.pdb -l ligands.sdf -o results.csv --batch_size 64

# Limit CPU workers for data loading
python run_inference.py -r protein.pdb -l ligands.sdf -o results.csv --ncpu 8

# Specify custom model path
python run_inference.py -r protein.pdb -l ligands.sdf -o results.csv --model_path /path/to/model

Python API

from bapred.inference import inference

# Run prediction programmatically
inference(
    protein_pdb="example/1KLT.pdb",
    ligand_file="example/ligands.sdf",
    output="results.csv",
    batch_size=128,
    ncpu=4,
    model_path="bapred/weight",
    device="cuda"
)

Project Structure

BA-Pred/
├── bapred/                 # Main package
│   ├── data/               # Data processing modules
│   │   ├── atom_feature.py    # Atomic feature extraction
│   │   ├── data.py           # Dataset handling
│   │   └── utils.py          # Utility functions
│   ├── model/              # Neural network models
│   │   ├── GatedGCNLSPE.py   # Gated Graph Convolution
│   │   └── model.py          # Main model wrapper
│   ├── weight/             # Pre-trained weights
│   │   └── BAPred.pth        # Model checkpoint
│   └── inference.py       # Inference engine
├── example/               # Example files
│   ├── 1KLT.pdb             # Sample protein structure
│   └── ligands.sdf          # Sample ligand library
├── run_inference.py      # Easy-to-use script
├── requirements.txt      # Python dependencies
├── env.yaml             # Conda environment
└── README.md            # You are here!

Input/Output Formats

Input

  • Protein: PDB format (.pdb)
  • Ligands: SDF (.sdf), MOL2 (.mol2), or text file with paths (.txt)

Output

  • CSV/TSV file with columns:
    • Name: Ligand identifier
    • pKd: Predicted binding affinity (pKd scale)
    • Kcal/mol: Binding energy in kcal/mol

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

Citation

If you use BA-Pred in your research, please cite:

@software{bapred2024,
  title={BA-Pred: Protein-Ligand Binding Affinity Prediction using Graph Neural Networks},
  author={Jaemin Sim},
  year={2024},
  url={https://github.com/eightmm/BA-Pred}
}

Support


Made with care for the scientific community

Star us on GitHub if this project helped you!

About

BAPred

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •