Skip to content

Fan-Server/RoBep

 
 

Repository files navigation

RoBep: A Region-Oriented Deep Learning Model for B-Cell Epitope Prediction

Website

RoBep provides a user-friendly web interface accessible through Hugging Face Spaces. This interface allows you to easily predict epitope residues without any local installation.

RoBep Web Interface

How to Use the Web Interface

  1. Accessing the Website

  2. Input Options

    • Option 1: Enter a PDB ID and Chain ID
    • Option 2: Upload your own PDB file
    • Note: If you only have a protein sequence, you can obtain its predicted structure using AlphaFold3 [https://alphafoldserver.com/]
  3. View Results

    • After processing (typically several seconds to 1-2 minutes), you'll see the prediction results
    • An interactive HTML visualization will be available for download. Here is a demo of the resulted HTML file: visualization.html
  4. Visualization Options

    • Three display modes are available:
      • Predicted Epitopes: Shows the predicted epitope residues
      • Probability Gradient: Displays probability scores (darker color indicates higher probability)
      • Top-k Regions: Highlights predicted binding regions
    • Additional Features:
      • Use "Show Spheres" to visualize the selected spheres used in epitope prediction
      • Interact with the 3D structure using mouse controls (rotate, zoom, pan)

Data Introduction

All data used for this work are located in the data/epitopes/ directory, except specifically mentioned:

Dataset Split Information

  • data_splits.json: Contains the PDB IDs with chain identifiers for all training and test antigens

Complete Dataset

  • epitopes.csv: Contains all non-redundant antigens with their sequences and merged epitope annotations
  • data/virus_nsp.csv: Contains 85 non-structural proteins from virus
  • cluster.csv: Contains representative antigen with corresponding member antigens in each cluster

Training and Testing Subsets

FASTA Sequences:

  • train_antigens.fasta: Sequences of all antigens used for training
  • test_antigens.fasta: Sequences of all antigens used for testing

Detailed Annotations:

  • train_epitopes.csv: All non-redundant antigens in the training set, including sequences and merged epitope annotations
  • test_epitopes.csv: All non-redundant antigens in the test set, including sequences and merged epitope annotations

Obtaining Protein Structures

The corresponding protein structures can be obtained from:

  • PDB Database: Download experimentally determined structures from RCSB PDB
  • AlphaFold Prediction: Generate predicted structures using AlphaFold Server

Environment Install

git clone https://github.com/YitaoXU/RoBep.git
cd RoBep

conda create -n RoBep python=3.10 -y
conda activate RoBep

# Install PyTorch and basic dependencies first
pip install -r requirements.txt

# Install PyTorch Geometric dependencies
pip install torch-scatter torch-sparse torch-cluster torch-spline-conv -f https://data.pyg.org/whl/torch-2.5.0+cu124.html

# Install the package in development mode
pip install -e .

Inference

Data Preparation

# Recommend to save the PDB file locally and load it directly
# Please input your own ESM-C api token
from bce.antigen.antigen import AntigenChain

pdb_id = "5i9q"
chain_id = "A"

# specify your own ESM API token for embedding generation
antigen_chain = AntigenChain.from_pdb(
    path='data/pdb/5i9q.pdb', 
    id=pdb_id, 
    chain_id=chain_id,
    token="your_esm_api_token_here"  # Your ESM API token used to extract ESM-C embeddings
)

embeddings, backbone_atoms, rsa, coverage_dict= antigen_chain.data_preparation(radius=19.0)

Epitope Prediction

You can see our tutorials to learn how to use RoBep.

prediction_results = antigen_chain.predict(
    device_id=0,
    radius=18.0,
    k=7,
    encoder="esmc",
    verbose=True,
    use_gpu=False
)

Understanding the Prediction Results

The predict() function returns a comprehensive dictionary containing the following results and useful information, where prediction_results['predicted_probabilities'] is residue-wise predicted probability for evaluation:

{
    # Main Results
    'predicted_epitopes': [12, 15, 23, 45, 67, ...],  # List of predicted epitope residue numbers
    'predicted_probabilities': [0.02, 0.15, 0.85, ...], # List: probabilities ordered by sequence position
    'predictions': {1: 0.02, 2: 0.15, 3: 0.85, ...}, # Dict: {residue_number: probability} (if > 0.3525, then predicted as epitope)
    
    # Top-k Region Information
    'top_k_centers': [15, 45, 78, ...],               # Center residues of top-k regions
    'top_k_region_residues': [12, 13, 14, 15, ...],   # All residues covered by top-k regions
    'top_k_regions': [                                # Detailed information for each region
        {
            'center_residue': 15,                      # Center residue number
            'center_idx': 14,                          # Center residue index (0-based)
            'predicted_value': 0.85,                   # Model confidence score
            'covered_residues': [12, 13, 14, 15, 16], # Residues in this region
            'radius': 18.0                             # Radius used
        },
        ...
    ],
    
    'antigen_rate': 0.85,                             # Mean graph-level prediction (antigenicity)
    'epitope_rate': 0.15                              # Mean node-level prediction (epitope rate)
}

Evaluation

If you want to evaluate our model on your own dataset, please replace the data_splits.json and epitopes.csv in the data/epitopes/ directory with the same format. We also recommend to store corresponding PDB files in data/PDB/, such as 5i9q.pdb.

python -u main.py --mode eval --model_path models/RoBep/20250626_110438/best_mcc_model.bin --radius 18.0 --k 7

Training

# Data Preparation (1 hour; you need to specify your own ESM API token for embedding generation)
python data_preparation.py --esm_token 'your_esm_api_token_here'

# Training
python main.py --mode train

Cite this work

If you want to cite this work, please cite:

@article{Xu2026RoBep,
  author  = {Xu, Yitao and Wei, Guanyun and Zhou, Jingying and Huang, Yuanhua and Yu, Weichuan and Lin, Zhixiang and Liu, Ran and Fan, Xiaodan},
  title   = {{RoBep}: A Region-Oriented Deep Learning Model for B-Cell Epitope Prediction},
  journal = {Bioinformatics},
  year    = {2026},
  doi     = {10.1093/bioinformatics/btag006}
}

or

  • Yitao Xu, Guanyun Wei, Jingying Zhou, Yuanhua Huang, Weichua Yu, Zhixiang Lin, Ran Liu, Xiaodan Fan, RoBep: A Region-Oriented Deep Learning Model for B-Cell Epitope Prediction, Bioinformatics, 2026;, btag006, https://doi.org/10.1093/bioinformatics/btag006

About

A Region Constrainted B-cell Epitope Prediction Tool

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 70.3%
  • HTML 29.1%
  • Other 0.6%