Skip to main content

anarcism logo

anarcism

anarcism is an independent reimplementation of ANARCI by James Dunbar and Charlotte M. Deane. It recognizes and IMGT-numbers antibody and T-cell-receptor variable domains. The engine is written in Rust and ships as a self-contained Python extension and WebAssembly package: analysis runs locally, with no HMMER binary, model download, or backend request.

It supports H/K/L/A/B/G/D chains, multidomain inputs, FASTA, configurable profile filters, alternative hits, V/J germline assignment, and VH/VL pair validation.

Features

Compared with the official ANARCI implementation:

  • Self-contained installation without legacy hooks or HMMER
  • Bounded-memory FASTA streaming with lower end-to-end time on large inputs
  • Efficient multicore scaling
  • WebAssembly package for browsers and Node.js

Python and CLI

pip install anarcism
import anarcism

result = anarcism.number_sequence(vh, assign_germline=True)
batch = anarcism.number_sequences(
    [("heavy", vh), ("light", vl)],
    workers=4,
)

# Iterable input and output keep large datasets bounded in memory.
with open("sequences.fasta") as fasta:
    for result in anarcism.iter_number_fasta(fasta, workers=4):
        consume(result)

The anarcism command and python -m anarcism provide ANARCI-compatible IMGT vertical, CSV, and hit-table output:

anarcism -i sequences.fasta -o numbered.anarci -p 8
anarcism -i sequences.fasta -o numbered --csv --assign_germline
anarcism -i sequences.fasta -o numbered.anarci -ht hits.txt
gunzip -c sequences.fasta.gz | anarcism -i - -o numbered.anarci

Run anarcism --help for the supported ANARCI flags. Only IMGT numbering is implemented; --hmmerpath is unnecessary because the backend is embedded.

anarcism is a drop-in replacement for the official ANARCI executable. To avoid changing scripts that call ANARCI, create a symlink:

ln -s "$(command -v anarcism)" "$(dirname "$(command -v anarcism)")/ANARCI"

JavaScript

npm install @revanta/anarcism

The package runs in modern browsers and Node.js 20.16+. It requires WebAssembly SIMD128 but not WASM threads or shared memory.

import { Anarcism } from "@revanta/anarcism";

const anarcism = await Anarcism.create();

const result = anarcism.numberSequence(vh, {
	allowedChains: ["H", "K", "L"],
	minBitScore: 80,
	alternativeHitCount: 3,
	assignGermline: true,
});

const batch = anarcism.numberSequences([
	{ id: "heavy", sequence: vh },
	{ id: "light", sequence: vl },
]);

const fastaResults = anarcism.numberFasta(`>heavy\n${vh}\n`);
const pair = anarcism.validateAntibodyPair(vh, vl);

Anarcism.create() loads the bundled anarcism.wasm; pass { source } with a URL, Response, bytes, or a compiled WebAssembly.Module to load it from elsewhere. Anarcism.createSync(bytesOrModule) instantiates without awaiting. Each instance owns an independent WebAssembly engine.

The synchronous API is suitable for interactive calls. For large batches in the browser, the worker-pool entry point runs independent WASM engines in Web Workers without blocking the page:

import { AnarcismWorkerPool } from "@revanta/anarcism/worker-pool";

const pool = await AnarcismWorkerPool.create({ workers: 4 });
const results = await pool.numberSequences(inputs);
pool.terminate();

Every asynchronous call accepts an AbortSignal. An aborted call rejects with signal.reason; the pool replaces the workers still computing it, so it stays usable at the same size:

const controller = new AbortController();
const pending = pool.numberSequences(inputs, { signal: controller.signal });
controller.abort();

const anarcism = await Anarcism.create({ signal: AbortSignal.timeout(5_000) });

TypeScript declarations are included. Invalid input raises AnarcismError with a stable code, message, and optional input ID.

Compatibility and size

The reference is ANARCI (OPIG) with HMMER 3.4, pinned in assets/MANIFEST.toml. The parity corpus holds 1,397 sequences (1,398 domains). It combines natural antibody and TCR sequences, IMGT germlines, and published PDB chains with deliberately adversarial stress tests: synthetic CDR-length ladders, framework indels, truncations, scFvs, multidomain constructs, constant domains, and non-antibody decoys.

criterion result
domain detection 1,397/1,397 sequences (100%)
chain classification 1,398/1,398 domains (100%)
species assignment 1,398/1,398 domains (100%)
domain boundaries 1,398/1,398 domains (100%)
IMGT numbering, exact per domain 1,398/1,398 domains (100%)
IMGT numbering, per residue 153,213/153,213 residues (100%)
germline V and J genes 1,398/1,398 domains (100%)

A domain counts as exactly numbered only if every residue's IMGT position and insertion code, and its padded IMGT alignment, match ANARCI. Bit scores stay within 0.15 bits of HMMER's (mean 0.03) and E-values within 7% (mean 1.2%). The reference values live in tests/golden/corpus_reference.jsonl. The Rust and Python golden tests check every row against it, and npm --workspace packages/anarcism run parity reports domain, residue, and score parity for the WebAssembly build.

Development

The build needs Rust and Node.js 20.16+. rust-toolchain.toml pins the Rust release and installs the wasm32-unknown-unknown target. Install Binaryen for wasm-opt; without it the build ships the larger, unoptimized module and prints a warning. Python and ANARCI are only needed to regenerate the reference data; they are not runtime dependencies.

cargo test --workspace
cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings

npm ci
npm --workspace packages/anarcism run build
npm --workspace packages/anarcism test
npm --workspace packages/anarcism run test:browser
npm --workspace packages/anarcism run parity
npm --workspace demo run dev

