Description Usage Arguments Details Value Author(s) Examples
View source: R/build.nodes.2.R
This function extracts the genus- and family-level nodes information in a phylogeny.
1 | build.nodes.2(tree, tips)
|
tree |
The phylogeny. |
tips |
The tips information, including all the species (i.e., tip labels) in the phylogeny, as well as their genus and family assignments. This file should include three columns named as "species", "genus" and "family". |
Extracts the genus- and family-level basal and root node labels, node ages, etc., in a phylogeny, to be used in functions such as 'phylo.maker' and 'bind.relative'. Specifically, the basal node of a clade is defined as the most recent common ancestor(MRCA) of the two most distantly related tips of that clade in the phylogeny, regardless if the clade is distributed in one(i.e. monophyletic) or more(i.e. polyphyletic) clusters. When the basal node is determined, the node rightly above it is defined as the root node. In the extreme case when one clade owns only one tip in the phylogeny, the basal node is the same as the root node, which is the node the tip driectly roots from.
The data frame of nodes information, including 10 columns.
level |
The level of the clade, be either F or G. F = family, G = genus. |
family |
The family name. |
genus |
The genus name. |
rn |
The root node label. |
rn.bl |
The root node age. |
bn |
The basal node label. |
bn.bl |
The basal node age. |
gen.n |
The number of genera that the clade includes. |
sp.n |
The number of species that the clade includes. |
taxa |
The species name, in case the clade includes only one species. |
Yi Jin
1 2 3 4 5 6 7 8 9 10 11 12 | # make the tree and its tips information
phylogeny <- rcoal(10) # generate a phylogeny with 10 tips
phylogeny$node.label <- paste("N",1:phylogeny$Nnode,sep="") # label the nodes
phylogeny$tip.label <- paste(rep(rep(c("Genus1","Genus2"),2),4:1), phylogeny$tip.label, sep="_") # rename the tips
tips <- data.frame(species = phylogeny$tip.label,genus=rep(rep(c("Genus1","Genus2"),2),4:1),family=rep(rep(c("Family1","Family2"),2),4:1)) # generate the tips information
# plot the tree
plot(phylogeny, show.node.label=TRUE, tip.color=rep(rep(c("black","red"),2),4:1),edge.width=1) # plot the phylogeny
# generate the nodes information of the tree
nodes.inf<-build.nodes.2(phylogeny, tips) # build the nodes information file for the phylogeny
nodes.inf # show the nodes.infomation file
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.