Does anyone know how to extract a subtree from a big phylogeny?
Also, is it possible to keep the branch length information when doing extraction?
Many thanks in advance.
This is the same as Where Can I Download The Phylogeny Information For Flowering Plants you just asked. Please use the same question header.
You could use the python package ETE for this. They have an example for taking a phylogentic tree, and pruning parts of it off here: http://packages.python.org/ete2/tutorial/tutorial_trees.html#pruning-trees. I think the input is a newick style tree, and I am pretty sure ETE will not change the branch lengths that you put on your tree when you prune parts of it away.
ETE (v2.1) will delete branches when pruning. Only branch lengths of the kept nodes will be maintained (never changed). The currently development version of ETE, includes a new option to preserve branch length information by summing up the lengths of all deleted nodes. This is: distances between nodes will be the same in the original and the pruned tree, which means that some of the remaining branches will be changed to account for the cumulative length that has been removed.
See prune method here: https://github.com/jhcepas/ete/blob/master/ete_dev/coretype/tree.py
sounds this is the functionality i need.
Thanks a lot.
Many thanks for your suggestion John.
By the way, if i want to sample species across clades. Do you think ETE would automatically adjust branch lengths?
I will explore ETE in more detail.
If you want a visual way of pruning a subtree, I would recommend Archaeopteryx, it is easy to cut and paste subtrees and prune subtrees, even large trees. I am pretty sure it preserves the branch lengths.
Use the TreeTools package in R.
tree <- BalancedTree(8)
tip <- c('t1','t5','t7','t8')
subtree <- KeepTip(tree, tip, preorder = TRUE)
Login before adding your answer.
Use of this site constitutes acceptance of our User Agreement and Privacy