[![Coverage Status](https://coveralls.io/repos/github/YapengLang/cogent3-ete3/badge.svg?branch=main)](https://coveralls.io/github/YapengLang/cogent3-ete3?branch=main)
# A plugin for converting a [cogent3](https://cogent3.org/) tree to [ete3](http://etetoolkit.org/) tree object
Developed an app that takes a cogent3 `PhyloNode` then returns an ete3 `PhyloTree`, plus an app for edge colouring.
## cogent3 to ete3 tree
```
from cogent3 import load_tree, get_app
from cogent3_ete3.style import show_legend
tree = load_tree("data/tree_large_scale.newick")
conv = get_app("cogent3_to_ete3")
t = conv(tree)
```
`t` is an ete3 `PhyloTree`.
## colour edges by a mapping
The `ete3_colour_edge` app allows you to colour information on selected edges. The app applies a colour to named edges. This means for colouring internal edges the node must have names.
```
edge_to_cat = {"Vombatidae_Vombatus_ursinus": "A",
"Dasyuridae_Sarcophilus_harrisii": "B",
"Peramelidae_Echymipera_kalubu" : "C",
"Pseudochiridae_Pseudochirulus_forbesi": "D"}
cat_to_colour={"A":"blue",
"B":"blue",
"C":"red",
"D":"orange"}
cl = get_app("ete3_colour_edge", edge_to_cat=edge_to_cat, cat_to_colour=cat_to_colour)
t = cl(t)
```
You can use the convenient function to show a legend.
```
show_legend(t, cat_to_colour, legend_title="Your Category")
```
In the pop-up window, you can explore further and render the tree in a file as you progress:
![Tree Plot](data/coloured_tree.png)
Raw data
{
"_id": null,
"home_page": null,
"name": "cogent3-ete3",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "biology, genomics, statistics, phylogeny, evolution, bioinformatics",
"author": null,
"author_email": "Yapeng Lang <u7181074@anu.edu.au>",
"download_url": "https://files.pythonhosted.org/packages/54/fa/c8e173251ef60df15595e5d15579bc613d4fbb2d3c1422a4aae444d7cb0f/cogent3_ete3-2024.8.22a6.tar.gz",
"platform": null,
"description": "[![Coverage Status](https://coveralls.io/repos/github/YapengLang/cogent3-ete3/badge.svg?branch=main)](https://coveralls.io/github/YapengLang/cogent3-ete3?branch=main)\n\n# A plugin for converting a [cogent3](https://cogent3.org/) tree to [ete3](http://etetoolkit.org/) tree object \n\nDeveloped an app that takes a cogent3 `PhyloNode` then returns an ete3 `PhyloTree`, plus an app for edge colouring.\n\n## cogent3 to ete3 tree\n```\nfrom cogent3 import load_tree, get_app\nfrom cogent3_ete3.style import show_legend\n\ntree = load_tree(\"data/tree_large_scale.newick\")\n\nconv = get_app(\"cogent3_to_ete3\")\nt = conv(tree)\n```\n`t` is an ete3 `PhyloTree`.\n\n## colour edges by a mapping\nThe `ete3_colour_edge` app allows you to colour information on selected edges. The app applies a colour to named edges. This means for colouring internal edges the node must have names.\n\n```\nedge_to_cat = {\"Vombatidae_Vombatus_ursinus\": \"A\",\n \"Dasyuridae_Sarcophilus_harrisii\": \"B\",\n \"Peramelidae_Echymipera_kalubu\" : \"C\",\n \"Pseudochiridae_Pseudochirulus_forbesi\": \"D\"}\n\ncat_to_colour={\"A\":\"blue\", \n \"B\":\"blue\", \n \"C\":\"red\", \n \"D\":\"orange\"}\n\ncl = get_app(\"ete3_colour_edge\", edge_to_cat=edge_to_cat, cat_to_colour=cat_to_colour)\nt = cl(t)\n```\n\nYou can use the convenient function to show a legend.\n\n```\nshow_legend(t, cat_to_colour, legend_title=\"Your Category\")\n```\n\nIn the pop-up window, you can explore further and render the tree in a file as you progress:\n\n![Tree Plot](data/coloured_tree.png)\n\n",
"bugtrack_url": null,
"license": null,
"summary": "cogent3 plugin for ete3",
"version": "2024.8.22a6",
"project_urls": {
"Bug Tracker": "https://github.com/YapengLang/cogent3-ete3/issues",
"Source Code": "https://github.com/YapengLang/cogent3-ete3"
},
"split_keywords": [
"biology",
" genomics",
" statistics",
" phylogeny",
" evolution",
" bioinformatics"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "951923e28836d814c2db8329435a983f8a0be1c6eb98163e4a18ad35a47ebaac",
"md5": "47278fdec4440e679120994a5b81ee14",
"sha256": "077498ada241d88d8a62a94378bb0d97eaeb6a321dc051db7dbe8b5c2a74e7f9"
},
"downloads": -1,
"filename": "cogent3_ete3-2024.8.22a6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "47278fdec4440e679120994a5b81ee14",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 5398,
"upload_time": "2024-09-17T06:36:16",
"upload_time_iso_8601": "2024-09-17T06:36:16.155174Z",
"url": "https://files.pythonhosted.org/packages/95/19/23e28836d814c2db8329435a983f8a0be1c6eb98163e4a18ad35a47ebaac/cogent3_ete3-2024.8.22a6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "54fac8e173251ef60df15595e5d15579bc613d4fbb2d3c1422a4aae444d7cb0f",
"md5": "2a346048711d43b1e89d8d009e2d844a",
"sha256": "a34f9605106b6d7cb9666fa01271a1f1d856dae4f1792f6e9e07f9d48f4a3674"
},
"downloads": -1,
"filename": "cogent3_ete3-2024.8.22a6.tar.gz",
"has_sig": false,
"md5_digest": "2a346048711d43b1e89d8d009e2d844a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 4601,
"upload_time": "2024-09-17T06:36:17",
"upload_time_iso_8601": "2024-09-17T06:36:17.629712Z",
"url": "https://files.pythonhosted.org/packages/54/fa/c8e173251ef60df15595e5d15579bc613d4fbb2d3c1422a4aae444d7cb0f/cogent3_ete3-2024.8.22a6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-17 06:36:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "YapengLang",
"github_project": "cogent3-ete3",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "cogent3-ete3"
}