noi: Identification of MRCAs for Taxon Sets

Description Usage Arguments Value Author(s) See Also Examples

Description

This function identifies the most recent common ancestor (MRCA) nodes for one or more sets of taxa/tips.

Usage

1
noi(phy, group, regex = FALSE)

Arguments

phy

an object of class phylo.

group

a vector or list of vectors of mode character specifying the taxon set(s).

regex

a logical, if regex = TRUE, taxon sets are matched to the tip labels as regular expressions of the form "taxon1|taxon2"; otherwise strings will be matched exactly (see which).

Value

A vector of mode "numeric".

Author(s)

Christoph Heibl

See Also

mrca; edge.color and tip.color to create color vectors for tree plotting, descendants for the contrary operation to noi.

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# molecular phylogeny of Eurasian vipers:
# ---------------------------------------
data(viperidae)	

# group can be either of mode 'numeric' or 'character'
# ----------------------------------------------------
numtax <- c(19, 31)
chartax <- c("Vipera_berus", "Vipera_wagneri")
node1 <- noi(viperidae, numtax)
node2 <- noi(viperidae, chartax)

# show results
# --------------------
tcol <- tip.color(viperidae, chartax, col = "blue")
tcol[numtax] <- "red"
plot(viperidae, tip.color = tcol)
nodelabels("MRCA1", node = node1, col = "red", cex = 0.8)
nodelabels("MRCA2", node = node2, col = "blue", cex = 0.8)

# the 'group' argument can also take regular expressions
# ------------------------------------------------------
rex <- "aspis"
node <- noi(viperidae, rex, regex = TRUE)
plot.phylo(viperidae, tip.color = 0, edge.color = 0)
box.clades(viperidae, nodes = node, col = "#D2A6A7", align = "all")
plot.phylo.upon(viperidae)
nodelabels(node = node, pch = 21, cex = 1.2, col = "red", bg = "#D2A6A7")

# if the 'group' argument is a list of elements of length 2,
# n = length(group) nodes of interest will be returned
# ----------------------------------------------------
group <- list(
    c("Vipera_berus", "Vipera_ursinii"),
    c("Vipera_aspis_ssp._aspis", "Vipera_latastei"),
    c("Vipera_ammodytes_ssp._ammodytes", 
        "Vipera_ammodytes_ssp._montandoni"),
    c("Macrovipera_lebetina", "Vipera_wagneri")
)
clades <- noi(viperidae, group)
plot.phylo(viperidae, tip.color = 0, edge.color = 0)
box.clades(viperidae, nodes = clades, col = c("#FFFFA5", "#D2A6A7",
    "#A7D2A5", "#A5A6D2"), align = "all")
plot.phylo.upon(viperidae)

fmichonneau/phyloch documentation built on May 16, 2019, 1:45 p.m.