Find the topologicial differences between two trees with the same tip labels. The function returns a data frame of the tips and the number of differences in their ancestry between the two trees.
Called by plotTreeDiff
, which highlights the differing tips in a plot of the two trees.
tipDiff(tr1, tr2, vec1 = NULL, vec2 = NULL, sizeOfDifferences = FALSE)
an object of the class phylo
: the first tree to compare.
an object of the class phylo
: the second tree to compare.
an optional input, the result of treeVec(tr1, lambda=0)
, to speed up the computation.
an optional input, the result of treeVec(tr2, lambda=0)
, to speed up the computation.
a logical (default FALSE) specifying whether the size of the differences in the vectors per tip is also computed
A data frame of the tree tips and the number of ancestral differences between them in the two trees, in order of increasing difference. A tip is said to have zero difference if each of its ancestral nodes admits the same tip partition in the two trees.
## simple example on trees with five tips:
tr1 <- read.tree(text="((A:1,B:1):1,((C:1,D:1):1,E:1):1):1;")
tr2 <- read.tree(text="((A:1,B:1):1,(C:1,(D:1,E:1):1):1):1;")
tipDiff(tr1,tr2)
#> Tip No. of differences
#> 1 A 0
#> 2 B 0
#> 3 C 1
#> 4 E 1
#> 5 D 2
## example on larger woodmice trees
data(woodmiceTrees)
tipDiff(woodmiceTrees[[1]],woodmiceTrees[[2]])
#> Tip No. of differences
#> 1 No0909S 0
#> 2 No0912S 0
#> 3 No1007S 0
#> 4 No1103S 0
#> 5 No1114S 0
#> 6 No1208S 0
#> 7 No305 0
#> 8 No0908S 1
#> 9 No0913S 1
#> 10 No306 1
#> 11 No304 2
#> 12 No0906S 3
#> 13 No0910S 3
#> 14 No1202S 3
#> 15 No1206S 4