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

getSubtree? #186

Closed
matiasirazoqui opened this issue Jul 16, 2018 · 1 comment
Closed

getSubtree? #186

matiasirazoqui opened this issue Jul 16, 2018 · 1 comment

Comments

@matiasirazoqui
Copy link

Hi,
I'm using ggtree to plot a very big tree (>10.000 leaves) and I wanted to extract all tips that originate from a particular node. My first thought was to extract a subtree and use the "tip.label" variable. Going through the documentation I found a function called "getSubtree", which seems to be exactly what I need, but I couldn't find it in ggtree 1.12.4 nor 1.13.1. Is there any other way to do what I want? Thanks!

@tbradley1013
Copy link

tbradley1013 commented Jul 16, 2018

You can use the tree_subset function which is in the development version of treeio and can be installed by running:

devtools::install_github("GuangchuangYu/treeio")

This function works very similar to what you are describing. You can subset the tree by specifying the desired node and how many levels back in the tree (from the specified node) that you wish to include. It works for both phylo and treedata classes.

I recently wrote a blog post about it and created a shiny app around its functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants