subs.tree | R Documentation |
The goal of this function is to enhance manipualtion between trees, especially for constructing composite trees, by allowing one to substitute a taxon (tip or subtree) of a tree by another tree.
subs.tree(back.tree,fore.tree,where,drop.where=TRUE,poly.where=FALSE,stem.edge.length=NULL,node.age=NULL)
back.tree |
The tree on which a taxon is substituted by another tree, named "background" tree because it is the general support/scaffold/backbone. |
fore.tree |
The tree to put in the "background" tree, named "foreground" tree because it is the one to put on the other tree. |
where |
The taxon of |
drop.where |
Optional. The user can discard the given taxon where to put the |
poly.where |
Optional. The user can chose whether the |
stem.edge.length |
Optional. The length of the edge leading to the |
node.age |
Optional. The age of the 'root' node of the |
This function replaces a taxon of a given "background" tree, be it a single tip or a node (i.e., part of the tree), by another "foreground" tree. The age of the node of the "foreground" tree is not necessarily the same than the age of the taxon to replace in the "background" tree; there are therefore options allowing for specifying its age.
A tree of class phylo
with both the back.tree
and the fore.tree
merged together.
require(ape)
back.tree<-read.tree(text="((((A:1,B:2):0.5,(C:3,(D:4,E:1):2):5):1,(F:3,(G:2.5,(H:2.5,(I:1.5,J:1):1):1):2):1):4,K:10);")
plot(back.tree)
nodelabels()
fore.tree<-read.tree(text="((x:0.5,y:1.5):5,z:11);")
plot(fore.tree)
where<-c("C","E")
plot(subs.tree(back.tree,fore.tree,where,node.age=8))
plot(subs.tree(back.tree,fore.tree,where,stem.edge.length=0.1))
plot(subs.tree(back.tree,fore.tree,where))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.