Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readme and add example.trees #236

Merged
merged 1 commit into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,48 @@
# 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`

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`)

To generate a PNG of a specific page use, e.g:
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).

`python -m tsbrowse screenshot /path/to/tsbrowse-file mutations`
## Tips

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