fixNodes: Standard Node Numbering in Phylo Objects

Description Usage Arguments Details Value Author(s) See Also Examples

Description

The function (re-)establishes the standard numbering of terminal and internal nodes in phylogenies represented as objects of class phylo.

Usage

1
fixNodes(phy, quiet = TRUE)

Arguments

phy

an object of class phylo.

quiet

logical: if TRUE (default), screen output is suppressed. Intended for possible debugging, may be removed later.

Details

When reading in phylogenetic trees from a NEXUS file that contains a translate section, it can happen that the terminal nodes (tips, leaves) of the corresponding phylo object are not numbered consecutively, which can be a problem in some downstream applications. You can use fixNodes to get the correct order of terminal node numbers.

fixNodes is also intended to re-establish the standard numbering of internal nodes and reorder all node value elements (e.g. node.label, posterior, ...) if a phylo object has been modified by either root, ladderize, or rotate.

Value

an object of class phylo.

Author(s)

Christoph Heibl

See Also

read.tree, read.nexus, read.beast for reading trees; ladderize and rotate for tree manipulation; node.support for plotting node support values; node.trans for handling non-standard node elements in class phylo.

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
44
45
46
47
48
49
# phylogenetic tree of wild barley
# -------------------------------- 
data(hordeum)
hordeum$tip.label <- LETTERS[1:20]
hordeum $edge.length <- NULL

# split plotting device
# ---------------------
pp <- par(c("mfcol", "mar"))
par(mfcol = c(1, 2), mar = c(0.5, 0.5, 0.5, 0.5))

## EXAMPLE 1:

# rerooting of tree changes numbering of 
# terminal nodes
# --------------------------------------
rerooted.tr <- root(hordeum, outgroup = c("L"), 
	resolve.root = TRUE)	
plot(rerooted.tr, label.offset = strwidth("--"))
nodelabels(cex = 0.7)
tiplabels(cex = 0.7)

# reset to standard numbering
# ---------------------------
#fixed.tr <- fixNodes(rerooted.tr)	
#plot(fixed.tr, label.offset = strwidth("---"), direction = "left")
#nodelabels(cex = 0.7)
#tiplabels(cex = 0.7)

## EXAMPLE 2:

# ladderization of tree changes numbering of 
# internal and terminal nodes
# ------------------------------------------
ladderized.tr <- ladderize(hordeum)	
plot(ladderized.tr, label.offset = strwidth("--"))
nodelabels(cex = 0.7)
tiplabels(cex = 0.7)

# reset to standard numbering
# ---------------------------
fixed.tr <- fixNodes(ladderized.tr)
plot(fixed.tr, label.offset = strwidth("---"), direction = "left")
nodelabels(cex = 0.7)
tiplabels(cex = 0.7)

# reset graphical parameters
# --------------------------
par(pp)

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