High-performance clonify implementation with native average-linkage clustering
Project description
clonify (native)
High-performance clonotype assignment with a native Rust backend and average-linkage clustering.
Installation
clonify is published on PyPI with prebuilt wheels for common platforms:
- macOS (Apple Silicon arm64 and Intel x86_64)
- Linux (manylinux x86_64)
Requires Python 3.8+.
pip
python -m pip install -U pip setuptools wheel
python -m pip install clonify
If you want to avoid building from source, you can force a prebuilt wheel only:
python -m pip install --only-binary=:all: clonify
uv
# install into the current environment
uv pip install clonify
# or create/use a uv-managed virtualenv
uv venv .venv
source .venv/bin/activate
uv pip install clonify
Compatibility
| OS | Architecture | Python versions (CPython) | Distribution |
|---|---|---|---|
| macOS | arm64 (Apple Silicon) | 3.8 – 3.12 | Prebuilt wheel |
| macOS | x86_64 (Intel) | 3.8 – 3.12 | Prebuilt wheel |
| Linux (manylinux) | x86_64 | 3.8 – 3.12 | Prebuilt wheel |
| Other/older combos | varies | 3.8+ | Source build via Rust |
Notes:
- Wheels target mainstream CPython versions; newer versions may be added as releases are cut.
- If a wheel isn’t available for your exact combo, the installer will attempt a source build. See Troubleshooting.
Verify your installation
-
CLI:
clonify --help -
Python:
import clonify from clonify import clonify as run_clonify
Quick start
CLI
AIRR-compliant TSV is expected to be input format, using either the unpaired sequence schema or the modified paired sequence schema used by abstar. Clonify can also accept CSV/TSV/Parquet/NDJSON/JSON files; format is inferred from the extension. The output format is inferred from the extension of the supplied --output path; if omitted, CSV is printed to stdout.
# Minimal: read TSV and write CSV
clonify \
--input data/airr.tsv \
--output results/lineages.csv
# With optional JSON mapping of sequence_id -> lineage
clonify \
--input data/airr.tsv \
--output results/lineages.parquet \
--assignments-json results/assignments.json \
--distance-cutoff 0.35 \
--shared-mutation-bonus 0.35 \
--length-penalty-multiplier 2.0
Python API
Using a Polars DataFrame (recommended for native backend):
import polars as pl
from clonify import clonify
# df must include v_gene, j_gene, cdr3, and v_mutations columns (paired inputs are supported)
df = pl.read_csv("data/airr.tsv", separator="\t")
assignments, df_out = clonify(
df,
distance_cutoff=0.35,
shared_mutation_bonus=0.35,
length_penalty_multiplier=2.0,
)
# Write results
df_out.write_parquet("results/lineages.parquet")
You can also pass a file path directly; the format is inferred by extension. If you provide output_path, results are written automatically:
from clonify import clonify
assignments, df_out = clonify(
"data/airr.tsv",
output_path="results/lineages.csv", # csv/tsv/parquet/json/ndjson
)
Troubleshooting installation
clonify ships wheels for the platforms listed above. If no compatible wheel is available for your OS/architecture/Python version, the installer will attempt to build from source using Rust (via maturin/pyo3).
What failure looks like when no wheel is available and Rust is not installed
During pip install clonify (or uv pip install clonify), you may see messages such as:
- "Building wheel for clonify (pyproject.toml) did not run successfully"
- "error: cargo not found" or "error: can't find Rust compiler"
- "note: maturin failed; ensure Rust toolchain is installed"
This indicates a source build was triggered but a Rust toolchain is missing.
How to fix
- Install Rust (recommended):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh- Restart your shell, then verify:
rustc --versionandcargo --version.
- Upgrade build tooling:
python -m pip install -U pip setuptools wheel. - macOS build tools (if building from source):
xcode-select --install. - Ensure your Python architecture matches your OS:
- Apple Silicon: Prefer an arm64 Python. Check with
python -c "import platform; print(platform.machine())"(expectarm64). If running under Rosetta (x86_64), use an arm64 Python or install the x86_64 wheel in a matching environment.
- Apple Silicon: Prefer an arm64 Python. Check with
- Prefer wheels when available:
python -m pip install --only-binary=:all: clonify. - If behind a proxy/offline: download the appropriate wheel from PyPI on a connected machine and
pip install path/to/clonify-<version>-<tags>.whl.
If issues persist, reinstall Rust via rustup and retry with verbose logs:
python -m pip install -v clonify
Usage
from clonify import clonify
assign_dict, df_out = clonify(df, distance_cutoff=0.35)
Development
- Create a virtual environment (recommended)
- Build editable native extension:
pip install maturin && maturin develop - Run tests:
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clonify_antibody-0.1.0.tar.gz.
File metadata
- Download URL: clonify_antibody-0.1.0.tar.gz
- Upload date:
- Size: 6.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
caf5bf3a15565d9ab53e9030656bcacc56016947c3b0e6d5cf8424fa9da21098
|
|
| MD5 |
682d25b61cf2698f74feae0db53b1c0c
|
|
| BLAKE2b-256 |
a6445efa72c6add3b7c0561251912086741d7ad57b502b6181b1a1b2203d2a76
|
Provenance
The following attestation bundles were made for clonify_antibody-0.1.0.tar.gz:
Publisher:
publish.yml on brineylab/clonify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
clonify_antibody-0.1.0.tar.gz -
Subject digest:
caf5bf3a15565d9ab53e9030656bcacc56016947c3b0e6d5cf8424fa9da21098 - Sigstore transparency entry: 382224599
- Sigstore integration time:
-
Permalink:
brineylab/clonify@78a77a0c8bbbd828871d5374f57969942f601c15 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/brineylab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@78a77a0c8bbbd828871d5374f57969942f601c15 -
Trigger Event:
release
-
Statement type:
File details
Details for the file clonify_antibody-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: clonify_antibody-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 299.8 kB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00a88edd3ea09531ec214813c21f2f58313f65b5e90a661a55a51a5e09b158f1
|
|
| MD5 |
792743859fe69979bdb98f18c35715d5
|
|
| BLAKE2b-256 |
380a4f13caaa15cd396660025b0a74ee50a52366694eb6d9d6080ca57ed53436
|
Provenance
The following attestation bundles were made for clonify_antibody-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on brineylab/clonify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
clonify_antibody-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
00a88edd3ea09531ec214813c21f2f58313f65b5e90a661a55a51a5e09b158f1 - Sigstore transparency entry: 382224747
- Sigstore integration time:
-
Permalink:
brineylab/clonify@78a77a0c8bbbd828871d5374f57969942f601c15 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/brineylab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@78a77a0c8bbbd828871d5374f57969942f601c15 -
Trigger Event:
release
-
Statement type:
File details
Details for the file clonify_antibody-0.1.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: clonify_antibody-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 256.0 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c948c881b54e6fa34824fc0d1fcc0b9a46bb71377eb874ee2ede8f648f08ad1
|
|
| MD5 |
39038b3bac086e7005e1438d37c722ad
|
|
| BLAKE2b-256 |
74c0b70d05d5131795eb87a86593b983bc2f33096c0e8b7d6c216abadf2a670c
|
Provenance
The following attestation bundles were made for clonify_antibody-0.1.0-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
publish.yml on brineylab/clonify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
clonify_antibody-0.1.0-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
5c948c881b54e6fa34824fc0d1fcc0b9a46bb71377eb874ee2ede8f648f08ad1 - Sigstore transparency entry: 382224649
- Sigstore integration time:
-
Permalink:
brineylab/clonify@78a77a0c8bbbd828871d5374f57969942f601c15 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/brineylab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@78a77a0c8bbbd828871d5374f57969942f601c15 -
Trigger Event:
release
-
Statement type:
File details
Details for the file clonify_antibody-0.1.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: clonify_antibody-0.1.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 499.3 kB
- Tags: CPython 3.10+, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b5991e3385fe528b3a6f19f28a4496d43808050f64dde1bdd17a4ef845eea0c
|
|
| MD5 |
94e1625c4adaffc23d0c67c4d5123eaa
|
|
| BLAKE2b-256 |
6d36a6d4c101625584038390cf76d90264f13def3709d91f5ebd798514c4888f
|
Provenance
The following attestation bundles were made for clonify_antibody-0.1.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:
Publisher:
publish.yml on brineylab/clonify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
clonify_antibody-0.1.0-cp310-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl -
Subject digest:
3b5991e3385fe528b3a6f19f28a4496d43808050f64dde1bdd17a4ef845eea0c - Sigstore transparency entry: 382224684
- Sigstore integration time:
-
Permalink:
brineylab/clonify@78a77a0c8bbbd828871d5374f57969942f601c15 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/brineylab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@78a77a0c8bbbd828871d5374f57969942f601c15 -
Trigger Event:
release
-
Statement type: