Description Usage Arguments Details Value Note Author(s) Examples
Convenience version of conversion to phylo format of the ape
package, used throughout packages for phylogenetic methods. This conversion offers various options to tweak the branch lenghts of Glottolog trees (which do not have any inherent branch lengths). Currently very slow for large trees!
1 2 |
tree |
(selection of) Glottolog data, preferably extracted with |
height |
Height of the tree. By default all nodes in the tree will be simply equally spaced on this height in an ultrametric fashion, i.e. all leaves will be at height zero. |
fixed.branches |
Alternatively to |
long.root |
The Glottolog version included in this packages includes a 'World' root and six area nodes below this root. These nodes are not strictly speaking genealogical nodes, though they are often practical for phylogenitic inference. Specify the length of these nodes here. |
multi.allow |
Allow multichotomies in tree |
quick |
Conversion when quick approach is used |
The phylo
format is a widely used format for phylogenetic inference. However, many methods depend crucially on branch lengths. As linguistic trees mostly do not have branch lenghts, this conversion offers a few options to tweak branch lengths.
Note that phylo trees do not allow singleton nodes, so they are removed internally (by collapse.singles
). The tree is also forced to be binary (by multi2di
), which is also expected in many phylogenetic analysis.
The order of length assignment is: reduce (in getTree) >> height >> fixed length >> long root >> collapse singles, which can be used to lead to different results. Also the option reduce
in getTree
can be used to influence the branch lenghts (see Examples below).
The collapsing of singleton internal nodes after branch length leads to an interesting effect that branch lengths are somehow proportional to the number of internal diversity of the tree, which might make sense as a proxy to branch lengths. Something like reduce = F, fixed.branches = 1, long.root = 10
seem promising.
An object of class phylo
.
Depends internally on ToNewick
which is currently very slow for large trees.
Michael Cysouw <cysouw@mac.com
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 | # many different effects can be achieved by combining options
isoCodes <- c("deu", "eng", "swe", "swh", "xho", "fin")
treeWithInternal <- getTree(isoCodes, reduce = FALSE)
treeNoInternal <- getTree(isoCodes, reduce = TRUE)
## Not run:
# to understand the influence of the option 'reduce' also check
library(data.tree)
plot(FromDataFrameNetwork(treeWithInternal))
plot(FromDataFrameNetwork(treeNoInternal))
## End(Not run)
library(ape)
par(mfcol = c(2,3))
phylo <- asPhylo(treeWithInternal, height = 20)
plot(phylo, main = "reduce = FALSE\nheight = 20", cex = 1)
edgelabels(round(phylo$edge.length), cex = 1.5)
phylo <- asPhylo(treeNoInternal, height = 20)
plot(phylo, main = "reduce = TRUE\nheight = 20", cex = 1)
edgelabels(round(phylo$edge.length), cex = 1.5)
phylo <- asPhylo(treeWithInternal, fixed.branches = 1)
plot(phylo, main = "reduce = FALSE\nfixed.branches = 1", cex = 1)
edgelabels(round(phylo$edge.length), cex = 1.5)
phylo <- asPhylo(treeNoInternal, fixed.branches = 1)
plot(phylo, main = "reduce = TRUE\nfixed.branches = 1", cex = 1)
edgelabels(round(phylo$edge.length), cex = 1.5)
phylo <- asPhylo(treeWithInternal, fixed.branches = 1, long.root = 10)
plot(phylo, main = "reduce = FALSE\nfixed.branches = 1\nlong.root = 10", cex = 1)
edgelabels(round(phylo$edge.length), cex = 1.5)
phylo <- asPhylo(treeNoInternal, fixed.branches = 1, long.root = 10)
plot(phylo, main = "reduce = TRUE\nfixed.branches = 1\nlong.root = 10", cex = 1)
edgelabels(round(phylo$edge.length), cex = 1.5)
par(mfcol=c(1,1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.