tskit is the tree sequence toolkit for storing, manipulating, and analyzing genealogical trees and genetic variation. Current version is 1.0.2. Originally developed in the TSKIT project, it has a slow release cadence with maintenance releases as needed. Requires Python >=3.11 since version 1.0.2.
pip install tskitVerified import paths — ran on the pinned version, not inferred.
Simulate a small tree sequence with msprime and compute basic statistics.
Replace ts.tables with ts.dump_tables() if you need to mutate.
Use population IDs (integers) or map names to IDs first.
Ensure mutation.parent column is valid (parent mutation must occur at an earlier position or same position and be an ancestor in the tree).
If you need non-sample nodes, pass include_non_sample_nodes=True to write_vcf().
Use tskit.load('file.trees')Check and correct mutation.parent column in tables. Ensure parent mutation appears earlier in the mutation table or is a valid ancestor.
Use integer IDs: population_id = ts.population('pop_name').id or set population=0.Ensure node table has the correct number of nodes and that edges reference existing nodes.
No dependency data recorded yet.