Skip to main content

Structure-based prediction of antibody-interacting residues in human antigens

Project description

HAIRpred2

HAIRpred2 is a structure-based computational tool for predicting antibody-interacting residues in human antigen structures. It uses Relative Solvent Accessibility (RSA) combined with physicochemical properties in a sliding window framework with a pre-trained Random Forest model (AUC = 0.78).

PyPI version Python 3.8+ License: MIT

🌐 Web Server: https://webs.iiitd.edu.in/raghava/hairpred2


Installation

pip install hairpred2

System dependency — mkdssp (required)

HAIRpred2 uses DSSP to compute RSA values from the PDB structure. Install mkdssp:

# Linux / Ubuntu
sudo apt install dssp

# Conda (recommended — any platform)
conda install -c salilab dssp

# macOS (Homebrew)
brew install dssp

# Google Colab
apt-get install -y dssp

Download the model file

The pre-trained model (~253 MB) is not bundled with the pip package. Download it separately:

# Download to the package data directory automatically
hairpred2-download-model

# Or download manually and place in your working directory:
# https://webs.iiitd.edu.in/raghava/hairpred2/download/best_model_random_forest.pkl

Usage

Command line

# Basic usage
hairpred2 -i antigen.pdb -c A

# Custom output prefix
hairpred2 -i antigen.pdb -c A -o my_results

# Multiple antigen chains
hairpred2 -i antigen.pdb -c A,B

# Filter buried residues (recommended)
hairpred2 -i antigen.pdb -c A --min-rsa 0.05

# Custom probability threshold
hairpred2 -i antigen.pdb -c A -t 0.4

# Use a custom model file
hairpred2 -i antigen.pdb -c A --model /path/to/model.pkl

Python API

from hairpred2 import run_pipeline

# Basic prediction
results = run_pipeline(
    pdb_file      = "antigen.pdb",
    chain_ids     = ["A"],
    output_prefix = "my_results",
)

# With options
results = run_pipeline(
    pdb_file      = "antigen.pdb",
    chain_ids     = ["A", "B"],
    output_prefix = "my_results",
    threshold     = 0.4,
    min_rsa       = 0.05,
    model_path    = "/path/to/best_model_random_forest.pkl",
)

# results is a pandas DataFrame with columns:
# Residue, RSA, Probability, Prediction
print(results.head())

Individual functions

from hairpred2 import (
    validate_pdb,
    build_residue_dataframe,
    generate_features,
    load_model,
    predict_residues,
    detect_epitope_patches,
)

# Load and validate
validate_pdb("antigen.pdb")

# Build features
df, temp_pdb = build_residue_dataframe("antigen.pdb", ["A"])
X = generate_features(df)

# Predict
model = load_model()          # uses bundled/downloaded model
# model = load_model("/custom/path/model.pkl")  # custom model
probs, labels = predict_residues(model, X, threshold=0.5)

# Detect epitope patches
patches = detect_epitope_patches(df, labels, probs)

Output Files

Every prediction generates 5 output files (all sharing the same prefix):

File Description
<prefix>.csv Per-residue: Residue, RSA, Probability, Prediction
<prefix>_summary.txt Statistics + top 10 predicted residues
<prefix>_bfactor.pdb PDB with B-factor = probability × 100
<prefix>.pml PyMOL script — colors red/blue + residue labels
<prefix>_patches.txt Spatially clustered epitope patches

Visualization in PyMOL

# Run in PyMOL
@my_results.pml

# Or color by probability using B-factor PDB
load my_results_bfactor.pdb
spectrum b, blue_white_red

Arguments

Argument Required Description
-i / --input Yes Input antigen PDB file
-c / --chain Yes Chain ID(s): A or A,B
-o / --output No Output prefix (default: hairpred2_results)
-t / --threshold No Probability threshold (default: 0.5)
--min-rsa No Minimum RSA filter (e.g. 0.05)
--model No Custom model .pkl path

Model Performance

Trained on 221 human Ag-Ab complexes (SAbDab), tested on 56 independent complexes:

Metric Value
AUC 0.78
Sensitivity 0.73
Specificity 0.65

Citation

If you use HAIRpred2, please cite:

Mehta N., et al. (2026) HAIRpred2: Human Host-Specific Prediction of Antibody-Interacting Residues Using Hybrid Physicochemical and Structural Features. (manuscript in preparation)

Previous tool:

Sahni R., Kumar N. and Raghava GPS (2025) HAIRpred: Prediction of human antibody interacting residues in an antigen from its primary structure. Protein Sci, 34(8):e70212


License

MIT License — free for academic and non-commercial use.

© 2025 Raghava Lab, IIIT Delhi — https://webs.iiitd.edu.in/raghava/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hairpred2-2.0.0.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hairpred2-2.0.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file hairpred2-2.0.0.tar.gz.

File metadata

  • Download URL: hairpred2-2.0.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for hairpred2-2.0.0.tar.gz
Algorithm Hash digest
SHA256 db35945eb7528931b303425a8abc38f41741b2daa6d25ae0a2ac0d111b42ed35
MD5 c3191670c5059dc39e13186f4bc541fb
BLAKE2b-256 90c4306737d1bd93150a24997f1d86b215dd53ab56f25e5e1842ac1b685d4460

See more details on using hashes here.

File details

Details for the file hairpred2-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: hairpred2-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for hairpred2-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c1ab5d6adc8f547d11a5ad195702a30f043cce0e5c16af4f90c9ffb3a18b824
MD5 537666245d505965043fc413fd3d0f7b
BLAKE2b-256 dd1e623671e0074d6e7b0c571021ede25ea9129757465543baf06328140f4c62

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page