The package build compiles anarcism-wasm for wasm32-unknown-unknown, optimizes it with wasm-opt -Oz, copies the JavaScript entry points, declarations, and license files next to it in packages/anarcism/dist/, and prints the size report.

Attribution and citation

anarcism reproduces the methods and data of the projects below. If you use it in published work, please cite them.

  • ANARCI (Oxford Protein Informatics Group) defines the recognition, receptor classification, and numbering that anarcism reimplements. anarcism is validated against oxpig/ANARCI at commit 79f6c575056dedef86cb8f405ebb039197923eec, and its embedded profile HMMs and germline tables are generated with ANARCI's own build pipeline.

    Dunbar J, Deane CM. ANARCI: antigen receptor numbering and receptor classification. Bioinformatics 32(2):298–300 (2016). doi:10.1093/bioinformatics/btv552

  • HMMER 3.4 (Sean R. Eddy and the HMMER developers) provides the profile-HMM search and scoring that ANARCI relies on. anarcism reimplements the parts ANARCI uses and is validated against HMMER 3.4.

    Eddy SR. Accelerated profile HMM searches. PLoS Computational Biology 7(10):e1002195 (2011). doi:10.1371/journal.pcbi.1002195

  • IMGT®, the international ImMunoGeneTics information system® (Marie-Paule Lefranc and colleagues), defines the IMGT numbering scheme and supplies the germline sequences, from IMGT/GENE-DB release 202638-7.

    Lefranc M-P, Pommié C, Ruiz M, Giudicelli V, Foulquier E, Truong L, Thouvenin-Contet V, Lefranc G. IMGT unique numbering for immunoglobulin and T cell receptor variable domains and Ig superfamily V-like domains. Developmental & Comparative Immunology 27(1):55–77 (2003). doi:10.1016/S0145-305X(02)00039-3

    Giudicelli V, Chaume D, Lefranc M-P. IMGT/GENE-DB: a comprehensive database for human and mouse immunoglobulin and T cell receptor genes. Nucleic Acids Research 33:D256–D261 (2005). doi:10.1093/nar/gki010

License

The project's own code is licensed under the Apache License 2.0; see LICENSE. Third-party attributions and license texts are in THIRD_PARTY_NOTICES.md.

Release files for anarcism 1.0.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 anarcism 1.0.0
File Size Uploaded
anarcism-1.0.0.tar.gz 336.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for anarcism 1.0.0
File
anarcism-1.0.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
anarcism-1.0.0-cp311-abi3-musllinux_1_2_x86_64.whl CPython 3.11 abi3 Linux musl 1.2+ x86-64 Details
anarcism-1.0.0-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details
anarcism-1.0.0-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details
anarcism-1.0.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details

Total release size: 4.1 MB

Release files / anarcism-1.0.0.tar.gz

Download URL anarcism-1.0.0.tar.gz
Size 336.5 kB
Tags Source
SHA-256 checksum
How to use checksums
aed9a2e8aa6081c01e17030758b979f477df83bd4e66bf3226d1f02cc66fae78
BLAKE2b-256 checksum
How to use checksums
5b25e6c60c181954ba53c8a9f3a0f59c3999002b3bd10d0701776c9ff2c9c231
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / anarcism-1.0.0-cp311-abi3-win_amd64.whl

Download URL anarcism-1.0.0-cp311-abi3-win_amd64.whl
Size 670.4 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
6cb468d29aec42cf10a563c1fb2d24aa24d0f897d76a7d87a18a442a63cc5ac0
BLAKE2b-256 checksum
How to use checksums
98949e3bb4d47ec8ec4180ab690283c2f5a859f5593c2c7030bbfa7c6fc0559b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / anarcism-1.0.0-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL anarcism-1.0.0-cp311-abi3-musllinux_1_2_x86_64.whl
Size 953.8 kB
Tags CPython 3.11 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
4f3511dbc34610b4b8d9f2cde0e8e13b51e8d04ef2e471409986403f4efd5012
BLAKE2b-256 checksum
How to use checksums
25e220f3f6489581e816b6937b5a3ad2e156692aef31485102ca4fea904dc2a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / anarcism-1.0.0-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL anarcism-1.0.0-cp311-abi3-manylinux_2_28_x86_64.whl
Size 741.9 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
2015f182a62d75b4e49db8ab6de38a7db80dc3b1e8554da0e65cc78f01082d83
BLAKE2b-256 checksum
How to use checksums
f4db3026f56f82bc667494bd3fcf747f1044a46178ac07bef529bdd5d2b5558d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / anarcism-1.0.0-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL anarcism-1.0.0-cp311-abi3-manylinux_2_28_aarch64.whl
Size 692.6 kB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
d667d577f9c5a94dc57090cf81f04ebd36240b3d8de75ed161e050ccf6f9acca
BLAKE2b-256 checksum
How to use checksums
ebffa648b990def5a2e622088ddfcd680deb41f6143c4de147d4f23af7d4f67a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / anarcism-1.0.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL anarcism-1.0.0-cp311-abi3-macosx_11_0_arm64.whl
Size 681.0 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d15f6a8a7d5c72bfb7c765714b720fe8be58afe394499e372000c66f59a4a871
BLAKE2b-256 checksum
How to use checksums
fe5287d7ab61c5f88224f2050b79c25d05e10754f578ac2c781e5a541789e336
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release history Release notifications | RSS feed

1.0.1

6 release files

This release

1.0.0 This release

6 release files

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