# tsbrowse
Inspect large genetic genealogies (e.g. ARGs) stored in the [tskit](https://tskit.dev) "succinct tree sequence" format, via a web app.
_Tsbrowse_ can scale to ARGs with millions of samples.
It is particularly useful to help evaluate ARGs that have been inferred using tools such as
[tsinfer](https://github.com/tskit-dev/tsinfer),
[sc2ts](https://github.com/tskit-dev/sc2ts),
[Relate](https://github.com/MyersGroup/relate),
[KwARG](https://github.com/a-ignatieva/kwarg),
[Threads](https://pypi.org/project/threads-arg/), etc.
## Quickstart
First install `tsbrowse` from PyPI:
`python -m pip install tsbrowse`
A tskit tree sequence must first be preprocessed to a `.tsbrowse` file:
`python -m tsbrowse preprocess /path/to/trees-file`
This will write a `.tsbrowse` file that can then be viewed using the web app:
`python -m tsbrowse serve /path/to/tsbrowse-file`
This command will launch a web server that can be accessed at `http://localhost:8080` in a web browser.
To display the genes track use:
`python -m tsbrowse serve /path/to/tsbrowse-file --annotations-file genes.`
(where `genes.csv` is a semicolon-separated text file containing no header and information about one gene on a row in the order: `chr;start;end;strand;ensembl ID;gene name`)
An example tree sequence file can be found here: [example.trees](https://raw.githubusercontent.com/tskit-dev/tsbrowse/refs/heads/main/example/example.trees.tsz).
## Tips
If you are using Windows Subsystem for Linux (WSL) you may need to disable Numba's CUDA support:
`NUMBA_DISABLE_CUDA=1 python -m tsbrowse serve /path/to/tsbrowse-file`
A PNG of a specific page in tsbrowse can be generated using the `screenshot` command:
`python -m tsbrowse screenshot /path/to/tsbrowse-file mutations`
## Development
Test are run with pytest:
`python -m pytest`
To run the UI tests so you can see what the browser is doing use
`python -m pytest --headed --slowmo 1000 tests/test_ui.py`
`playwright codegen` is also useful for writing UI test code.
Raw data
{
"_id": null,
"home_page": "https://tskit.dev/tsbrowse/",
"name": "tsbrowse",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "tree sequence, ancestral recombination graph, tskit, quality control",
"author": "Tskit Developers",
"author_email": "Tskit Developers <admin@tskit.dev>",
"download_url": "https://files.pythonhosted.org/packages/3b/ab/d9da2823d595294d2729120c3642ee8109e95df84e578b289592ef5a65fd/tsbrowse-0.0.2.tar.gz",
"platform": "POSIX",
"description": "# tsbrowse\nInspect large genetic genealogies (e.g. ARGs) stored in the [tskit](https://tskit.dev) \"succinct tree sequence\" format, via a web app.\n_Tsbrowse_ can scale to ARGs with millions of samples.\n\nIt is particularly useful to help evaluate ARGs that have been inferred using tools such as\n[tsinfer](https://github.com/tskit-dev/tsinfer),\n[sc2ts](https://github.com/tskit-dev/sc2ts),\n[Relate](https://github.com/MyersGroup/relate),\n[KwARG](https://github.com/a-ignatieva/kwarg),\n[Threads](https://pypi.org/project/threads-arg/), etc.\n\n## Quickstart\n\nFirst install `tsbrowse` from PyPI:\n\n`python -m pip install tsbrowse`\n\nA tskit tree sequence must first be preprocessed to a `.tsbrowse` file:\n\n`python -m tsbrowse preprocess /path/to/trees-file`\n\nThis will write a `.tsbrowse` file that can then be viewed using the web app:\n\n`python -m tsbrowse serve /path/to/tsbrowse-file`\n\nThis command will launch a web server that can be accessed at `http://localhost:8080` in a web browser.\n\nTo display the genes track use:\n\n`python -m tsbrowse serve /path/to/tsbrowse-file --annotations-file genes.`\n\n(where `genes.csv` is a semicolon-separated text file containing no header and information about one gene on a row in the order: `chr;start;end;strand;ensembl ID;gene name`)\n\nAn example tree sequence file can be found here: [example.trees](https://raw.githubusercontent.com/tskit-dev/tsbrowse/refs/heads/main/example/example.trees.tsz).\n\n## Tips\n\nIf you are using Windows Subsystem for Linux (WSL) you may need to disable Numba's CUDA support:\n\n`NUMBA_DISABLE_CUDA=1 python -m tsbrowse serve /path/to/tsbrowse-file`\n\nA PNG of a specific page in tsbrowse can be generated using the `screenshot` command:\n\n`python -m tsbrowse screenshot /path/to/tsbrowse-file mutations`\n\n\n## Development\n\nTest are run with pytest:\n\n`python -m pytest`\n\nTo run the UI tests so you can see what the browser is doing use\n\n`python -m pytest --headed --slowmo 1000 tests/test_ui.py`\n\n`playwright codegen` is also useful for writing UI test code.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Webapp to view and visualise tskit ARGs",
"version": "0.0.2",
"project_urls": {
"Bug Tracker": "https://github.com/tskit-dev/tsbrowse/issues",
"Homepage": "https://tskit.dev/tsbrowse/",
"Source Code": "https://github.com/tskit-dev/tsbrowse"
},
"split_keywords": [
"tree sequence",
" ancestral recombination graph",
" tskit",
" quality control"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "86cc30c85a62be5d85aa82e9233fa647f6d3408274ba40a7ac4b8742114c5160",
"md5": "367e4be8fb2775636f009318507615e5",
"sha256": "66820c06fd7b04d765fc246ab1a2bb7c19e737a3b541973c1837f14da15e2eed"
},
"downloads": -1,
"filename": "tsbrowse-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "367e4be8fb2775636f009318507615e5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 23344,
"upload_time": "2024-12-09T11:38:18",
"upload_time_iso_8601": "2024-12-09T11:38:18.450934Z",
"url": "https://files.pythonhosted.org/packages/86/cc/30c85a62be5d85aa82e9233fa647f6d3408274ba40a7ac4b8742114c5160/tsbrowse-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3babd9da2823d595294d2729120c3642ee8109e95df84e578b289592ef5a65fd",
"md5": "9c464dd5814ff4c1935ce6d77dcca050",
"sha256": "111abb3ae1eccb8b4174a572a555a769b12317d849edab71bb93bc85ad1967f0"
},
"downloads": -1,
"filename": "tsbrowse-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "9c464dd5814ff4c1935ce6d77dcca050",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 394606,
"upload_time": "2024-12-09T11:38:22",
"upload_time_iso_8601": "2024-12-09T11:38:22.753889Z",
"url": "https://files.pythonhosted.org/packages/3b/ab/d9da2823d595294d2729120c3642ee8109e95df84e578b289592ef5a65fd/tsbrowse-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-09 11:38:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tskit-dev",
"github_project": "tsbrowse",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "build",
"specs": []
},
{
"name": "click",
"specs": []
},
{
"name": "coverage",
"specs": []
},
{
"name": "coveralls",
"specs": []
},
{
"name": "daiquiri",
"specs": []
},
{
"name": "datashader",
"specs": [
[
">=",
"0.16.3"
]
]
},
{
"name": "hvplot",
"specs": []
},
{
"name": "jupyter-book",
"specs": []
},
{
"name": "matplotlib",
"specs": []
},
{
"name": "msprime",
"specs": []
},
{
"name": "panel",
"specs": [
[
">=",
"1.5.2"
]
]
},
{
"name": "pre-commit",
"specs": []
},
{
"name": "pytest",
"specs": []
},
{
"name": "pytest-playwright",
"specs": []
},
{
"name": "selenium",
"specs": []
},
{
"name": "sphinx_issues",
"specs": []
},
{
"name": "tskit",
"specs": []
},
{
"name": "tszip",
"specs": []
}
],
"lcname": "tsbrowse"
}