Configuration reference#
Tsinfer is configured via a TOML file passed to the CLI. Paths in the config are resolved relative to the config file’s directory.
A complete annotated example is in example_config.toml.
Top-level fields#
Field |
Type |
Default |
Description |
|---|---|---|---|
|
string |
— |
Contig to infer (e.g. |
Inference works on one contig at a time. Every store (sources, ancestral state,
ancestors) is restricted to the variants on contig, which must be declared in
each store’s contig_id header under the same name. Each store must be sorted
by contig. If contig is not set, the variants in all stores must lie on a
single contig, which is used.
The sequence length is taken from the contig’s contig_length in the stores,
at least one of which must declare it. If stores declare different lengths, a
warning is issued and the largest is used.
[[source]]#
Each [[source]] block defines a named view over a VCZ store. The same store
can appear multiple times with different filters.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
string |
(required) |
Unique name for this source |
|
string |
(required) |
Path to VCZ store |
|
string |
— |
bcftools include expression (e.g. |
|
string |
— |
bcftools exclude expression |
|
string |
— |
Sample filter (comma-separated; prefix |
|
string |
— |
Genomic region, half-open (e.g. |
|
string |
— |
Exact target positions |
|
various |
— |
Per-sample times: constant, field name, or |
[ancestral_state]#
Specifies where to read the ancestral allele for each variant position.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
string |
(required) |
Path to VCZ containing ancestral alleles |
|
string |
— |
Array name in the store (e.g. |
|
bool |
|
Use the REF allele ( |
|
string |
— |
Name of the contig in this store’s header (see the top-level |
|
string |
— |
bcftools-style filter expression selecting annotation variants (e.g. |
|
string |
— |
bcftools-style filter expression excluding annotation variants |
|
string |
— |
Genomic region, half-open (e.g. |
|
string |
— |
Exact target positions |
The annotation is joined to the sources by position. After filtering, there
must be at most one annotation variant at each site, and its REF allele must
equal the site’s REF allele in the sources; otherwise an error is raised. All
sources with a variant at a site must also have the same REF allele there,
although their ALT alleles may differ. If
the annotation contains, for example, both a SNP and an indel at the same
position, use include = 'TYPE="snp"' to keep only the SNP. An ancestral
state of ., N or the empty string means the ancestral allele is unknown,
as does one that is not among the site’s alleles; such sites are excluded from
inference and from augment_sites.
[[ancestors]]#
Controls the ancestor-generation step (infer-ancestors). At least one
[[ancestors]] block is required unless [match] specifies a reference_ts.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
string |
(required) |
Unique ancestor set name |
|
string |
(required) |
Output VCZ path |
|
list[str] |
(required) |
Source names to build ancestors from |
|
int |
500,000 |
Split intervals at gaps wider than this (bp) |
|
int |
100 |
Zarr chunk size (ancestor dimension) |
|
int |
50,000 |
Zarr chunk size (site dimension) |
|
string |
|
Blosc compressor name |
|
int |
7 |
Compression level (0–9) |
|
string |
|
|
[match]#
Controls the HMM matching step.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
string |
(required) |
Output |
|
bool |
|
Enable Viterbi path compression |
|
string |
— |
Tree sequence to match against instead of inferred ancestors, e.g. the output of matching ancestors only. Haplotypes are matched at its sites, and all of its nodes must be older than the haplotypes being matched. |
|
string |
— |
Checkpoint directory (enables resume) |
|
bool |
|
Keep per-group checkpoint files |
[match.sources.<name>]#
Per-source parameters. Every source that should appear in the output tree sequence needs an entry here.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
int |
1 |
tskit node flags ( |
|
bool |
|
Group sample nodes into tskit individuals |
|
float or string |
— |
Recombination rate per bp per generation, or the path to a HapMap genetic map (see below). Cannot be combined with |
|
float |
|
Probability of recombination between each pair of adjacent inference sites |
|
float |
|
Probability of a mismatch (an extra mutation) at each inference site |
|
float |
smallest positive double |
Lower bound on the normalised HMM likelihoods. Larger values (e.g. |
These are the parameters of the Li & Stephens copying HMM used to match each haplotype from the source. The defaults (a high recombination probability and a negligible mismatch probability) mean that haplotypes are copied exactly, using recombination rather than extra mutations to explain differences.
When recombination_rate is given, the genetic distance d (in Morgans)
between adjacent inference sites is converted to a recombination probability
using Haldane’s map function, (1 - exp(-2*d)) / 2. A genetic map file is in
HapMap format: a single header line followed by whitespace-separated columns
giving the chromosome, position (bp), rate (cM/Mb) and cumulative map
position (cM). Only the position and map columns are used. The map is
linearly interpolated between entries, starts at 0 cM at position 0, and
has zero recombination rate beyond the last entry.
The mismatch probability is not derived from the recombination rate, so
setting recombination_rate on its own still allows no mismatches; set
mismatch as well to allow them. For example:
[match.sources.ancestors]
node_flags = 0
create_individuals = false
recombination_rate = "maps/chr20.txt"
mismatch = 1e-10
[match.sources.cohort]
recombination_rate = "maps/chr20.txt"
mismatch = 1e-4
[post_process]#
Optional cleanup applied after matching.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
bool |
|
Split virtual root into per-tree roots |
|
bool |
|
Erase ancestry outside informative sites |
[augment_sites]#
Place non-inference sites via parsimony.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
list[str] |
(required) |
Source names for parsimony placement |
[individual_metadata]#
Map VCZ sample-dimensioned arrays into tskit individual metadata.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
string |
— |
VCZ array whose unique values become tskit populations |
[individual_metadata.fields]#
Each key becomes a tskit metadata field; the value names the VCZ array.
[individual_metadata.fields]
name = "sample_id"
sex = "sample_sex"