Hello,
I have a question regarding trimming a phylogenetic tree. In particular, I would like to delete a list of terminal nodes from the tree, but still preserve the internal nodes of their last common ancestor. For example, if I have a tree like this:
---------1
|
---3
| |
| ---------2
--|
|
| ---------5
| |
---4
|
---------6
(sorry that the tree is poorly drawn, but in this tree, 3 is the LCA of 1 and 2, and 4 is the LCA of 5 and 6)
I would like to trim both 1 and 2, but to preserve 3, in which case the tree will to become:
----3
|
|
--|
|
| ---------5
| |
---4
|
---------6
I know there is a function in bio:treeio called remove_Nodes, however it would remove both terminal nodes and internal nodes (in this case, all the nodes 1, 2 and 3 will be removed) from the tree, which is not what I want.
I wonder if anyone knows how to do this. Thanks!
Zhang
I have a question regarding trimming a phylogenetic tree. In particular, I would like to delete a list of terminal nodes from the tree, but still preserve the internal nodes of their last common ancestor. For example, if I have a tree like this:
---------1
|
---3
| |
| ---------2
--|
|
| ---------5
| |
---4
|
---------6
(sorry that the tree is poorly drawn, but in this tree, 3 is the LCA of 1 and 2, and 4 is the LCA of 5 and 6)
I would like to trim both 1 and 2, but to preserve 3, in which case the tree will to become:
----3
|
|
--|
|
| ---------5
| |
---4
|
---------6
I know there is a function in bio:treeio called remove_Nodes, however it would remove both terminal nodes and internal nodes (in this case, all the nodes 1, 2 and 3 will be removed) from the tree, which is not what I want.
I wonder if anyone knows how to do this. Thanks!
Zhang
Comment