Visualize microbiome data with black magic ggtree
Last updated Apr 29, 2025
68
Stars
14
Forks
3
Issues
0
Stars/day
Attention Score
32
Language breakdown
R 100.0%
▸ Files
click to expand
README
microbiomeViz -- An R package for visualizing microbiome data
Authors:
Chenhao Li, Guangchuang Yu, Chenghao Zhu
Description:
- parse taxonomic profiling table
- GraPhlAn like tree visualization and annotation
- support cladograme visualization from phyloseq objects and .biom files
Showcase:

Example:
Install:
{r}
## run the following command first if you don't have ggtree installed.
setRepositories(ind=1:2)
devtools::install_github("lch14forever/microbiomeViz")
Parse a MetaPhlAn table
{r}
library(microbiomeViz)
data("SRS014459Stoolprofile")
tr <- parseMetaphlanTSV(SRS014459Stoolprofile)
Create a backbone
{r}
p <- tree.backbone(tr)
p
Add annotation
{r}
anno.data <- data.frame(node=c("gRoseburia", "cClostridia", "s_Bacteroidesovatus"),
color='red', stringsAsFactors = FALSE)
p <- clade.anno(p, anno.data)
p
From phyloseq objects
{r}
library(phyloseq)
data("GlobalPatterns")
GP = GlobalPatterns
GP = transformsamplecounts(GlobalPatterns, function(otu) otu/sum(otu)) GP = filter_taxa(GP, function(x) max(x)>=0.01,TRUE) GP = fixduplicatetax(GP)
tr = parsePhyloseq(GP) p = tree.backbone(tr, size=1)
From .biom files
The phyloseq package can import the otu table from .biom files.
{r}
richdensebiom = system.file("extdata", "richdenseotu_table.biom", package="phyloseq")
richdense = importbiom(richdensebiom, parseFunction=parsetaxonomygreengenes)
tr = parsePhyloseq(rich_dense)
p = tree.backbone(tr, size=1)🔗 More in this category