Affinity Protein-Protein Transformers—State of the art protein-protein binding affinity in seconds!
Python
110
30 commits
updated Feb 18, 2025
APPT (Affinity Protein-Protein Transformer) is a state-of-the-art model for predicting protein-protein binding affinity, leveraging advanced transformer architectures and the ESM protein language model. Designed to support drug discovery, protein engineering, and biological research, APPT excels in handling protein sequence pairs and delivering precise binding affinity predictions.
For extra assistance installing please see our Bindwell AI
Clone the repository:
git clone https://github.com/Bindwell/APPT.git
cd APPT
Install dependencies and model files:
pip install -r requirements.txt
mkdir embedding_cache_2560
cd embedding_cache_2560
wget https://huggingface.co/Bindwell/APPT/resolve/main/caches.pt
cd ..
mkdir models/
cd models
wget https://huggingface.co/Bindwell/APPT/resolve/main/protein_protein_affinity_esm_vs_ankh_best.pt
cd ..
Or, if you prefer conda
conda env create -f environment.yml
conda activate bindwell_appt
Run Inference
python cli.py --sequences ABC DEF
You can also run the model using Docker:
Build the Docker image locally:
docker build -t appt .
Or pull the pre-built image from Docker Hub:
docker pull cford38/appt:latest
Run the Docker container:
docker run --gpus all --rm --name appt -it appt /bin/bash
# docker run --gpus all --rm --name appt -it cford38/appt:latest /bin/bash
Our model demonstrates superior performance compared to existing methods across multiple metrics:

The graph shows that APPT achieves a significantly lower MSE (2.868) compared to PPB-Affinity (4.871), indicating better prediction accuracy. Lower values indicate better performance.

APPT (labeled as "OURS") achieves the highest R value of 0.79, substantially outperforming other methods:

In terms of R² values, our method ("OURS") achieves 0.68, significantly outperforming other approaches:
APPT incorporates a transformer-based model with the following components:
To train APPT on your dataset:
Prepare your dataset in CSV format with columns:
protein1_sequenceprotein2_sequencepkd (binding affinity)Replace the Data.csv file in index.py
Run the training script:
python index.py
The training process includes:
A command-line interface for predicting binding affinity between protein pairs.
You can provide input either through a CSV file containing protein sequences or by directly passing sequence pairs:
python cli.py \
--input_csv data/protein_pairs.csv \
--protein1_col protein1_sequence \
--protein2_col protein2_sequence \
--calculate_concordance \
--true_pkd_col pkd \
--output_dir results \
--model_path models/protein_protein_affinity_esm_vs_ankh_best.pt \
--device cuda
python cli.py \
--sequences SEQUENCE1A SEQUENCE1B \
--sequences SEQUENCE2A SEQUENCE2B \
--output_dir results \
--model_path models/protein_protein_affinity_esm_vs_ankh_best.pt \
--device cpu
--input_csv: Path to CSV file containing protein sequences--sequences: Raw protein sequence pairs (can be specified multiple times for multiple pairs)--protein1_col: Column name for first protein sequences in CSV (default: 'protein1_sequence')--protein2_col: Column name for second protein sequences in CSV (default: 'protein2_sequence')--calculate_concordance: Calculate concordance index if true labels are provided--true_pkd_col: Column name for true pKd values in CSV (default: 'pkd')--output_dir: Directory to save results (default: 'output')--model_path: Path to trained model checkpoint (default: 'models/protein_protein_affinity_esm_vs_ankh_best.pt')--data_path: Path to training data for normalization parameters (default: 'Data.csv')--batch_size: Batch size for inference (default: 16)--device: Device to run inference on (default: cuda if available, else cpu)--input_dim: Input dimension of protein embeddings (default: 2560)--embedding_dim: Embedding dimension for transformer (default: 384)--linear_dim: Linear layer dimension (default: 160)--num_attention_layers: Number of transformer attention layers (default: 2)--num_heads: Number of attention heads (default: 4)--dropout_rate: Dropout rate (default: 0.1)The script saves results to a CSV file in the specified output directory (default: 'output/binding_predictions.csv') with the following columns:
If concordance index is calculated (using --calculate_concordance), it will be displayed in the console output.
Example output CSV:
Protein1_Sequence,Protein2_Sequence,Predicted_pKd,Rank
SEQUENCE1A,SEQUENCE1B,7.24,2
SEQUENCE2A,SEQUENCE2B,6.85,3
index.py: Main training script and model implementationcli.py: Command-line interface for predictionsoutput/: Directory containing:
models/: Trained model checkpointsembedding_cache/: Cached protein embeddingshyperopt_results.json: Hyperparameter optimization resultsFigures: Various visualization plotsThe training process generates several output files:
We welcome contributions to improve APPT. Please feel free to submit issues and pull requests.
The entirety of this project (including the source code and the dataset) is distributed under the CC BY NC SA License. See LICENSE for details.
33 followers · starred Jan 2025
75 followers · starred Jan 2025
67 followers · starred Jan 2025
Affinity Protein-Protein Transformers—State of the art protein-protein binding affinity in seconds!
Python
110
30 commits
updated Feb 18, 2025
APPT (Affinity Protein-Protein Transformer) is a state-of-the-art model for predicting protein-protein binding affinity, leveraging advanced transformer architectures and the ESM protein language model. Designed to support drug discovery, protein engineering, and biological research, APPT excels in handling protein sequence pairs and delivering precise binding affinity predictions.
For extra assistance installing please see our Bindwell AI
Clone the repository:
git clone https://github.com/Bindwell/APPT.git
cd APPT
Install dependencies and model files:
pip install -r requirements.txt
mkdir embedding_cache_2560
cd embedding_cache_2560
wget https://huggingface.co/Bindwell/APPT/resolve/main/caches.pt
cd ..
mkdir models/
cd models
wget https://huggingface.co/Bindwell/APPT/resolve/main/protein_protein_affinity_esm_vs_ankh_best.pt
cd ..
Or, if you prefer conda
conda env create -f environment.yml
conda activate bindwell_appt
Run Inference
python cli.py --sequences ABC DEF
You can also run the model using Docker:
Build the Docker image locally:
docker build -t appt .
Or pull the pre-built image from Docker Hub:
docker pull cford38/appt:latest
Run the Docker container:
docker run --gpus all --rm --name appt -it appt /bin/bash
# docker run --gpus all --rm --name appt -it cford38/appt:latest /bin/bash
Our model demonstrates superior performance compared to existing methods across multiple metrics:

