Polars-based I/O and QC toolkit for T-cell receptor (TCR) repertoire datasets.
Project description
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.get_operation_result("gene_counts_summary"))
Dataset layout
A dataset is a directory with this on-disk structure:
my_dataset/
├── processed_repertoires/ # One parquet per repertoire. Atomic unit.
│ ├── sample_001.parquet # Standardized schema, repertoire_id column
│ └── sample_002.parquet
│
├── tabulated/ # Hive-partitioned. Generated, deletable, rebuildable.
│ ├── v_gene=TRBV7-2/
│ │ └── j_gene=TRBJ2-1/
│ │ └── my_dataset.parquet
│ └── ...
│
├── meta/
│ ├── generation.json # One row per dataset generation. When, how, source, etc.
│ ├── operations.json # One row per operation performed on this dataset.
│ ├── repertoire/
│ │ ├── repertoire.parquet # One row per repertoire. IDs, counts, source files, patient_ids.
│ │ └── 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.
│ │ └── inferred_hla.parquet # Optional. Computationally inferred.
│ └── publication/
│ ├── publication_ids.json # DOI(s) / pubmed_id(s) for associated publications.
│ ├── pdfs/ # Optional publication PDFs.
│ └── publication.parquet # Generated, fetched metadata cached here.
│
├── qc/ # Generated. QC metric tables + plots.
│ ├── repertoire_stats.parquet
│ ├── gene_usage.parquet
│ ├── overlap.parquet
│ └── repertoire_stats.png
│
└── README.md # Optional. Auto-generated dataset card.
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 inferenceECOClusterHits— CMV EcoCluster hitsMaitHits— 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).
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 tcrio-0.2.0b3.tar.gz.
File metadata
- Download URL: tcrio-0.2.0b3.tar.gz
- Upload date:
- Size: 13.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6b5dfade1844e66ceb1fe3f05e456591112fb76bb3dc84671dbb678f30e1d1e
|
|
| MD5 |
5f04af345cb33ad951a80c434d7401d7
|
|
| BLAKE2b-256 |
b8c16529bafbadad8c946a29d4e50a3b88301af7a4824356edeb656fa51025bd
|
File details
Details for the file tcrio-0.2.0b3-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: tcrio-0.2.0b3-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 18.4 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
485ab2eadd2d4b24af810fa4c27e3760fa23086d32154a0baa904572ed8c1938
|
|
| MD5 |
2f49c43b1c4ebb4447bdb027a0ac5e72
|
|
| BLAKE2b-256 |
4eae59551183b284830b3e71c851e363f908afcc0bae1892656b791676cbe0bd
|
File details
Details for the file tcrio-0.2.0b3-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: tcrio-0.2.0b3-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 19.1 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b60a285318d439ea4b9a257059ee90c3a8f7475e96c4755cce30d71688088a34
|
|
| MD5 |
6627e6db4b7400b6a888977312ee09d8
|
|
| BLAKE2b-256 |
4cb01ded3811bcd6560ab2eeec99045a538d6861fcb29167fa9b75e46777c723
|
File details
Details for the file tcrio-0.2.0b3-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: tcrio-0.2.0b3-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 18.6 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24213591e24101979493b751bf65330147dd944fd1c647c34199d6dbb3165e50
|
|
| MD5 |
400bedff2023e62054156a3579c2e1ff
|
|
| BLAKE2b-256 |
f9683ff9b2512e3ef99c3fec07c088d56e4c0fd102da2a612869bc8d77a5089b
|
File details
Details for the file tcrio-0.2.0b3-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: tcrio-0.2.0b3-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 18.1 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0a3ffcda48b515a3b3ad393c89afec948d1d83b6727fc41378f45c1f4130c6b
|
|
| MD5 |
dc8a0f767855e6b11934a0c4356ce679
|
|
| BLAKE2b-256 |
fa67fb6ae18e65fb1fc3d0e50878e1cc600e8d7c5459736b0c7723d5d0182893
|
File details
Details for the file tcrio-0.2.0b3-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: tcrio-0.2.0b3-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 18.5 MB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06fd644625847053973f0207064ebb75f71275fa04fe9486f1f68541d11552fa
|
|
| MD5 |
14ac4ddba4670c6f553a0e7d692d0b6d
|
|
| BLAKE2b-256 |
4b902e321fc260a67d54b6c75fd0dd83fc99fe05abda5b8c7cb1f984528bd146
|