phytreeviz
Simple phylogenetic tree visualization python package for phylogenetic analysis
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.3%) to scientific vocabulary
Keywords
Repository
Simple phylogenetic tree visualization python package for phylogenetic analysis
Basic Info
- Host: GitHub
- Owner: moshi4
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://moshi4.github.io/phyTreeViz/
- Size: 2.34 MB
Statistics
- Stars: 48
- Watchers: 2
- Forks: 0
- Open Issues: 0
- Releases: 2
Topics
Metadata Files
README.md
phyTreeViz
Table of contents
Overview
phyTreeViz is a simple and minimal phylogenetic tree visualization python package implemented based on matplotlib. This package was developed to enhance phylogenetic tree visualization functionality of BioPython.
phyTreeViz is intended to provide a simple and easy-to-use phylogenetic tree visualization function without complexity. Therefore, if you need complex tree annotations, I recommend using ete or ggtree.
Installation
Python 3.8 or later is required for installation.
Install PyPI package:
pip install phytreeviz
Install conda-forge package:
conda install -c conda-forge phytreeviz
API Usage
Only simple example usage is described in this section. For more details, please see Getting Started and API Docs.
API Example
API Example 1
```python from phytreeviz import TreeViz, loadexampletree_file
treefile = loadexampletreefile("small_example.nwk")
tv = TreeViz(treefile) tv.showbranchlength(color="red") tv.showconfidence(color="blue") tv.showscalebar()
tv.savefig("api_example01.png", dpi=300) ```
API Example 2
```python from phytreeviz import TreeViz, loadexampletree_file
treefile = loadexampletreefile("small_example.nwk")
tv = TreeViz(treefile, height=0.7) tv.showscale_axis()
tv.setnodelabelprops("Homosapiens", color="grey") tv.setnodelabelprops("Pongoabelii", color="green", style="italic")
tv.setnodelineprops(["Hylobatesmoloch", "Nomascusleucogenys"], color="orange", lw=2) tv.setnodelineprops(["Homosapiens", "Pantroglodytes", "Pan_paniscus"], color="magenta", ls="dotted")
tv.savefig("api_example02.png", dpi=300) ```
API Example 3
```python from phytreeviz import TreeViz, loadexampletree_file
treefile = loadexampletreefile("small_example.nwk")
tv = TreeViz(treefile, alignleaflabel=True) tv.showscale_axis()
group1 = ["Hylobatesmoloch", "Nomascusleucogenys"] group2 = ["Homosapiens", "Panpaniscus"]
tv.highlight(group1, "orange") tv.highlight(group2, "lime")
tv.annotate(group1, "group1") tv.annotate(group2, "group2")
tv.marker(group1, marker="s", color="blue") tv.marker(group2, marker="D", color="purple", descendent=True) tv.marker("Pongo_abelii", color="red")
tv.savefig("api_example03.png", dpi=300) ```
API Example 4
```python from phytreeviz import TreeViz, loadexampletree_file from matplotlib.patches import Patch
treefile = loadexampletreefile("medium_example.nwk")
tv = TreeViz(treefile, height=0.3, alignleaflabel=True, leaflabelsize=10) tv.showscale_bar()
group1 = ["Hylobatesmoloch", "Nomascusleucogenys"] group2 = ["Homosapiens", "Pongoabelii"] group3 = ["Piliocolobustephrosceles", "Rhinopithecusbieti"] group4 = ["Chlorocebussabaeus", "Papioanubis"]
tv.highlight(group1, "orange", area="full") tv.highlight(group2, "skyblue", area="full") tv.highlight(group3, "lime", area="full") tv.highlight(group4, "pink", area="full")
tv.link(group3, group4, connectionstyle="arc3,rad=0.2")
fig = tv.plotfig()
_ = fig.legend( handles=[ Patch(label="group1", color="orange"), Patch(label="group2", color="skyblue"), Patch(label="group3", color="lime"), Patch(label="group4", color="pink"), ], frameon=False, bboxtoanchor=(0.3, 0.3), loc="center", ncols=2, )
fig.savefig("api_example04.png", dpi=300) ```
CLI Usage
phyTreeViz provides simple phylogenetic tree visualization CLI.
Basic Command
phytreeviz -i [Tree file or text] -o [Tree visualization file]
Options
General Options:
-i IN, --intree IN Input phylogenetic tree file or text
-o OUT, --outfile OUT Output phylogenetic tree plot file [*.png|*.jpg|*.svg|*.pdf]
--format Input phylogenetic tree format (Default: 'newick')
-v, --version Print version information
-h, --help Show this help message and exit
Figure Appearence Options:
--fig_height Figure height per leaf node of tree (Default: 0.5)
--fig_width Figure width (Default: 8.0)
--leaf_label_size Leaf label size (Default: 12)
--ignore_branch_length Ignore branch length for plotting tree (Default: OFF)
--align_leaf_label Align leaf label position (Default: OFF)
--show_branch_length Show branch length (Default: OFF)
--show_confidence Show confidence (Default: OFF)
--dpi Figure DPI (Default: 300)
Available Tree Format: ['newick', 'phyloxml', 'nexus', 'nexml', 'cdao']
CLI Example
Click here to download example tree files.
CLI Example 1
phytreeviz -i "((A,B),((C,D),(E,(F,G))));" -o cli_example01.png
CLI Example 2
phytreeviz -i ./example/small_example.nwk -o cli_example02.png \
--show_branch_length --show_confidence
CLI Example 3
phytreeviz -i ./example/medium_example.nwk -o cli_example03.png \
--fig_height 0.3 --align_leaf_label
Owner
- Name: moshi
- Login: moshi4
- Kind: user
- Repositories: 13
- Profile: https://github.com/moshi4
Web Developer / Bioinformatics / GIS
Citation (CITATION.cff)
cff-version: 1.2.0
message: If you use this software, please cite it as below.
authors:
- family-names: Shimoyama
given-names: Yuki
title: "phyTreeViz: Simple phylogenetic tree visualization python package"
date-released: 2023-09-08
url: https://github.com/moshi4/phyTreeViz
GitHub Events
Total
- Watch event: 12
- Fork event: 1
Last Year
- Watch event: 12
- Fork event: 1
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 5
- Total pull requests: 1
- Average time to close issues: 3 days
- Average time to close pull requests: less than a minute
- Total issue authors: 5
- Total pull request authors: 1
- Average comments per issue: 2.0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 3
- Pull requests: 0
- Average time to close issues: 1 day
- Average time to close pull requests: N/A
- Issue authors: 3
- Pull request authors: 0
- Average comments per issue: 0.67
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- tongzhouxu (1)
- b87401116 (1)
- mgalland (1)
- klcym (1)
- dongzhang0725 (1)
Pull Request Authors
- moshi4 (2)