add.taxa.phylo: Add species in a phylogenetic tree

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

View source: R/add.taxa.phylo.R

Description

Function add species in a phylogenetic tree. Three method are available, see details. This function is based in the functions bind.tree and bind.tip.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
add.taxa.phylo(tree, taxa, m = 0, prefix = "NeWNodEPhylO")

add.taxa.phylo.phylomatic(
  tree,
  taxa,
  renove.artificial.tip = TRUE,
  m = 0,
  prefix = "NeWNodEPhylomatiC"
)

add.taxa.phylo.random(
  tree,
  taxa,
  random.order = TRUE,
  m = 0,
  prefix = "NeWNodERandoM",
  method = "length"
)

Arguments

tree

as an object of class "phylo".

taxa

Taxa structure to add species. See details.

m

One number to starting sequence (default m = 0).

prefix

The prefix to new nodes labels (default "NeWNodEPhylO", "NeWNodERandoM" or "NeWNodEPhylomatiC").

renove.artificial.tip

Logical argument (TRUE or FALSE) to specify if artificial tips are removed or not, only to add.taxa.phylo.phylomatic function (default renove.artificial.tip = TRUE).

random.order

Logical argument (TRUE or FALSE) to specify if sequence order in input is keeped (FALSE) or random (TRUE) (default random.order = TRUE).

method

The method to add the new tip, partial match to "equal" or "length". See details (Default method = "length").

Details

The function add.taxa.phylo.random add new tips at random. Taxa object is matrix with two columns. The first column is the node label to new tip be anchored. The tip will be anchored random inside this clade. The most recent common ancestors known can be used to define the point of anchorage. The second column is the label to new tip. Two methods are available, the method "length" add the tip with probability equivalent to edge length, long edge have more probability than short edge. The method "equal" each edge has equal probability to receive the new tip.

The function add.taxa.phylo allows to add the new tips according to more related species or node provided. The taxa object is matrix with three columns. The first column is the node label or tip label to new tip be anchored. The second column is the label to new tip. The third column is the terminal edge length for the added tips, can be NA. If anchored label is a node the new tip is inserted as polytomy and edge length is not used, the length is computed to keep the tree ultrametric. If anchored is a tip label and edge length was provided the new tip is inserted with length provide, and if edge length was NA the length is computed simply by split current edge length by two.

The function add.taxa.phylo.phylomatic allows to add the new tips according structure provided, this method is similar to software phylomatic. The taxa object is matrix with two columns. The first column is the node label or tip label to new tip be anchored. The second column is the structure to new tip. This structure is composed by labels separated by common slash (/), for example family/genus/sp. The anchored label is removed and the edge length is divided by the number of levels (number of slash) within each clade. Artificial tips (named TReMoVtIP) are inserted to mark the steps of splits, they can be removed.

Value

A list with:

call

The call arguments.

m.start

The start m value.

m.current

The new m value, the difference between m.start and m.current is the number of node names created.

prefix

Prefix used.

new.tips

The new tips.

tree

The tree, class "phylo".

Author(s)

Vanderlei Julio Debastiani <vanderleidebastiani@yahoo.com.br>

See Also

bind.tree, bind.tip, add.random, add.tip.random

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
tree <- read.tree(text="(C:32,(B:16,A:16)N2:16)N1;")
tree <- compute.brlen(tree)
plot(tree, show.node=TRUE)

# add.taxa.phylo without edge length
taxa <- matrix(c("A", "C", "N2", "N2", "A1","C1", "in_N2.1", "in_N2.2",rep(NA,4)),4,3)
taxa
plot(add.taxa.phylo(tree, taxa)$tree, show.node.label = TRUE)

# add.taxa.phylo taxa with edge length
taxa <- matrix(c("A", "C", "A1","C1", 0.01, 0.9), 2,3)
taxa
plot(add.taxa.phylo(tree, taxa)$tree, show.node.label = TRUE)

# add.taxa.phylo.random
taxa <- matrix(c("N1","N2","Anywhere","Only_in_N2"), 2, 2)
taxa
plot(add.taxa.phylo.random(tree, taxa)$tree, show.node.label = TRUE)
plot(add.taxa.phylo.random(tree, taxa)$tree, show.node.label = TRUE)

# add.taxa.phylo.phylomatic
taxa <- matrix(c("B","B","D/D1/DD1","D/D2/DD2/DDD1"),2,2)
taxa
plot(add.taxa.phylo.phylomatic(tree, taxa, renove.artificial.tip = TRUE)$tree, 
	 show.node.label = TRUE)
plot(add.taxa.phylo.phylomatic(tree, taxa, renove.artificial.tip = FALSE)$tree, 
	 show.node.label = TRUE)

vanderleidebastiani/daee documentation built on Jan. 22, 2021, 2:41 p.m.