node.trans: Translate Internal Node Indices between Trees

Description Usage Arguments Details Author(s) See Also Examples

Description

This function compares and translates internal node indices for two objects of class phylo.

Usage

1
node.trans(source, target, index = FALSE)

Arguments

source

An object of class phylo.

target

An object of class phylo.

index

Logical (see description).

Details

node.trans requires identical sets of tips in both trees. It can handle unresolved trees, but will sometimes fail if the target tree has more internal nodes, i.e., is better resolved, than the source tree.

If used with index = TRUE, node.trans behaves like the match function, returning a vector of indices with can be used to order node labels of the source tree to fit with the node order of the target tree. Alternatively, index = FALSE returns a matrix with corresponding node indices in both trees.

Author(s)

Christoph Heibl

See Also

match, fixNodes, node.support.

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
	
# phylogenetic trees of Vipera
# ----------------------------
data(vipera)

# set graphic parameters
# ----------------------
opar <- par(no.readonly = TRUE)
par(mar = c(0, 0, 0, 0), mfrow = c(2,1))

# show 'ursinii-clade' and posterior
# probabilites on Bayesian tree
# ----------------------------------
ursiniiClade <- list(c("Vipera_kaznakovi", "Vipera_ursinii", "Vipera_dinniki"))
tcol <- tip.color(vipera.bayes, ursiniiClade, col = "red")
plot(vipera.bayes, tip.color = tcol)
node.support(vipera.bayes$node.label, col = "blue")

# show 'ursinii-clade' and bootstrap
# values on ML tree
# ----------------------------------
tcol <- tip.color(vipera.ml, ursiniiClade, col = "red")
plot(vipera.ml, tip.color = tcol)
node.support(vipera.ml$node.label, pos = "above")

# show posterior probabilites on ML tree
# with help of 'node.trans'
# --------------------------------------
id <- node.trans(vipera.bayes, vipera.ml, index = TRUE)
node.support(vipera.bayes$node.label[id], pos = "below", col = "blue")

# there is a short cut in node.support
# ------------------------------------
plot(vipera.ml, tip.color = tcol)
node.support(vipera.ml$node.label, pos = "above")
node.support(vipera.bayes$node.label, pos = "below",
    transfer = list(vipera.bayes, vipera.ml))
    
# reset graphic parameters
# ------------------------
par(opar)

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