Skip to content

Commit

Permalink
Update readme and add example.trees
Browse files Browse the repository at this point in the history
  • Loading branch information
benjeffery committed Nov 27, 2024
1 parent 9a1eee9 commit 6595d14
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
# tsbrowse
Inspect large genetic genealogies (e.g. ARGs) stored in the [tskit](https://tskit.dev) "succinct tree sequence" format,
via a genome browser style app. _Tsbrowse_ can deal with ARGs of thousands or potentially millions of samples.
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.

To view a tskit tree sequence or tszip file first pre-process it:
## Quickstart

`python -m tsbrowse preprocess /path/to/trees-file`
First install `tsbrowse` from PyPI:

`python -m pip install tsbrowse`

A tskit tree sequence must first be preprocessed to a `.tsbrowse` file:

This will write a `.tsbrowse` file
`python -m tsbrowse preprocess /path/to/trees-file`

To launch the app use:
This will write a `.tsbrowse` file that can then be viewed using the web app:

`python -m tsbrowse serve /path/to/tsbrowse-file`

Or to generate a PNG of a specific page use, e.g:
This command will launch a web server that can be accessed at `http://localhost:8080` in a web browser.

`python -m tsbrowse screenshot /path/to/tsbrowse-file mutations`
An example tree sequence file can be found here: [example.trees](https://raw.githubusercontent.com/tskit-dev/tsbrowse/refs/heads/main/example/example.trees).

On WSL, it may be necessary to disable Numba's CUDA support:
## 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`

## Installation
A PNG of a specific page in tsbrowse can be generated using the `screenshot` command:

tsbrowse is currently in development. To install the latest dev version from github, try
`python -m tsbrowse screenshot /path/to/tsbrowse-file mutations`

```
python -m pip install git+https://github.com/tskit-dev/tsbrowse
```

## Development

Expand Down
Binary file added example/example.trees
Binary file not shown.
5 changes: 4 additions & 1 deletion tsbrowse/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ def preprocess(tszip_path, output, verbose):

preprocess_.preprocess(tszip_path, output, show_progress=True)
logger.info(f"Preprocessing completed. Output saved to: {output}")
print(f"Preprocessing completed. You can now view with `tsbrowse serve {output}`")
print(
"Preprocessing completed. You can now view with "
f"`python -m tsbrowse serve {output}`"
)


@cli.command()
Expand Down

0 comments on commit 6595d14

Please sign in to comment.