drop.tip2: Remove Tips from a Phylogenetic Tree

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

Description

As drop.tip from the ape package, drop.tip2 removes terminal branches of a phylogenetic tree, possibly removing the corresponding internal branches, but, in addition, can handle further, non-standard list elements of "phylo" object (i.e. vectors of length phy$Nnode, which may contain support values, ages or rate estimates, etc. ).

Usage

1
2
drop.tip2(phy, tip, trim.internal = TRUE, subtree = FALSE, 
  root.edge = 0, rooted = is.rooted(phy))

Arguments

phy

An object of class "phylo".

tip

A vector of mode numeric or character specifying the tips to delete.

trim.internal

A logical specifying whether to delete the corresponding internal branches.

subtree

A logical specifying whether to output in the tree how many tips have been deleted and where.

root.edge

An integer giving the number of internal branches to be used to build the new root edge. This has no effect if trim.internal = FALSE.

rooted

A logical indicated whether the tree must be treated as rooted or not. This allows to force the tree to be considered as unrooted (see examples in drop.tip).

Details

See drop.tip for details.

Value

An object of class "phylo".

Author(s)

Christoph Heibl based on drop.tip by Emanuel Paradis.

See Also

extract.clade2, drop.tip

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
# Hordeum species tree
# --------------------
data(hordeum)

# These tips ... 
# --------------
tips2remove = c("Hordeum_pubiflorum", "Hordeum_patagonicum",
  "Hordeum_comosum", "Hordeum_gussoneanum","Hordeum_marinum")

# ... will be pruned from the tree:
# ---------------------------------
hordeum_pruned <- drop.tip2(hordeum, tips2remove)

# Compare the results using the height parameter 
# from a divergence time analysis:
# ----------------------------------------------
org.par <- par()
par(mfrow = c(2,1), mar = c(0, 0, 1, 0))

tcol <- tip.color(hordeum, list(tips2remove), 
	col = "red")
plot.phylo(hordeum, tip.color = tcol)
title("Hordeum species tree")
nodelabels(hordeum$height, cex = 0.8)

plot.phylo(hordeum_pruned)
title("Hordeum species tree with tips removed")
nodelabels(hordeum_pruned$height, cex = 0.8)
par(org.par)

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