Differential Abundance
Identifying individual taxa that are more or less abundant between groups is one of the most requested analyses in microbiome research, and one of the most statistically fraught. This page covers why naive approaches fail, which tools are recommended, and what the results actually mean.
The compositionality problem
Because the count table is compositional (relative abundances sum to 1), standard statistical tests assume independence that is not present. An increase in one taxon’s relative abundance necessarily decreases others’. This means:
- A taxon can appear to increase in one group simply because a different, dominant taxon decreased.
- Standard t-tests or Wilcoxon tests on raw relative abundances do not account for this and will produce false positives.
Current recommended tools:
- ANCOM-BC2: compositionally aware; controls false discovery rate; preferred for most studies
- DESeq2: borrowed from RNA-seq; performs well in practice but assumptions may not strictly hold due to compositional nature of data
- ALDEx2: Dirichlet-multinomial model; robust but conservative; less commonly used in practice
Why ANCOM works: the log-ratio approach
ANCOM and ANCOM-BC are widely used because they are built around the compositional nature of microbiome data from the start. Instead of asking “is taxon A more abundant in group 1 vs. group 2?” which is a question that is confounded by the fact that relative abundances are not independent, ANCOM asks “is the ratio of taxon A to every other taxon different between groups?” For each taxon, it counts how many of these pairwise log-ratio tests come back significant. A taxon is called differentially abundant only if it shows consistent differences across the majority of its comparisons.
This “majority-wins” design means random noise is extremely unlikely to produce a false positive: noise might make a few ratios look significant, but it would have to affect most of them simultaneously to trigger a call. The tradeoff is lower sensitivity. ANCOM may miss real differences, especially for rare taxa, but it almost never produces false positives.
ANCOM-BC extends this by explicitly modeling and correcting for library size (the total reads per sample) and providing interpretable log-fold changes with confidence intervals, similar to what you would see in an RNA-seq differential expression report.
Let’s bring this back to the census. Imagine you want to know whether City A has more Smiths than City B. A naive comparison of 500 Smiths in City A vs. 200 Smiths from City B seems to suggest that there are more Smiths in City A. The problem is that we may have 10,000 people surveyed in City A versus 2,000 in City B. It turns out that City A actually has a much smaller proportion of Smiths than City B!
Instead of declaring “City A has more Smiths,” ANCOM asks: are there more Smiths relative to Johnsons? More Smiths relative to Williams? More Smiths relative to every other last name in the census? Only if Smiths win the majority of those pairwise comparisons does ANCOM call them truly over-represented in City A. Random noise might skew one or two ratios, but it is nearly impossible to simultaneously shift most of them, which is why ANCOM’s false positive rate is near zero.
ANCOMBC
For more information about using ANCOMBC in R, look here: documentation
library(ANCOMBC)
# Run ANCOM-BC2
out <- ancombc2(
data = physeq, # data in a phyloseq format
fix_formula = "treatment + age + sex",
p_adj_method = "BH", # method to adjust for multiple testing
pseudo_sens = TRUE,
prv_cut = 0.10, # exclude taxa from analysis present in <10% of samples
lib_cut = 1000,
s0_perc = 0.05,
group = "treatment",
struc_zero = TRUE,
neg_lb = TRUE,
alpha = 0.05,
n_cl = 2
)
# Results
res <- out$res
# Columns: lfc (log-fold change), se, W, p_val, q_val (FDR-adjusted), diff_abnQIIME2
For more information about using ANCOMBC within QIIME2, check this out: documentation
# Filter to only the samples you want to compare
qiime feature-table filter-samples \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-where "[treatment]='case' OR [treatment]='control'" \
--o-filtered-table filtered-table.qza
# Run ANCOM-BC
qiime composition ancombc \
--i-table filtered-table.qza \
--m-metadata-file metadata.tsv \
--p-formula "treatment" \
--o-differentials differentials.qza
# Visualize as a bar plot of log-fold changes
qiime composition da-barplot \
--i-data differentials.qza \
--p-significance-threshold 0.05 \
--o-visualization da-barplot.qzvMultiple testing
A typical microbiome study tests hundreds to thousands of taxa simultaneously. It is well advised to apply for multiple testing correction. The ANCOMBC2 package has the p_adj_method parameter in R or the --p-p-adj-method in QIIME2 framework to account for this.