eBay (An empirical Bayes normalization method for microbiome data)
The characteristics of microbiome data are complicated: varied sequencing depth, lots of zeros, over-dispersion, a phylogenetic tree representing the relationship among taxa, and compositionality. In order to deal with these problems, we proposed an empirical Bayes normalization method called eBay. [1] shows the statistical model in detail.
install.packages("devtools")
devtools::install_github("liudoubletian/eBay")
library(eBay)
eBay(otu.data=ntree_table, group=group, test.method="t", cutf=0.05,adj.m="BH")
otu.data
: an OTU table with n rows (samples) and m columns (taxa)group
: a n-vector of group indicatorstest.method
: t-test or Wilcoxon rank sum testcutf
: level of significanceadj.m
: the adjustment methods for p-valuesit returns a list of results:
final.p
: the adjusted p values
dif.otus
: the set of differentially abundant OTUs
eBay_tree(otu.data=tree_table,tree=tree,group=group,test.method="t",cutf=0.05,adj.m="BH")
otu.data
: an OTU table with n rows (samples) and m columns (taxa)tree
: a phylogenetic tree among m taxagroup
: a n-vector of group indicatorstest.method
: t-test or Wilcoxon rank sum testcutf
: level of significanceadj.m
: the adjustment methods for p-valuesit returns a list of results:
final.p
: the adjusted p values
dif.otus
: the set of differentially abundant OTUs
The following function shows how to simulate data from a Dirichlet-multinomial distribution.
set.seed(1)
rand_pi <- runif(20)
control_pi = case_pi = rand_pi/sum(rand_pi)
control_theta = case_theta = 0.1
group <- rep(c(0,1),each =20)
ntree_table <- simulation_dm(p=20,seed=1, N=20,control_pi, case_pi,control_theta,case_theta)
Run the eBay function to normalize the data and return a set of differentially abundant taxa.
ebay.res <- eBay(otu.data=ntree_table, group=group, test.method="t", cutf=0.05,adj.m="BH")
ebay.res
First, generate a tree randomly.
p <- 40
set.seed(1)
tree <- simulate_tree(p)
The following function shows how to simulate data from the Dirichlet-tree multinomial model.
set.seed(1)
control_pi = case_pi = c()
for(j in (p+1):(p+tree$Nnode)){
set.seed(j)
random_pi <- runif(1,0.2,0.4)
control_pi[which(tree$edge[,1]==j)] <- c(random_pi, 1-random_pi)
case_pi[which(tree$edge[,1]==j)] <- c(random_pi, 1-random_pi)
}
control_theta = case_theta = rep(0.1, tree$Nnode)
group <- rep(c(0,1),each =20)
tree_table <- simulation_dtm(p=40,tree, seed=1, N=20,control_pi, case_pi,control_theta,case_theta)
Run the eBay_tree function to normalize the data and return a set of differentially abundant taxa.
ebay_tree.res <- eBay_tree(otu.data=tree_table, tree=tree, group=group, test.method="t", cutf=0.05,adj.m="BH")
ebay_tree.res
[1] Tiantian Liu, Tao Wang. (2020) An empirical Bayes approach to normalization and differential abundance testing for microbiome data (Under review).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.