Skip to main content

Immunum Logo

Immunum is a high-performance antibody and T-cell receptor sequence numbering tool for Rust, Python, Polars, JavaScript and the command line. Try it in your browser.

Documentation: immunum.enpicom.com.

Crates.io PyPI npm License: MIT CI Docs

Overview

immunum numbers antibody and T-cell receptor variable domain sequences and splits them into framework and complementarity-determining regions. It uses Needleman-Wunsch semi-global alignment against position-specific scoring matrices built from consensus sequences of IMGT germline genes, with BLOSUM62-based substitution scores.

Antibody TCR
IGH (heavy) TRA (alpha)
IGK (kappa) TRB (beta)
IGL (lambda) TRD (delta)
TRG (gamma)

The chain is detected by aligning against every chain you allow and keeping the best match. Positions follow one of five schemes, all derived from the internal IMGT numbering:

  • IMGT: all 7 chains
  • Kabat, Chothia, Martin (extended Chothia) and AHo: antibody chains (IGH, IGK, IGL)

How the schemes and their CDR definitions differ is explained in Concepts.

Installation

Python

pip install immunum
pip install "immunum[polars]"   # with Polars, for immunum.polars

Python 3.10 or newer. Prebuilt wheels cover Linux (x86_64 and aarch64, manylinux), macOS (Apple Silicon and Intel) and Windows (x64); elsewhere pip builds from source, which needs Rust. immunum.polars needs Polars, which plain pip install immunum doesn't install.

JavaScript

npm install immunum

The npm package is built for Node.js. It ships its TypeScript types.

Rust

cargo add immunum
cargo add immunum --no-default-features   # the library without the CLI's dependencies

Rust 1.89 or newer. API reference: docs.rs/immunum.

Command line

The Python package installs the immunum command, so uvx runs it without installing anything first, and pip install immunum puts it on your path:

uvx immunum number sequences.fasta

Or build it with Cargo (Rust 1.89 or newer, from rustup):

cargo install immunum

There are no standalone prebuilt binaries. immunum --version prints the version you're running.

Quickstart

Python

from immunum import Annotator

annotator = Annotator(chains=["ig"], scheme="imgt")
sequence = "QVQLVQSGAEVKRPGSSVTVSCKASGGSFSTYALSWVRQAPGRGLEWMGGVIPLLTITNYAPRFQGRITITADRSTSTAYLELNSLRPEDTAVYYCAREGTTGKPIGAFAHWGQGTLVTVSS"

result = annotator.number(sequence)
print(result.chain)           # H
print(result.numbering["1"])  # Q

segments = annotator.segment(sequence)
print(segments.cdr3)          # AREGTTGKPIGAFAH

More in the Python guide.

Polars

import polars as pl
import immunum.polars as imp

df = pl.DataFrame({"sequence": [
    "QVQLVQSGAEVKRPGSSVTVSCKASGGSFSTYALSWVRQAPGRGLEWMGGVIPLLTITNYAPRFQGRITITADRSTSTAYLELNSLRPEDTAVYYCAREGTTGKPIGAFAHWGQGTLVTVSS",
    "DIQMTQSPSSLSASVGDRVTITCRASQDVNTAVAWYQQKPGKAPKLLIYSASFLYSGVPSRFSGSRSGTDFTLTISSLQPEDFATYYCQQHYTTPPTFGQGTKVEIK",
]})
cdr3 = df.select(imp.segment("sequence", chains=["ig"], scheme="imgt").struct.field("cdr3"))
print(cdr3["cdr3"].to_list())  # ['AREGTTGKPIGAFAH', 'QQHYTTPPT']

More in the Polars guide.

JavaScript

const { Annotator } = require("immunum");

const annotator = new Annotator(["ig"], "imgt");
const result = annotator.number(
  "QVQLVQSGAEVKRPGSSVTVSCKASGGSFSTYALSWVRQAPGRGLEWMGGVIPLLTITNYAPRFQGRITITADRSTSTAYLELNSLRPEDTAVYYCAREGTTGKPIGAFAHWGQGTLVTVSS",
);
console.log(result.chain);              // "H"
console.log(result.numbering.get("1")); // "Q"
annotator.free();

More in the JavaScript guide.

Rust

use immunum::{Annotator, Chain, Scheme};

