Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

tcrio

Polars-based I/O and QC toolkit for T-cell receptor (TCR) repertoire datasets. Fast ingestion of many sequencing formats into a standardized dataset layout, plus QC operations (filtering, diversity, gene-usage, VDJ statistics, overlap, HLA inference, CMV hits).

Install (closed beta)

Beta wheels are attached to GitHub Releases (not on PyPI yet):

pip install <url-to-the-release-wheel>

The wheel bundles the compiled Rust extension and the HLA/CMV model data, so no build tools or extra downloads are needed.

Quick start

import tcr_io

# Build a dataset from a directory of repertoire files
ingester = tcr_io.DatasetIngester(
    db_dir="./my_datasets",
    db_name="example",
    repertoire_mapper=tcr_io.FileNameMapper(),
    patient_mapper=tcr_io.FileNameMapper(),
)
ds = ingester.run("path/to/repertoire/files/*.tsv")

# Run a QC operation
from tcr_io.operations import GeneCountsSummary
ds.run_operation(GeneCountsSummary())
print(ds.result(GeneCountsSummary.gene_counts, locus="TRB").read())

Dataset layout

A dataset is a directory with this on-disk structure:

my_dataset/
├── processed_repertoires/          # One directory per repertoire, hive-partitioned by locus.
│   └── sample_001/                 # Atomic unit: standardized schema, repertoire_id column.
│       ├── locus=TRB/sample_001.parquet
│       └── locus=TRA/sample_001.parquet
│
├── meta/
│   ├── manifest.json           # Dataset version, present loci, ingest filter provenance.
│   ├── generation.json         # One row per dataset generation. When, how, source, etc.
│   ├── repertoire/
│   │   ├── TRB.parquet              # One row per repertoire on this locus. IDs, counts.
│   │   └── repertoire_meta.parquet  # Optional extra metadata (join on repertoire_id).
│   ├── patient/
│   │   ├── patient.parquet           # One row per patient. Aggregated stats.
│   │   ├── patient_meta.parquet      # Optional extra metadata (join on patient_id).
│   │   └── hla.parquet               # Optional. Known HLA typing.
│   ├── publication/
│   │   ├── publication_ids.json      # DOI(s) / pubmed_id(s) for associated publications.
│   │   └── publication.parquet       # Generated, fetched metadata cached here.
│   └── clone_to_cell/                # Single-cell datasets only: clonotype <-> cell map.
│
└── operations/                 # Generated, deletable, rebuildable.
    └── <operation>/<LOCUS>/    # One pass per (operation, locus); no locus segment when
        ├── operation.json      # the operation is locus-agnostic.
        └── *.parquet           # The pass's declared outputs, read back via `ds.result()`.

Bundled models

All model-based operations work out of the box — their reference data ships inside the wheel and loads automatically with no arguments:

  • HlaInference / RepertoireHlaInference — HLA inference
  • ECOClusterHits — CMV EcoCluster hits
  • MaitHits — MAIT hits

Each also accepts model_checkpoint=<path> to override with your own model.

Development

make venv          # create .venv from requirements.txt (dev lockfile)
make install       # maturin develop (build the Rust extension)
make test          # pytest
make pre-commit    # fmt + clippy + ruff + mypy

Bundled resources are generated from raw model sources with python scripts/build_resources.py --build (see model_sources/README.md).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tcrio-0.4.0b5.tar.gz (14.9 MB view details)

Uploaded Source

Built Distributions

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

tcrio-0.4.0b5-cp310-abi3-win_amd64.whl (20.1 MB view details)

Uploaded CPython 3.10+Windows x86-64

tcrio-0.4.0b5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

tcrio-0.4.0b5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (20.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

tcrio-0.4.0b5-cp310-abi3-macosx_11_0_arm64.whl (19.8 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

tcrio-0.4.0b5-cp310-abi3-macosx_10_12_x86_64.whl (20.1 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file tcrio-0.4.0b5.tar.gz.

File metadata

  • Download URL: tcrio-0.4.0b5.tar.gz
  • Upload date:
  • Size: 14.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.15.0

File hashes

Hashes for tcrio-0.4.0b5.tar.gz
Algorithm Hash digest
SHA256 129367b3757296414b56e1f22746dc8c7f2f8884fe443eb54ad18852189a3c85
MD5 bbeee55ec3126732f81c24d261161cd7
BLAKE2b-256 3e7de7d645553568e49c4a91bbdbd65c1bea8f75385f9cb5980b4cca871eb1a0

See more details on using hashes here.

File details

Details for the file tcrio-0.4.0b5-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: tcrio-0.4.0b5-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 20.1 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.15.0

File hashes

Hashes for tcrio-0.4.0b5-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 060f974f66d2d14259e8d5fa79694fd57d4e30e1bd0cd4f6c86bfb571a6146d3
MD5 181b5dd7efbb43d1ed12fc96c82f343c
BLAKE2b-256 ad00c9b6957453a41f05077a1738e727d44ad9b5a3d8cf8fc12f15232d4e41c8

See more details on using hashes here.

File details

Details for the file tcrio-0.4.0b5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tcrio-0.4.0b5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4689797053738528abd9d37e94e52e5bfa8a435ab63c278072c3d18de7c25b32
MD5 aff0c618d945c43997562760a880c812
BLAKE2b-256 ec4a2eff071a186186d00435b5d6a821eb0e053997de44d10dbf1ceaaa845ce9

See more details on using hashes here.

File details

Details for the file tcrio-0.4.0b5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tcrio-0.4.0b5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fc44035ed1aebb7a2ad4c488d225f80023dc6f6c77db4eab58daaa90bab495eb
MD5 c01abd23bcfd57847ed95b6dd9ed3ee4
BLAKE2b-256 3a89875ed5a7887d25ab184e4af0534adef5e859bbf48d46c6190605e317b2a4

See more details on using hashes here.

File details

Details for the file tcrio-0.4.0b5-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tcrio-0.4.0b5-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4572d69b484cce76cd3b688a48f41ac2b82a908cfa6fe27c41fe4c52ef1de355
MD5 082151987790f831959d0db378471555
BLAKE2b-256 bfe8dc145eac67f1d941c28938230d3ea875734b43bbaf6318cb40cc5db8a2f4

See more details on using hashes here.

File details

Details for the file tcrio-0.4.0b5-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for tcrio-0.4.0b5-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 01f8e10d6a3ba8545a52a5068d07f548850be2b61b9266732f0ec047c03d249a
MD5 4b8505934ffd3ba1ecd3731fb767596b
BLAKE2b-256 a6e3568cc01353c11b60987badffc109e1f1fa1c86320f418cef71f482c49b31

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.4.0b5 This release

6 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