Add Tips to a Phylogeny

Share:

Description

This function adds tips (terminal nodes) to a (currently ultrametric) phylogenetic tree.

Usage

1
addTip(phy, tip, tax, insert = "crown", stem.edge = 0.5)

Arguments

phy

an object of class phylo; must be ultrametric.

tip

a character string giving the name of the species to be added.

tax

a data frame containing a taxonomy.

insert

a character string indicating the positions where the species is to be inserted: "crown", "stem", "randomly", or any unambigous abbreviation of these. This option will only have an effect if phy contains more than one congeneric of tip.

stem.edge

a real number greater than 0 and smaller than 1, which gives the fraction of the terminal branch length that will be assigned to the branch subtending the newly created MRCA of tip and its single congeneric species in phy. Will have no effect if phy contains more than one congeneric of tip.

Details

tip will be added at the crown group level of the genus. This means there must be a monophyletic generic clade in the phylogeny that matches the genus name of tip

Value

an object of class phylo containing at least one multichotomous node.

Author(s)

Christoph Heibl

See Also

prune.phylo.rank for pruning phylogenies to a particular taxonomic level.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## random ultrametric tree
## -----------------------
#set.seed(12)
#phy <- rcoal(20, tip.label = paste("whale", LETTERS[1:20]))
#phy$tip.label[6:9] <- gsub("whale", "humpback", phy$tip.label[6:9])
#phy$tip.label[12] <- gsub("whale", "humpback", phy$tip.label[12])
#phy <- fixNodes(ladderize(phy))
#plot(phy, no.margin = TRUE); nodelabels(cex = .5)

## default use adding four species
## -------------------------------
#spec <- c("Athelia V",
#          paste("Cladonia", c("X", "Y", "Z")))
#phy.crown <- phy
#for (i in seq_along(spec)) 
 # phy.crown <- addTip(phy.crown, spec[i])
#plot(phy.crown, no.margin = TRUE); nodelabels(cex = .5)

## random addition of tips to their genus
## ---------------------------------------
#spec <- paste("Cladonia", c("X", "Y", "Z"))
#phy.random <- phy
#for (i in seq_along(spec)) 
#  phy.random <- addTip(phy.random, spec[i], insert = "randomly")
#plot(phy.random, no.margin = TRUE); nodelabels(cex = .5)