Generate a standalone HTML file with an interactive phylogenetic tree using PhyloCanvas
Project description
Standalone HTML Interactive Phylogenetic Tree Viz
Generate a standalone HTML file with an interactive phylogenetic tree using PhyloCanvas
- Free software: Apache Software License 2.0
- Documentation: https://shiptv.readthedocs.io.
See test shiptv HTML output here:
Phylogenetic tree of 5 FMDV genomes
Phylogenetic tree of IAV HA gene sequences
Features
- Interactively view your tree in the browser with metadata highlighted beside your tree using PhyloCanvas.
- Visualize your own metadata! Provide a tab-delimited table as input with --metadata your-metadata-table.tsv
- Select metadata fields to display beside phylogenetic tree with select box
- Automatically retrieve metadata from a GenBank file!
- Highlight branches with low support in the browser.
- Collapse branches with low support (e.g. -C 95 for IQ-TREE trees with UFBoot -bb 1000 to collapse branches with less than 95% support).
- Toggle full window mode with shift+ctrl+f. Works well with F11 fullscreen mode.
Usage
Show help info:
$ shiptv --help
Install shiptv completions for current shell:
$ shiptv --install-completion
Most basic usage would be to create a tree from a Newick format tree file:
$ shiptv -n newick.treefile -o shiptv-tree.html
More advanced usage would be to provide a tab-delimited table of metadata with the first field containing sample names identical to those in the Newick tree file:
$ shiptv -n newick.treefile --metadata my-metadata.tsv -o shiptv-tree.html
With a reference sequence Genbank file ref.gb, a Newick format phylogenetic tree tree.nwk, output a tree.html standalone HTML interactive phylogenetic tree visualization and a metadata-table.tsv tab-delimited table of metadata from ref.gb.
shiptv -r ref.gb -n tree.nwk -o tree.html -m metadata-table.tsv
Help output
$ shiptv --help Usage: shiptv [OPTIONS] Create HTML tree visualization with metadata. The metadata for reference genomes can be extracted from the specified Genbank file. Any leaf names that are present in the tree but not present in the Genbank file are assumed to be user samples and are flagged as such in the metadata table as "user_sample"="Yes". Options: -n, --newick PATH Phylogenetic tree Newick file [required] -o, --output-html PATH Output HTML tree path [required] -N, --output-newick PATH Output Newick file -r, --ref-genomes-genbank PATH Reference genome sequences Genbank file -m, --output-metadata-table PATH Output metadata table path --leaflist PATH Optional leaf names to select from phylogenetic tree for pruned tree visualization. One leaf name per line. --genbank-metadata-fields PATH Optional fields to extract from Genbank source metadata. One field per line. -M, --metadata PATH Optional tab-delimited metadata for user samples to join with metadata derived from reference genome sequences Genbank file. Sample IDs must be in the first column. --metadata-fields-in-order PATH Optional list of fields in order to output in metadata table and HTML tree visualization. One field per line. --fix-metadata / --no-fix-metadata Try to automatically fix metadata from reference Genbank file. [default: True] -C, --collapse-support FLOAT Collapse internal branches below specified bootstrap support value (default -1 for no collapsing) [default: -1.0] --highlight-user-samples / --no-highlight-user-samples Highlight user samples with metadata field in tree. [default: False] --outgroup TEXT Tree outgroup taxa --midpoint-root / --no-midpoint-root Set midpoint root [default: False] --verbose / --no-verbose Verbose logs [default: False] --install-completion Install completion for the current shell. --show-completion Show completion for the current shell, to copy it or customize the installation. --help Show this message and exit.
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.4.1 (2021-05-13)
- ensure tree rendered even if genomeMetadata object is empty in phylocanvas.html
- add --version option to print shiptv version and exit
- add epilog to help with version info
- add example usage to help
- change --metadata short opt to -m from -M
- change --output-metadata-table short opt from -m to -M
- update lodash JS library to version 4.17.15
0.4.0 (2021-02-12)
- Add Select2 metadata field select box to show metadata fields in the order required
- Add Shift+Ctrl+F to toggle tree viz full window mode
- Using BioPython’s Phylo module for phylogenetic tree manipulation. Removed ete3.
- Using Requests library to get JS and CSS to embed into HTML output
- Migrated to Typer from Click for CLI
- Added Rich for nicer logging and tracebacks
- Changed some options to be optional; only required options are -n/--newick and -o/--output-html
- By default don’t highlight user samples as a field of metadata in tree viz
- Allow user to optionally specify outgroup taxa name
- Allow user to optionally re-root tree at midpoint node
- Fixed warnings from Pandas when modifying view of dataframe by using .loc[]
- Moved to GitHub Actions CI and PyPI deployment
0.3.0 (2019-10-02)
- Fix rendering of numeric and ISO date metadata fields
- Reference genomes Genbank now optional
- Updated docs
0.2.0 (2019-06-28)
- Added low support branch highlighting in tree HTML file
- Added option to collapse low support branches (-C/–collapse-support)
- Added option to output modified Newick tree file (-N/–output-newick)
- Fixed date/time parsing from Genbank files (#1)
0.1.0 (2019-05-10)
- First release on PyPI.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for shiptv-0.4.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43b4e59b50dd2ccdd64566a05b468c6efd2ace9fa8d65fca79ed0337edfb82c3 |
|
MD5 | ab5602d66ee529ecab2f0373c7de286f |
|
BLAKE2-256 | cb23fda2734d1f3ca6cdb38841b2fb4e58f33c6ace37f931c3ae2c6d7fa5e8fd |