| 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] (ORCID: <https://orcid.org/0000-0003-2941-0161>), Marta Vidal-Garcia [aut], Claudia Solis-Lemus [aut] (ORCID: <https://orcid.org/0000-0002-9789-8915>), Leann Biancani [aut], Eren Ada [aut], L. Francisco Henao Diaz [aut], Guangchuang Yu [ctb], Joshua Justison [aut] |
| Maintainer: | Klaus Schliep <[email protected]> |
| License: | Artistic-2.0 |
| Version: | 1.19.0 |
| Built: | 2026-05-30 09:43:24 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() ggevonet(enet, layout = "rectangular") + geom_tiplab()(enet <- ape::read.evonet(text='((a:2,(b:1)#H1:1):1,(#H1,c:1):2);')) ggevonet(enet) + geom_tiplab() ggevonet(enet, layout = "rectangular") + 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, angle = 0, ...)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, angle = 0, ...)
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 |
angle |
rotate the plot. |
... |
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
Dress, A.W.M. and Huson, D.H. (2004) Constructing Splits Graphs IEEE/ACM Transactions on Computational Biology and Bioinformatics (TCBB), 1(3), 109–115
Bagci, C., Bryant, D., Cetinkaya, B. and Huson, D.H. (2021), Microbial Phylogenetic Context Using Phylogenetic Outlines. Genome Biology and Evolution. 13(9), evab213
Potts, A.J. and Hedderson, T.A. and Grimm, G.W. (2013), Constructing Phylogenies in the Presence Of Intra-Individual Site Polymorphisms (2ISPs) with a Focus on the Nuclear Ribosomal Cistron, Systematic Biology. 63(1), 1–16
ggtree, networx,
consensusNet, neighborNet
data(yeast, package='phangorn') dm <- phangorn::dist.ml(yeast) nnet <- phangorn::neighborNet(dm) ggsplitnet(nnet) + geom_tiplab2() library(phangorn) fdir <- system.file("extdata/examples", package = "tanggle") nymania <- read.phyDat(file.path(fdir, "Nymania.capensis.ITS.alignment.fasta"), format="fasta") nnet <- neighborNet(dist.p(nymania)) ggsplitnet(nnet) + geom_tiplab2()data(yeast, package='phangorn') dm <- phangorn::dist.ml(yeast) nnet <- phangorn::neighborNet(dm) ggsplitnet(nnet) + geom_tiplab2() library(phangorn) fdir <- system.file("extdata/examples", package = "tanggle") nymania <- read.phyDat(file.path(fdir, "Nymania.capensis.ITS.alignment.fasta"), format="fasta") nnet <- neighborNet(dist.p(nymania)) 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)
Swapping the minor edges of an evonet object
swap_hybrid_minor(x, hybrid_nodes, node_times = NULL)swap_hybrid_minor(x, hybrid_nodes, node_times = NULL)
x |
evonet object |
hybrid_nodes |
a vector of hybrid nodes to have their minor edges swapped |
node_times |
an optional argument with node times |
network
(enet <- ape::read.evonet(text='((a:2,(b:1)#H1:1):1,(#H1,c:1):2);')) ggevonet(enet) + geom_tiplab() swapped_enet<-swap_hybrid_minor(enet,6) ggevonet(swapped_enet) + geom_tiplab()(enet <- ape::read.evonet(text='((a:2,(b:1)#H1:1):1,(#H1,c:1):2);')) ggevonet(enet) + geom_tiplab() swapped_enet<-swap_hybrid_minor(enet,6) ggevonet(swapped_enet) + geom_tiplab()