pf.tree | R Documentation |
ggtree-based plotting of phylofactor bins or factors
pf.tree(pf, tree = NULL, method = "factors", factors = NULL,
ignore.tips = TRUE, groups = NULL, colors = NULL,
GroupList = NULL, bg.color = NA, bg.alpha = 0.1, alphas = NULL,
layout = "circular", rootnode = FALSE, top.layer = F,
top.alpha = 0.1, color.fcn = viridis::viridis, ...)
pf |
phylofactor class object |
tree |
An alternative tree on which to plot the phylogenetic factors |
method |
either "factors" or "bins", based on whether to use factors ( |
factors |
vector of factor numbers to be plotted |
groups |
vector of groups (1 or 2) to be plotted for each factor. Default is 1 |
colors |
colors for each |
GroupList |
optional list of groups for plotting |
bg.color |
background color |
bg.alpha |
background alpha |
alphas |
vector, of length = |
layout |
See |
rootnode |
Logical. If true, will fill in the root node. Default controls root only with bg.color |
top.layer |
Logical. If true, will superimpose hilights on top of tree. If false, tree will layer on top of hilights. |
top.alpha |
Numeric. Alpha value for |
color.fcn |
Color function for plotting. Default is viridis. |
... |
optional arguments for ggtree |
library(phylofactor)
data(FTmicrobiome)
pf <- FTmicrobiome$PF
big.tree <- FTmicrobiome$tree
tax <- FTmicrobiome$taxonomy
gg <- pf.tree(pf,factors=1:3,layout='circular')
gg$ggplot
gg$legend
## We can also focus on a universal tree
# pf.tree(pf,big.tree,factors=1:3)
## and a sub-tree
bacteroidetes <- tax$OTU_ID[grepl('p__Bacteroidetes',tax$taxonomy)] %>%
intersect(pf$tree$tip.label)
bacteroidetes.tree <- drop.tip(big.tree,setdiff(big.tree$tip.label,bacteroidetes))
pf.tree(pf,bacteroidetes.tree,factors=setdiff(1:pf$nfactors,41))
## factor 41 contains a large, paraphyletic group that encompases all of the
## bacteroidetes - this will color our entire tree purple.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.