Command reference#
pip install mirpy-lib installs one mir command with four subcommands. 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.
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 defaults to the filename stem. 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 cores.
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.
mir embed clonotypes#
One repertoire in, one row per clonotype out – the input to clustering, visualisation and per-receptor machine learning.
mir embed clonotypes sample.tsv -o clonotypes.parquet
mir embed clonotypes sample.tsv --pca 50 --n-prototypes 1000 -o clonotypes.parquet
Option |
Meaning |
|---|---|
|
|
|
Pin the chain instead of inferring it. Accepts aliases. |
|
How many prototypes define the coordinate system. Omitted, the per-chain preset is used. |
|
|
|
Which disjoint block of prototypes to draw, |
|
Denoise to this many components. The preset’s 95-percent dimension is the usual choice. |
|
|
mir embed repertoires#
A set of repertoires in, one fingerprint Phi(S) per sample per chain out, all on one shared
basis so the rows are mutually comparable.
mir embed repertoires cohort/*.tsv.gz -o phi.tsv
mir embed repertoires cohort/*.tsv.gz -o phi.tsv --mmd mmd.tsv --blocks mean,diversity,second
Option |
Meaning |
|---|---|
|
Which blocks make up the vector: |
|
The clone-size transform: |
|
Random-feature dimensions for the kernel mean and the second-moment block. |
|
PCA dimension of the underlying clonotype space. |
|
Also write the pairwise MMD distance matrix. Per chain: with several loci this becomes
|
|
Fixes the random features, and therefore the basis. |
mir signature#
One repertoire in, one row of fixed, named, already-standardised features 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 – |
|
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. |
|
Worker processes over samples, |
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.