let annotator = Annotator::new(&[Chain::IGH, Chain::IGK, Chain::IGL], Scheme::IMGT, None)?;
let sequence = "QVQLVQSGAEVKRPGSSVTVSCKASGGSFSTYALSWVRQAPGRGLEWMGGVIPLLTITNYAPRFQGRITITADRSTSTAYLELNSLRPEDTAVYYCAREGTTGKPIGAFAHWGQGTLVTVSS";

let segments = annotator.segment(sequence)?;
println!("CDR3: {}", segments.cdr3); // AREGTTGKPIGAFAH

More in the Rust guide and on docs.rs.

Command line

$ immunum number sequences.fasta | head -3
sequence_id	chain	scheme	confidence	position	residue	error	error_kind
seq_1	H	IMGT	0.7727	1	Q
seq_1	H	IMGT	0.7727	2	V
$ immunum segment -s kabat -f jsonl sequences.fasta

More in the command-line guide.

Errors

A setup mistake, such as an unknown chain name, is raised; a sequence that can't be numbered comes back as a result with error and error_kind set, so a batch never stops for one bad sequence. See Errors.

Documentation

Citing immunum

If you use immunum in your research, please cite it: CITATION.cff has the details, and GitHub's "Cite this repository" button formats them.

Germline data

The consensus sequences are built from the germline V and J genes of IMGT/GENE-DB (release 202641-7), part of IMGT®, the international ImMunoGeneTics information system®, whose data are licensed under CC BY 4.0. resources/consensus/README.md describes how they are generated and lists the IMGT publications to cite.

Contributing

Development setup, tests and the project layout are in CONTRIBUTING.md.

License

MIT, see LICENSE.

Metadata

Release files for immunum 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for immunum 2.1.0
File Size Uploaded Provenance Actions
immunum-2.1.0.tar.gz 119.8 kB Without provenance Details for immunum-2.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for immunum 2.1.0
File Actions
immunum-2.1.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for immunum-2.1.0-cp39-abi3-win_amd64.whl
immunum-2.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for immunum-2.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
immunum-2.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for immunum-2.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
immunum-2.1.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for immunum-2.1.0-cp39-abi3-macosx_11_0_arm64.whl
immunum-2.1.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for immunum-2.1.0-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 24.5 MB

Release files / immunum-2.1.0.tar.gz

Download URL immunum-2.1.0.tar.gz
Size 119.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2497404222617825a5929eaa58e41939ae89a8cf184118fc064c4da14955a51a
BLAKE2b-256 checksum
How to use checksums
4d06e1f360bff4590b467a1b6c57c9b89dd3d547bab22d09c9fd011816000df6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / immunum-2.1.0-cp39-abi3-win_amd64.whl

Download URL immunum-2.1.0-cp39-abi3-win_amd64.whl
Size 5.1 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
25f9cc63855ffce2e1c4383910febd8d83ce179c96383404c4f4007d7433476c
BLAKE2b-256 checksum
How to use checksums
1bfe06bc51636ddd592c2507d91d3874620bdb8eb54fa4008e30c4e908304aed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / immunum-2.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL immunum-2.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 5.1 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
091c8ced092e868e99ee16b0a528a3795a3b1199b3ea74720dfff23858ddf5ab
BLAKE2b-256 checksum
How to use checksums
6cd1e338e6bbd8180cf5bbbed6eae1277e4f3816ef06e12f4420ed8b0ddc5201
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / immunum-2.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL immunum-2.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 4.8 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
76516936ba6e342c16d77eb4a56aed683339e596051d5ecba233ae4e814f565c
BLAKE2b-256 checksum
How to use checksums
c715ac506b0ddb5a4586bdb5190c848232e1c01c37215802bb553844dbf20f59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / immunum-2.1.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL immunum-2.1.0-cp39-abi3-macosx_11_0_arm64.whl
Size 4.6 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
713bb37ce9493872670bd4340a68f2d2f515ca6109c68b53ff74973c4fb64c56
BLAKE2b-256 checksum
How to use checksums
4d16539afd886d105aeb49d7119b25470bed22e8eb678aa2e6cdd3696b44b331
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / immunum-2.1.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL immunum-2.1.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 4.9 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
baaafd42fa283ee9053a727c1e4b6e41b17a4e18c1201f7b60255e9e9e0ec4d6
BLAKE2b-256 checksum
How to use checksums
61e3e8cfbea2e4ae1b0ef9b6c51abca301af25844859fb99c7e6921febb843eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for immunum 2.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page