build.nodes.1: Extract the genus- and family-level nodes information in a...

Description Usage Arguments Details Value Author(s) Examples

View source: R/build.nodes.1.R

Description

This function extracts the genus- and family-level nodes information in a phylogeny.

Usage

1
build.nodes.1(tree, tips)

Arguments

tree

The phylogeny.

tips

The tips information, includes 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".

Details

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 two most distantly related tips of that clade in the phylogeny, and the root node is the node rightly above the basal 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. If a clade is distributed in more than one clusters(i.e. polyphyletic), this function extracts the nodes information of the largest cluster to represent the clade.

Value

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.

Author(s)

Yi Jin

Examples

 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.1(phylogeny, tips)   # build the nodes information file for the phylogeny
nodes.inf   # show the nodes.infomation file

jinyizju/V.PhyloMaker documentation built on July 12, 2021, 12:15 a.m.