Command reference#
pip install mirpy-lib installs one mir command with embedding, PCA, signature and reference commands. This page lists each
one, what it is for, and the options that change an answer rather than only a path.
mir <command> --help is the authoritative list of flags and defaults – it is generated from the
code, so it cannot drift. This page is the map.
Conventions#
Input. Any format vdjtools.io reads: AIRR Rearrangement TSV, native vdjtools, MiXcr,
immunoSEQ, Parquet. Several files or a glob are fine.
Species. --species selects the receptor species for embedding, signature computation
and synthetic corpus building; the default is human. Use a basis or corpus fitted for the same species.
Output. -o/--output writes TSV, or Parquet when the path ends in .parquet. Parquet is
worth using for the raw per-clonotype embedding, which is thousands of columns wide. Omit -o and
the result goes to stdout.
Sample identity. The sample ID is the filename up to its first dot; files sharing it form one sample. The locus is inferred per file, or
pin it with --locus, which accepts aliases – beta, T-alpha – and errors on anything it
cannot resolve rather than guessing.
Threads. --threads 0 means all allocated cores. Positive counts must fit the allocation; excessive requests raise.
Non-coding clonotypes are dropped, and there is no flag to keep them. Both embed commands
filter to productive clonotypes first. This is deliberate: a stop codon is a character in seqtree’s
alphabet, so an unfiltered frame does not fail – it embeds to a finite, meaningless distance and
contaminates the geometry silently. --no-filter-functional is refused with a pointer to
vdjtools filter --nonproductive, which is what to use when the non-productive fraction is itself
the thing you want.
Embedding and PCA commands#
Command |
Result |
|---|---|
|
Clonotype coordinates with sample/clonotype IDs. |
|
Unprojected sample RFF vectors. |
|
Fit and save sample PCA; |
|
Apply a previously fitted sample rotation. |
mir embed repertoires samples/*.tsv --save-basis basis -o rff.tsv
mir pca rff.tsv --fit rotation.npz --n-components 32 -o pcs.tsv
Inline sample PCA uses --pca, --pca-cohort or --rotation. Keep its RFF
input with --rff-output and save a fit with --save-rotation.
--n-components on embed repertoires controls the clonotype basis, not sample
PCA. --mmd FILE writes one unbiased MMD distance table per locus.
Clonotype and sample embeddings defines output columns, basis compatibility, channels, memory budgets, Parquet requirements and the complete fit/reuse workflows.
mir embeddings / mir signature#
One repertoire in, one row of fixed, named corpus PCs and pass-through channels out – the geometry
half of the portable signature. The statistics half is vdjtools signature, and the two join on
sample_id.
mir signature --corpus blood cohort/*.tsv.gz -o rsig.parquet
mir signature --corpus blood --components 32 --describe
Option |
Meaning |
|---|---|
|
Required. A published name – |
|
Clonotype abundance weighting: |
|
An integer count or a variance fraction. Truncating a wider rotation downward is exact. |
|
|
|
Which stored percentile to clamp at, |
|
|
|
Print the columns this invocation emits, and exit. |
|
Also emit the reportable raw blocks under their own names ( |
|
The floor below which a locus’s whole |
|
Restrict the output to a file of column names. |
|
Sample workers: |
Which corpus to choose, and what the columns mean, are in Repertoire signatures and Channels.
mir corpus#
Fetch a published corpus artifact, or build a synthetic one.
mir corpus --fetch all # pre-warm the cache
mir corpus --corpus synthetic-blood -o sb.npz # build and fit your own
mir corpus --smoke -o /tmp/smoke.npz # a reduced build, minutes not hours
Building a synthetic corpus uses no samples from anybody’s cohort: every receptor is drawn from
vdjtools’ bundled recombination models, so the artifact is reproducible by anyone who installs the
library and is byte-identical across processes and thread counts. --samples, --size,
--seed, --loci, --source and --depth-spread control the draw and are all recorded in
the manifest.
Pre-stage reference rotations#
mir reference NAME fetches a reference from the published
isalgo/airr_feature_signatures dataset, verifies every manifest checksum, and prints its
local references/NAME directory. The default is pinned to the release-tested
immutable revision. Override it with --revision COMMIT using a full commit SHA. It does not
load pickle models or fit a rotation. Use the resulting directory with
--basis, --rotation and vdjtools’ --feature-vocabulary.
--cache-dir PATH selects a writable Hugging Face cache directory. --offline
uses only a snapshot already staged there. Pre-stage once before workflow fan-out;
workers can use the verified directory as a read-only reference input. Hugging
Face handles per-file download locks and atomic cache publication.
Use --force-download online to recover a corrupted cache entry; verification
still checks every manifest hash. It cannot be combined with --offline.
An offline cache miss prints the corresponding pre-staging command.