|
| 1 | +# Example tsinfer config for 1000 Genomes Project chromosome 20. |
| 2 | +# |
| 3 | +# Assumes input data has been converted to VCZ format using bio2zarr: |
| 4 | +# bio2zarr vcf2zarr convert 1kgp_chr20.vcf.gz data/1kgp_chr20.vcz |
| 5 | +# |
| 6 | +# Run the full pipeline: |
| 7 | +# tsinfer run example_config.toml --threads 4 -v |
| 8 | +# |
| 9 | +# Or run steps individually: |
| 10 | +# tsinfer infer-ancestors example_config.toml --threads 4 -v |
| 11 | +# tsinfer match example_config.toml --threads 4 -v |
| 12 | +# |
| 13 | +# Paths are resolved relative to this file's directory. |
| 14 | + |
| 15 | +# ============================================================================ |
| 16 | +# Sources |
| 17 | +# ============================================================================ |
| 18 | +# Each [[source]] block defines a named view over a VCZ store. The same store |
| 19 | +# can appear multiple times with different filters. |
| 20 | + |
| 21 | +[[source]] |
| 22 | +name = "1kgp_chr20" |
| 23 | +path = "data/1kgp_chr20.vcz" |
| 24 | + |
| 25 | +# Variant filters use bcftools-style expressions (via vcztools). |
| 26 | +# Uncomment to restrict to biallelic SNPs with QUAL >= 30: |
| 27 | +# include = "TYPE='snp' && N_ALT=1 && QUAL >= 30" |
| 28 | + |
| 29 | +# Exclude specific variants: |
| 30 | +# exclude = "FILTER != 'PASS'" |
| 31 | + |
| 32 | +# Restrict to a genomic region (half-open coordinates): |
| 33 | +# regions = "chr20:1000000-50000000" |
| 34 | + |
| 35 | +# Restrict to exact target positions (useful for known-site lists): |
| 36 | +# targets = "chr20:1000000-50000000" |
| 37 | + |
| 38 | +# Subset samples by name (comma-separated). Prefix with ^ to exclude: |
| 39 | +# samples = "HG00096,HG00097,HG00099" |
| 40 | +# samples = "^NA12878,NA12891" # all samples except these two |
| 41 | + |
| 42 | +# Per-sample times. Use a field name in the VCZ store, a constant, or a |
| 43 | +# path to an external VCZ with a matching sample dimension: |
| 44 | +# sample_time = 0 # constant: all contemporary |
| 45 | +# sample_time = "variant_sample_time" # field in the source store |
| 46 | +# sample_time = { path = "ages.vcz", field = "sample_time" } # external |
| 47 | + |
| 48 | + |
| 49 | +# ============================================================================ |
| 50 | +# Ancestral state |
| 51 | +# ============================================================================ |
| 52 | +# Where to find the ancestral allele for each variant. Required when the |
| 53 | +# source VCZ does not contain a "variant_ancestral_allele" array. |
| 54 | +# |
| 55 | +# For 1000 Genomes, Ensembl provides ancestral allele annotations in a |
| 56 | +# separate VCF/VCZ. The "field" is the array name holding the allele string. |
| 57 | + |
| 58 | +[ancestral_state] |
| 59 | +path = "data/homo_sapiens-chr20.vcz" |
| 60 | +field = "variant_AA" |
| 61 | + |
| 62 | + |
| 63 | +# ============================================================================ |
| 64 | +# Ancestors |
| 65 | +# ============================================================================ |
| 66 | +# Controls the ancestor-generation step (infer-ancestors). |
| 67 | + |
| 68 | +[[ancestors]] |
| 69 | +name = "ancestors" |
| 70 | +path = "data/ancestors.vcz" # output path for the ancestor store |
| 71 | +sources = ["1kgp_chr20"] # which source(s) to build from |
| 72 | + |
| 73 | +# Maximum gap (in base pairs) between adjacent inference sites before |
| 74 | +# splitting into separate intervals. Sites further apart than this are |
| 75 | +# processed independently, reducing memory for sparse regions. |
| 76 | +# Human chromosomes with uniform coverage: 500 kb works well. |
| 77 | +# For sparser data or non-contiguous targets, try a smaller value. |
| 78 | +max_gap_length = 500_000 # default: 500,000 |
| 79 | + |
| 80 | +# Genotype encoding for the C ancestor builder. |
| 81 | +# "eight_bit" — one byte per haplotype per site (default, broad compatibility) |
| 82 | +# "one_bit" — one bit per haplotype per site (~8x less memory, biallelic only) |
| 83 | +# Use one_bit for large cohorts (>10k samples) to reduce memory pressure. |
| 84 | +genotype_encoding = "eight_bit" |
| 85 | + |
| 86 | +# Zarr chunk sizes for the output ancestor store. Smaller chunks reduce |
| 87 | +# peak memory when the match step streams ancestors, but add I/O overhead. |
| 88 | +# samples_chunk_size = 1000 # default: 1000 (ancestor dimension) |
| 89 | +# variants_chunk_size = 1000 # default: 1000 (site dimension) |
| 90 | + |
| 91 | +# Zarr compression for the output ancestor store. Uses Blosc with bitshuffle. |
| 92 | +# compressor = "zstd" # default: "zstd" (blosc cname) |
| 93 | +# compression_level = 7 # default: 7 (0-9) |
| 94 | + |
| 95 | + |
| 96 | +# ============================================================================ |
| 97 | +# Match |
| 98 | +# ============================================================================ |
| 99 | +# Controls the HMM matching step: copies ancestors against the tree, then |
| 100 | +# copies sample haplotypes against the ancestor tree. |
| 101 | + |
| 102 | +[match] |
| 103 | +output = "data/output.trees" # output tree sequence path |
| 104 | + |
| 105 | +# Enable Viterbi path compression. Reduces memory and speeds up matching |
| 106 | +# at the cost of a slightly less optimal Viterbi path. Almost always |
| 107 | +# beneficial; disable only for debugging. |
| 108 | +# path_compression = true # default: true |
| 109 | + |
| 110 | +# Number of worker threads for the match step. |
| 111 | +# num_threads = 1 # default: 1 |
| 112 | + |
| 113 | +# Per-source match parameters. Each [match.sources.<name>] block configures |
| 114 | +# how nodes from that source are represented in the output tree sequence. |
| 115 | +# |
| 116 | +# node_flags: tskit node flags (default: 1 = NODE_IS_SAMPLE) |
| 117 | +# create_individuals: group nodes into tskit individuals (default: true) |
| 118 | + |
| 119 | +[match.sources.ancestors] |
| 120 | +node_flags = 0 |
| 121 | +create_individuals = false |
| 122 | + |
| 123 | +[match.sources.1kgp_chr20] |
| 124 | +# node_flags = 1 # default: 1 (NODE_IS_SAMPLE) |
| 125 | +# create_individuals = true # default: true |
| 126 | + |
| 127 | + |
| 128 | +# ============================================================================ |
| 129 | +# Post-processing |
| 130 | +# ============================================================================ |
| 131 | +# Optional cleanup applied after matching. |
| 132 | + |
| 133 | +[post_process] |
| 134 | +# Split the ultimate ancestor (virtual root) into per-tree roots. |
| 135 | +# split_ultimate = true # default: true |
| 136 | + |
| 137 | +# Erase flanking material outside each sample's first/last informative site. |
| 138 | +# erase_flanks = true # default: true |
| 139 | + |
| 140 | + |
| 141 | +# ============================================================================ |
| 142 | +# Individual metadata |
| 143 | +# ============================================================================ |
| 144 | +# Map VCZ sample-dimensioned arrays into tskit individual metadata. |
| 145 | +# "fields" maps tskit metadata keys to VCZ array names. |
| 146 | +# "population" names a VCZ array whose unique values become tskit populations. |
| 147 | + |
| 148 | +# [individual_metadata] |
| 149 | +# population = "sample_population" |
| 150 | +# [individual_metadata.fields] |
| 151 | +# name = "sample_id" |
| 152 | +# sex = "sample_sex" |
| 153 | +# population_name = "sample_population" |
0 commit comments