VDJdb Motif Clustering
April 11, 2026 ยท View on GitHub
This repository now keeps two clustering pipelines side by side:
tcrnet/: the R Markdown workflow based on VDJtools/TCRNETredcea/: the new Python package based on TCRemP + REDCEA-style shared-background clustering
The goal is to keep the TCRNET pipeline runnable as before while letting the new implementation evolve independently.
Repository Layout
vdjdb-motifs/
tcrnet/ TCRNET clustering workflow
redcea/ installable Python package
results/ generated tabular outputs
figures/ generated PDF figures
scripts/ run and setup helpers
Simple Commands
If you just want one command per pipeline:
./scripts/setup.sh tcrnet
./scripts/run_tcrnet.sh
./scripts/setup.sh redcea
./scripts/run_redcea.sh
run_redcea.sh launches TRA and TRB in parallel.
setup.sh redcea requires a working conda installation because it creates and updates the vdjdb-redcea environment automatically.
Thread count is configurable for both pipelines:
TCRNET_NPROC=16 ./scripts/run_tcrnet.sh
REDCEA_NPROC=16 ./scripts/run_redcea.sh
If you want to prepare everything in one go:
./scripts/setup.sh all
Assumptions:
vdjdb_release/vdjdb.slim.txtalready exists before running either pipeline.- the repository is run in a Unix-like environment.
Required command-line tools:
- shared:
bash - TCRNET:
Rscript,python,VDJtools,wget,unzip - REDCEA:
conda,curl,tar
Notes on these requirements:
scripts/setup.sh tcrnetinstalls the needed R packages automatically, but it does not installVDJtoolsitself.scripts/run_tcrnet.shnow also runs a small Python post-processing step that generates per-epitope HTML visualizations.scripts/setup.sh redceacreates and updates thevdjdb-redceaconda environment automatically.
Background Data
tcrnetbackgrounds are public and downloaded automatically from Zenodo byscripts/fetch_tcrnet_backgrounds.sh.redceaneeds two prepared background files:- AIRR repertoire table
- embedding parquet file
- The repository now includes a downloader script for
redcea. - By default it downloads
https://zenodo.org/records/19520535/files/redcea_bg.gz. - You can still pass a different Zenodo archive URL as the first argument if needed.
scripts/setup.sh redcea <url>passes that URL through to the REDCEA background fetch step.scripts/install_redcea.shcreates a separate conda environment and installs this repository'sredceapackage together with its declared git-based dependencies.
REDCEA Zenodo Files
If you want redcea to start quickly from downloaded assets, the default Zenodo bundle is:
https://zenodo.org/records/19520535/files/redcea_bg.gz
Required per chain:
tra_background_100k.tsvtra_background_100k_embeddings.parquettrb_background_100k.tsvtrb_background_100k_embeddings.parquet
What these do:
*_background_100k.tsvis the actual background repertoire input passed to--background-airr.*_background_100k_embeddings.parquetis the precomputed background embedding input passed to--background-embeddingafter renaming during install.
What you do not need to upload:
- background transform caches
- per-epitope sample embeddings
- per-run cluster tables
- HTML visualizations
cluster_members_*.txt
Practical recommendation:
- if you run both
TRAandTRB, include both required chain-specific AIRR/embedding pairs in the bundle ./scripts/run_redcea.shuses the default local paths above directly
UMAP tuning note:
- the REDCEA plotting layout now accepts
--umap-n-neighborsand--umap-min-dist scripts/run_redcea.shkeeps separate per-chain defaults viaREDCEA_UMAP_N_NEIGHBORS_TRA/REDCEA_UMAP_MIN_DIST_TRAandREDCEA_UMAP_N_NEIGHBORS_TRB/REDCEA_UMAP_MIN_DIST_TRB- if needed, a global
REDCEA_UMAP_N_NEIGHBORSorREDCEA_UMAP_MIN_DISTenvironment override still takes precedence for ad hoc runs - if sample clusters form detached islands far from the grey background cloud, try increasing these values, for example
--umap-n-neighbors 50 --umap-min-dist 0.4 - changing either value invalidates the previous plotting transform on purpose, so the cached background transform is recomputed automatically
Notes
- TCRNET outputs now go to
results/tcrnet/and keep the standard namescluster_members.txtandmotif_pwms.txt. - TCRNET HTML visualizations are collected in
results/tcrnet/viz/. - TCRNET PDF figures go to the repository-level
figures/directory. - TCRNET respects
TCRNET_NPROCfor parallel R steps. - REDCEA writes both chains into
results/redcea/. - REDCEA HTML visualizations are collected in
results/redcea/viz/. - REDCEA
cluster_members_TRA.txtandcluster_members_TRB.txtare written directly intoresults/redcea/. - REDCEA uses
vdjdb_release/vdjdb.slim.txtas the default VDJdb input table. - REDCEA respects
REDCEA_NPROC; whenREDCEA_CHAIN=both,TRAandTRBare still launched in parallel as separate jobs.