Skip to main content

Peptide-based HLA typing from immunopeptidomics data

Project description

immunotype logo

Peptide-based HLA typing from immunopeptidomics data

CI PyPI version Python versions License: MIT Hugging Face Space

immunotype predicts HLA class I alleles directly from immunopeptidomics data โ€” no separate HLA typing experiment needed. immunotype combines a graph neural network with a curated mono-allelic lookup table in an ensemble model, achieving 87.2% accuracy at protein-level resolution across diverse human tissues.

๐Ÿš€ Quick Start

Installation

# Core CLI functionality
pip install immunotype

Command Line Interface

 Usage: immunotype [OPTIONS] PEPTIDE_INPUT TYPING_OUTPUT

 Predict HLA typing from immunopeptide sequences.
 This tool uses graph neural networks and lookup tables to predict HLA allele typing from immunopeptidomics data. Provide a peptide input file and optionally customize the HLA alleles to consider.

โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ *  PEPTIDE_INPUT       PATH                   TSV input file. Either a single column of peptides or two columns with sample IDs and peptides. [required]                โ”‚
โ”‚ *  TYPING_OUTPUT       PATH                   Path to save the typing output. [required]                                                                                โ”‚
โ”‚    --prob-output       PATH                   Save detailed HLA probabilities to specified TSV file.                                                                    โ”‚
โ”‚    --hla-input         PATH                   Path to the HLA input file containing alleles to consider. [default: <immunotype-package-path>/data/selected_alleles.csv] โ”‚
โ”‚    --max-n-peptides    INTEGER                Maximum number of peptides to predict at once. [default: 50000]                                                           โ”‚
โ”‚    --batch-size        INTEGER                How many samples should be predicted simultaneously. [default: 1]                                                         โ”‚
โ”‚    --prediction-model  [ensemble|gnn|lookup]  Select which model to use. [default: ensemble]                                                                            โ”‚
โ”‚    --use-gpu                                  Run prediction on GPU instead of CPU.                                                                                     โ”‚
โ”‚    --version                                  Show the version and exit.                                                                                                โ”‚
โ”‚    --help                                     Show this message and exit.                                                                                               โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
# Basic prediction
immunotype src/immunotype/examples/single_sample_input.tsv test_single_sample_typing.tsv

# With probability details
immunotype src/immunotype/examples/single_sample_input.tsv test_single_sample_typing.tsv --prob-output test_single_sample_probabilities.tsv

# Custom settings
immunotype src/immunotype/examples/single_sample_input.tsv test_single_sample_typing.tsv --batch-size 100 --prediction-model gnn

# Explore all CLI options
immunotype --help

App Interface

Try it online without installing โ€” the hosted app on Hugging Face Spaces. Or run it locally:

# Install with app dependencies
pip install immunotype[app]

# Run the Gradio app
immunotype-app

Python API

import pandas as pd
from immunotype import predict

# Prepare data
peptides = pd.DataFrame({
    'peptide': ['ALDGRETD', 'ASDSGKYL'],
    'sample': ['sample1', 'sample1']
})

alleles = pd.DataFrame({
    'allele': ['HLA-A*02:01', 'HLA-B*07:02', 'HLA-C*07:02']
})

# Make predictions
predictions, typing = predict(
    peptide_df=peptides,
    allele_df=alleles
)

๐Ÿ“ฅ Input Formats

Single-column peptides:

ALDGRETD
ASDSGKYL
AVDPTSGQ

Multi-sample format:

sample	peptide
1	ALDGRETD
1	ASDSGKYL
2	AVDPTSGQ

๐Ÿ“ค Output

Typing (default): Top 2 alleles per locus (A, B, C) per sample.

sample	typing
sample_0	HLA-A*32:01;HLA-A*68:01;HLA-B*15:01;HLA-B*44:02;HLA-C*03:03;HLA-C*07:04

Probabilities (--prob-output): Per-allele scores from each prediction mode.

sample	locus	allele	probability_gnn	probability_lookup	probability
sample_0	A	HLA-A*01:01	0.0005	0.0000	0.0003
sample_0	A	HLA-A*02:01	0.0000	0.1945	0.0584

๐Ÿ“ Authors

  • Matteo Pilz
  • Jonas Scheid

๐Ÿ“š Citation

If you use immunotype in your research, please cite our preprint:

Pilz M, Scheid J, Bauer A, Lemke S, Sachsenberg T, Bauer J, Nelde A, Stadelmaier J, Walter A, Rammensee H-G, Nahnsen S, Kohlbacher O, Walz JS. Deep learning enables direct HLA typing from immunopeptidomics data. bioRxiv (2026). doi:10.64898/2026.04.08.717021

@article{immunotype,
  title   = {Deep learning enables direct HLA typing from immunopeptidomics data},
  author  = {Pilz, Matteo and Scheid, Jonas and Bauer, Alina and Lemke, Steffen and Sachsenberg, Timo and Bauer, Jens and Nelde, Annika and Stadelmaier, Josua and Walter, Axel and Rammensee, Hans-Georg and Nahnsen, Sven and Kohlbacher, Oliver and Walz, Juliane Sarah},
  journal = {bioRxiv},
  year    = {2026},
  doi     = {10.64898/2026.04.08.717021},
  url     = {https://doi.org/10.64898/2026.04.08.717021}
}

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

immunotype-1.0.4.tar.gz (30.6 MB view details)

Uploaded Source

Built Distribution

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

immunotype-1.0.4-py3-none-any.whl (30.7 MB view details)

Uploaded Python 3

File details

Details for the file immunotype-1.0.4.tar.gz.

File metadata

  • Download URL: immunotype-1.0.4.tar.gz
  • Upload date:
  • Size: 30.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for immunotype-1.0.4.tar.gz
Algorithm Hash digest
SHA256 c69685c3e673a2eb4ff468af7d305f2bbadfbf906c67d8f78c51a0152ab96168
MD5 ed2dd878d722131138b7987427c6347c
BLAKE2b-256 a65097bea2bbf1f454ae5c43f6c19a2d7e4ad15ee42faadc612491db51f089ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for immunotype-1.0.4.tar.gz:

Publisher: release.yml on AG-Walz/immunotype

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file immunotype-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: immunotype-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 30.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for immunotype-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e20add856e87e684eb485f96d34753ec3ea0ed97f810bd09b2db4be3fc36d8f9
MD5 095d890bba6dbbcb8d3bbbb811dd2722
BLAKE2b-256 b21fc2dd9fb85347a6a545d933565a7d854ada81c7d5659573e37017ed4701bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for immunotype-1.0.4-py3-none-any.whl:

Publisher: release.yml on AG-Walz/immunotype

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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