https://github.com/tskit-dev/tszip
Gzip-like compression for tskit tree sequences
https://github.com/tskit-dev/tszip
compression tree-sequence tskit
Last synced: about 2 months ago
JSON representation
Gzip-like compression for tskit tree sequences
- Host: GitHub
- URL: https://github.com/tskit-dev/tszip
- Owner: tskit-dev
- License: mit
- Created: 2019-04-30T14:09:17.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2026-03-02T13:05:29.000Z (about 2 months ago)
- Last Synced: 2026-03-02T13:19:05.261Z (about 2 months ago)
- Topics: compression, tree-sequence, tskit
- Language: Python
- Homepage: https://tskit.dev/tszip/docs/
- Size: 435 KB
- Stars: 5
- Watchers: 4
- Forks: 7
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.rst
- License: LICENSE
Awesome Lists containing this project
README
# tszip
[](https://github.com/tskit-dev/tszip/blob/main/LICENSE) [](https://pypi.org/project/tszip/) [](https://pypi.org/project/tszip/) [](https://github.com/tskit-dev/tszip/actions/workflows/docs.yml) [](https://github.com/tskit-dev/tszip/actions/workflows/wheels.yml) [](https://github.com/tskit-dev/tszip/actions/workflows/tests.yml) [](https://codecov.io/gh/tskit-dev/tszip)
Gzip-like compression for [tskit](https://tskit.dev/software/tskit.html) tree sequences. Compression is lossless for supported tskit tree sequences.
Please see the [documentation](https://tskit.dev/tszip/docs/stable/) ([latest](https://tskit.dev/tszip/docs/latest/)) for more details
and [installation instructions](https://tskit.dev/tszip/docs/stable/installation.html).
## Installation
Install from PyPI or conda-forge:
```
python -m pip install tszip
# or
conda install -c conda-forge tszip
```
## Quickstart
CLI usage:
```bash
# Compress a .trees file to a .tsz archive
tszip data.trees
# Decompress back to .trees
tsunzip data.trees.tsz
```
Along with the CLI, tszip can be used directly from Python:
```python
import tskit
import tszip
ts = tskit.load("data.trees")
tszip.compress(ts, "data.trees.tsz") # write compressed archive
# load handles .tsz archives and plain .trees files
restored = tszip.load("data.trees.tsz")
print(restored.equals(ts)) # True
```