Title: | Visualization of Phylogenetic Networks |
---|---|
Description: | Offers functions for plotting split (or implicit) networks (unrooted, undirected) and explicit networks (rooted, directed) with reticulations extending. 'ggtree' and using functions from 'ape' and 'phangorn'. It extends the 'ggtree' package [@Yu2017] to allow the visualization of phylogenetic networks using the 'ggplot2' syntax. It offers an alternative to the plot functions already available in 'ape' Paradis and Schliep (2019) <doi:10.1093/bioinformatics/bty633> and 'phangorn' Schliep (2011) <doi:10.1093/bioinformatics/btq706>. |
Authors: | Klaus Schliep [aut, cre] , Marta Vidal-Garcia [aut], Claudia Solis-Lemus [aut] , Leann Biancani [aut], Eren Ada [aut], L. Francisco Henao Diaz [aut], Guangchuang Yu [ctb] |
Maintainer: | Klaus Schliep <[email protected]> |
License: | Artistic-2.0 |
Version: | 1.13.0 |
Built: | 2024-11-14 06:00:44 UTC |
Source: | https://github.com/bioc/tanggle |
add splitnet layer
geom_splitnet(layout = "slanted", ...)
geom_splitnet(layout = "slanted", ...)
layout |
one of 'rectangular', 'slanted', 'circular', 'radial' or 'unrooted' |
... |
additional parameter |
splitnet layer
Klaus Schliep
data(yeast, package='phangorn') dm <- phangorn::dist.ml(yeast) nnet <- phangorn::neighborNet(dm) ggplot(nnet, aes(x, y)) + geom_splitnet() + theme_tree()
data(yeast, package='phangorn') dm <- phangorn::dist.ml(yeast) nnet <- phangorn::neighborNet(dm) ggplot(nnet, aes(x, y)) + geom_splitnet() + theme_tree()
drawing phylogenetic tree from phylo object
ggevonet(tr, mapping = NULL, layout = "slanted", mrsd = NULL, as.Date = FALSE, yscale = "none", yscale_mapping = NULL, ladderize = FALSE, right = FALSE, branch.length = "branch.length", ndigits = NULL, min_crossing = TRUE, ...)
ggevonet(tr, mapping = NULL, layout = "slanted", mrsd = NULL, as.Date = FALSE, yscale = "none", yscale_mapping = NULL, ladderize = FALSE, right = FALSE, branch.length = "branch.length", ndigits = NULL, min_crossing = TRUE, ...)
tr |
a evonet object |
mapping |
aes mapping |
layout |
one of 'rectangular', 'slanted' |
mrsd |
most recent sampling date |
as.Date |
logical whether using Date class in time tree |
yscale |
y scale |
yscale_mapping |
yscale mapping for category variable |
ladderize |
logical |
right |
logical |
branch.length |
variable for scaling branch, if 'none' draw cladogram |
ndigits |
number of digits to round numerical annotation variable |
min_crossing |
logical, rotate clades to minimize crossings |
... |
additional parameter |
tree
Klaus Schliep
(enet <- ape::read.evonet(text='((a:2,(b:1)#H1:1):1,(#H1,c:1):2);')) ggevonet(enet) + geom_tiplab()
(enet <- ape::read.evonet(text='((a:2,(b:1)#H1:1):1,(#H1,c:1):2);')) ggevonet(enet) + geom_tiplab()
drawing phylogenetic tree from phylo object
ggsplitnet(tr, mapping = NULL, layout = "slanted", mrsd = NULL, as.Date = FALSE, yscale = "none", yscale_mapping = NULL, ladderize = FALSE, right = FALSE, branch.length = "branch.length", ndigits = NULL, ...)
ggsplitnet(tr, mapping = NULL, layout = "slanted", mrsd = NULL, as.Date = FALSE, yscale = "none", yscale_mapping = NULL, ladderize = FALSE, right = FALSE, branch.length = "branch.length", ndigits = NULL, ...)
tr |
a networx object |
mapping |
aes mapping |
layout |
so far only 'slanted' is supported. |
mrsd |
most recent sampling date |
as.Date |
logical whether using Date class in time tree |
yscale |
y scale |
yscale_mapping |
yscale mapping for category variable |
ladderize |
logical |
right |
logical |
branch.length |
variable for scaling branch, if 'none' draw cladogram |
ndigits |
number of digits to round numerical annotation variable |
... |
additional parameter |
tree
Klaus Schliep
Schliep, K., Potts, A. J., Morrison, D. A. and Grimm, G. W. (2017), Intertwining phylogenetic trees and networks. Methods Ecol Evol. 8, 1212–1220. doi:10.1111/2041-210X.12760
ggtree
, networx
,
consensusNet
, neighborNet
data(yeast, package='phangorn') dm <- phangorn::dist.ml(yeast) nnet <- phangorn::neighborNet(dm) ggsplitnet(nnet) + geom_tiplab2()
data(yeast, package='phangorn') dm <- phangorn::dist.ml(yeast) nnet <- phangorn::neighborNet(dm) ggsplitnet(nnet) + geom_tiplab2()
minimize_overlap reduces reticulation lines crossing over in plots
minimize_overlap(x)
minimize_overlap(x)
x |
Tree of class 'evonet' |
A Tree with rotated nodes of class 'evonet'
L. Francisco Henao Diaz
fishnet <- ape::read.evonet(text='(Xalvarezi,Xmayae,((Xsignum,((Xmonticolus, (Xclemenciae_F2,#H25)),(((((((((Xgordoni,Xmeyeri),Xcouchianus),Xvariatus), Xevelynae),(Xxiphidium,#H24)),Xmilleri),Xandersi),Xmaculatus),(((Xmontezumae, (Xcortezi,(Xbirchmanni_GARC,Xmalinche_CHIC2))),((Xnigrensis,Xmultilineatus), (Xpygmaeus,Xcontinens))))#H24))),(Xhellerii)#H25));') fishnet$edge.length <- NULL new_tre <- minimize_overlap(fishnet) par(mfrow=c(1,2)) ggevonet(fishnet, min_crossing = FALSE) ggevonet(new_tre) net2 <- ape::read.evonet(text='(15,(1,((14,(#H1,(((12,13),(11,#H3)),(7, ((10)#H3,(8,9)))))),((((2,3))#H2,(6,(5,(#H2,4)))))#H1)));') # Cui et al. 2013 Evol. new_net2 <- minimize_overlap(net2) ggevonet(net2, min_crossing = FALSE) ggevonet(new_net2)
fishnet <- ape::read.evonet(text='(Xalvarezi,Xmayae,((Xsignum,((Xmonticolus, (Xclemenciae_F2,#H25)),(((((((((Xgordoni,Xmeyeri),Xcouchianus),Xvariatus), Xevelynae),(Xxiphidium,#H24)),Xmilleri),Xandersi),Xmaculatus),(((Xmontezumae, (Xcortezi,(Xbirchmanni_GARC,Xmalinche_CHIC2))),((Xnigrensis,Xmultilineatus), (Xpygmaeus,Xcontinens))))#H24))),(Xhellerii)#H25));') fishnet$edge.length <- NULL new_tre <- minimize_overlap(fishnet) par(mfrow=c(1,2)) ggevonet(fishnet, min_crossing = FALSE) ggevonet(new_tre) net2 <- ape::read.evonet(text='(15,(1,((14,(#H1,(((12,13),(11,#H3)),(7, ((10)#H3,(8,9)))))),((((2,3))#H2,(6,(5,(#H2,4)))))#H1)));') # Cui et al. 2013 Evol. new_net2 <- minimize_overlap(net2) ggevonet(net2, min_crossing = FALSE) ggevonet(new_net2)
These functions return the depths or heights of nodes and tips.
node_depth_evonet(x, ...)
node_depth_evonet(x, ...)
x |
an object of class 'evonet' |
... |
Further arguments passed to or from other methods. |
a vector with the depth of the nodes
z <- ape::read.evonet(text = '((1,((2,(3,(4)Y#H1)g)e, (((Y#H1, 5)h,6)f)X#H2)c)a,((X#H2,7)d,8)b)r;') nd <- node_depth_evonet(z) z$edge.length <- nd[z$edge[,1]] - nd[z$edge[,2]] ggevonet(z)
z <- ape::read.evonet(text = '((1,((2,(3,(4)Y#H1)g)e, (((Y#H1, 5)h,6)f)X#H2)c)a,((X#H2,7)d,8)b)r;') nd <- node_depth_evonet(z) z$edge.length <- nd[z$edge[,1]] - nd[z$edge[,2]] ggevonet(z)