V(D)J allele assignment for IG and TCR repertoires.
Reads in (FASTA, FASTQ or a table), an AIRR rearrangement table out, ready for Change-O, TIgGER and SCOPer.
Pretrained human models for IGH, IGK, IGL, TRA, TRB, TRD and TRG.
Docs · Choose a model · Every option · Paper
pip install alignairPython 3.10 or newer. A GPU is optional: AlignAIR uses CUDA or Apple MPS when it finds one, else the CPU. There is
no Bioconda package. A Docker image is published as alignair/alignair (the example reads are in /app/examples).
$ alignair doctor
AlignAIR environment
python 3.12.3
torch 2.11.0
cuda_available False
device_auto cpu
cache_dir /home/you/.cache/alignair(Abridged.) device_auto is where predictions run; cache_dir is where downloaded models are kept.
Download 20 example human IGH reads and align them with the IGH model:
curl -LO https://raw.githubusercontent.com/MuteJester/AlignAIR/v4.0.0/examples/reads.fasta
alignair predict --model alignair4-igh-human --input reads.fasta --out out.tsvThe first run downloads the model from Hugging Face and caches it; later runs start at once. You get:
aligned 20 reads (0 dropped) -> out.tsv
out.tsv is an AIRR rearrangement table, one row per read. Its first columns of interest:
sequence_id v_call d_call j_call junction_aa productive
read01 IGHVF10-G50*02 IGHD3-10*01 IGHJ6*02 CATFYYGSGSYYNFVSNYNYYGMDVW T
read02 IGHVF10-G42*01,IGHVF10-G42*03 IGHD2-2*02 IGHJ4*02 CAKGTSCNSTSCYTIDYW T
read03 IGHVF3-G12*02 IGHD5-18*02 IGHJ6*03 CARDTLNIVATPISAFAIYYYYYMDVW T
When a read cannot tell V alleles apart, v_call lists them all, comma-separated (read02), as IgBLAST does. The IG
models name alleles as OGRDB does (IGHVF10-G50*02); see Pretrained models. To align your own
reads, point --input at your file.
from alignair import Aligner, read_sequences
aligner = Aligner.from_pretrained("alignair4-igh-human")
ids, reads, info = read_sequences("reads.fasta")
result = aligner.predict(reads, ids=ids)
result.write_airr("out.tsv")
print(result.records[0]["v_call"], result.records[0]["junction_aa"])IGHVF10-G50*02 CATFYYGSGSYYNFVSNYNYYGMDVW
result.records holds one dict per read, in Python's terms (positions from 0, True/False); write_airr writes
the AIRR table, which is what tools downstream read.
| Locus | Model id | Germline set | Allele names | Alleles V / D / J |
|---|---|---|---|---|
| IGH | alignair4-igh-human |
OGRDB human IGH (HUMAN_IGH_OGRDB) |
OGRDB | 198 / 33 / 7 |
| IGK | alignair4-igk-human |
OGRDB human IGK (HUMAN_IGK_OGRDB) |
OGRDB | 168 / – / 8 |
| IGL | alignair4-igl-human |
OGRDB human IGL (HUMAN_IGL_OGRDB) |
OGRDB | 181 / – / 10 |
| TRA | alignair4-tra-human |
IMGT human TRA (HUMAN_TCRA_IMGT) |
IMGT | 76 / – / 68 |
| TRB | alignair4-trb-human |
IMGT human TRB (HUMAN_TCRB_IMGT) |
IMGT | 98 / 3 / 16 |
| TRD | alignair4-trd-human |
IMGT human TRD (HUMAN_TCRD_IMGT) |
IMGT | 14 / 3 / 4 |
| TRG | alignair4-trg-human |
IMGT human TRG (HUMAN_TCRG_IMGT) |
IMGT | 20 / – / 6 |
- First use downloads the model from Hugging Face into
~/.cache/alignair(setALIGNAIR_CACHE_DIRto move it). To work offline, download it ahead withalignair models get alignair4-igh-humanand run with--offline. - Allele names. The IG models call alleles by their OGRDB names (
IGHVF6-G21*07), the TCR models by their IMGT names. A genotype written in the other naming is refused; the Choose a model page shows how to work with IMGT-named data. - Another germline set, or novel alleles, for a species and locus a model covers: give the germline FASTA with
--reference. Another species (mouse, say): fine-tune or train a model; binding another species' germlines to a human model costs accuracy. - The models are released under GPL-3.0-or-later, as the code.
Input: FASTA, FASTQ, or a CSV/TSV table with a sequence column (--sequence-column), gzipped or not, or - for
standard input. Reads keep their ids; a repeated id gets a _dup1 suffix. Reads longer than 575 nt are aligned on
their first 575 nt.
Output: an AIRR rearrangement TSV: all 99 columns by default, or a preset with --columns airr|core|minimal.
Beside it, out.tsv.run.json records the model, the reference and the options of the run.
Common options:
# Calls only from a donor's alleles: a YAML/JSON genotype, or the GenotypeSet `alignair genotype` writes
alignair predict --model alignair4-igh-human --input reads.fastq.gz --out out.tsv --genotype donor.yaml
# Your own germline set, novel alleles included
alignair predict --model alignair4-igh-human --input reads.fasta --out out.tsv --reference germline.fasta
# Carry 10x cell barcodes and UMI counts into the table. One locus per run: Cell Ranger's contigs mix chains,
# so split them by chain first (the metadata page shows how) and give each locus its own model.
alignair predict --model alignair4-igh-human --input igh_contigs.fasta --out igh.tsv \
--metadata filtered_contig_annotations.csv
# Many reads on the CPU: worker processes
alignair predict --model alignair4-trb-human --input tcr.fasta --out tcr.tsv --threads 8Every option, with its default, is on the CLI reference page;
alignair predict --help lists them by purpose.
On simulated reads held out from development (all seven loci, 13 test suites), AlignAIR is better than IgBLAST on 151 of 491 measure comparisons: the V mutation count (38 of 40), the J allele (25 of 49), segment boundaries, the exact junction and clone key, the D allele, and calling no V on a read too short to show one. On real IGH repertoires of four donors whose alleles are known from their genomes, the two tools' V calls are equally well supported, and AlignAIR calls the reads with a known answer right more often (99.7% vs 99.5% on 5' RACE libraries). The comparison page shows every measure and the method.
When another tool is the better choice:
- IgBLAST, for a species or locus no AlignAIR model covers when you cannot train one; reads longer than 575 nt you cannot trim; a D call wherever any D bases remain (AlignAIR leaves a D with fewer than 8 bases uncalled); IgBLAST's scores and e-values; or a measure your study rests on where the comparison says IgBLAST is better.
- MiXCR, for a pipeline from raw sequencing data to assembled clonotypes (UMIs, contig assembly): AlignAIR assigns V(D)J alleles to reads, it does not assemble clones.
- Immcantation stays your downstream toolkit: AlignAIR replaces its alignment step (AssignGenes and MakeDb), and Change-O, TIgGER and SCOPer read AlignAIR's table directly.
Known limits are listed on How far to trust the calls.
The website takes you further, by what you want to do:
- Run on your data: your first alignment, prepare your input, donor genotypes, your own germline reference.
- Coming from another tool: IgBLAST, MiXCR, Immcantation.
- Look something up: every CLI option, the Python API, every output column, error codes.
- Judge the results: how far to trust the calls, the comparison with IgBLAST.
- Train or fine-tune a model for your species or germline set: do I need to train?, train, fine-tune.
If you use AlignAIR, please cite:
Thomas Konstantinovsky, Ayelet Peres, Ran Eisenberg, Pazit Polak, Ofir Lindenbaum, Gur Yaari. Enhancing sequence alignment of adaptive immune receptors through multi-task deep learning. Nucleic Acids Research, Volume 53, Issue 13, 22 July 2025, gkaf651. https://doi.org/10.1093/nar/gkaf651
@article{konstantinovsky2025alignair,
title = {Enhancing sequence alignment of adaptive immune receptors through multi-task deep learning},
author = {Konstantinovsky, Thomas and Peres, Ayelet and Eisenberg, Ran and Polak, Pazit and
Lindenbaum, Ofir and Yaari, Gur},
journal = {Nucleic Acids Research},
volume = {53},
number = {13},
pages = {gkaf651},
year = {2025},
doi = {10.1093/nar/gkaf651}
}CITATION.cff holds the same reference, so GitHub's "Cite this repository" gives it too.
Questions and bugs: GitHub issues. Contributions are welcome; see CONTRIBUTING.
GPL-3.0-or-later (see LICENSE).