The graph shows that APPT achieves a significantly lower MSE (2.868) compared to PPB-Affinity (4.871), indicating better prediction accuracy. Lower values indicate better performance.

APPT (labeled as "OURS") achieves the highest R value of 0.79, substantially outperforming other methods:

In terms of R² values, our method ("OURS") achieves 0.68, significantly outperforming other approaches:
APPT incorporates a transformer-based model with the following components:
To train APPT on your dataset:
Prepare your dataset in CSV format with columns:
protein1_sequenceprotein2_sequencepkd (binding affinity)Replace the Data.csv file in index.py
Run the training script:
python index.py
The training process includes:
A command-line interface for predicting binding affinity between protein pairs.
You can provide input either through a CSV file containing protein sequences or by directly passing sequence pairs:
python cli.py \
--input_csv data/protein_pairs.csv \
--protein1_col protein1_sequence \
--protein2_col protein2_sequence \
--calculate_concordance \
--true_pkd_col pkd \
--output_dir results \
--model_path models/protein_protein_affinity_esm_vs_ankh_best.pt \
--device cuda
python cli.py \
--sequences SEQUENCE1A SEQUENCE1B \
--sequences SEQUENCE2A SEQUENCE2B \
--output_dir results \
--model_path models/protein_protein_affinity_esm_vs_ankh_best.pt \
--device cpu
--input_csv: Path to CSV file containing protein sequences--sequences: Raw protein sequence pairs (can be specified multiple times for multiple pairs)--protein1_col: Column name for first protein sequences in CSV (default: 'protein1_sequence')--protein2_col: Column name for second protein sequences in CSV (default: 'protein2_sequence')--calculate_concordance: Calculate concordance index if true labels are provided--true_pkd_col: Column name for true pKd values in CSV (default: 'pkd')--output_dir: Directory to save results (default: 'output')--model_path: Path to trained model checkpoint (default: 'models/protein_protein_affinity_esm_vs_ankh_best.pt')--data_path: Path to training data for normalization parameters (default: 'Data.csv')--batch_size: Batch size for inference (default: 16)--device: Device to run inference on (default: cuda if available, else cpu)--input_dim: Input dimension of protein embeddings (default: 2560)--embedding_dim: Embedding dimension for transformer (default: 384)--linear_dim: Linear layer dimension (default: 160)--num_attention_layers: Number of transformer attention layers (default: 2)--num_heads: Number of attention heads (default: 4)--dropout_rate: Dropout rate (default: 0.1)The script saves results to a CSV file in the specified output directory (default: 'output/binding_predictions.csv') with the following columns:
If concordance index is calculated (using --calculate_concordance), it will be displayed in the console output.
Example output CSV:
Protein1_Sequence,Protein2_Sequence,Predicted_pKd,Rank
SEQUENCE1A,SEQUENCE1B,7.24,2
SEQUENCE2A,SEQUENCE2B,6.85,3
index.py: Main training script and model implementationcli.py: Command-line interface for predictionsoutput/: Directory containing:
models/: Trained model checkpointsembedding_cache/: Cached protein embeddingshyperopt_results.json: Hyperparameter optimization resultsFigures: Various visualization plotsThe training process generates several output files:
We welcome contributions to improve APPT. Please feel free to submit issues and pull requests.
The entirety of this project (including the source code and the dataset) is distributed under the CC BY NC SA License. See LICENSE for details.
33 followers · starred Jan 2025
75 followers · starred Jan 2025
67 followers · starred Jan 2025