Rarefaction

Making sequencing depth equal by random subsampling

Sequencing depth varies

Bar chart of library size for each of the 26 GlobalPatterns samples, sorted from the smallest to the largest; the largest library is about 40 times the smallest.

Up to a 40-fold difference in the number of reads between samples

Same community, different depth

Two bar charts of read counts for eight taxa, sequenced from the same community. With 20 reads only five of the eight taxa are seen; with 200 reads all eight are seen.

Exactly the same community: more reads, more taxa seen

Deeper sequencing finds more taxa

Rarefaction curves, one line per GlobalPatterns sample: the number of observed taxa rises steeply with the number of reads and then flattens. A dashed vertical line marks the smallest library size, where the curves are still steep.

Rarefaction: the idea

Toy illustration in three steps for two samples. Each dot is a read and each colour is a taxon. Step 1: sample 1 has 60 reads and sample 2 has 30. Step 2: 30 reads are drawn at random from sample 1, the other reads are faded. Step 3: both samples now have 30 reads.

Rarefaction in three steps

  1. Choose a depth (often the smallest library size)
  2. Drop samples with fewer reads than that depth
  3. Subsample reads at random from every other sample, down to exactly that depth

One draw is random

Two plots for one sample rarefied 200 times to the same depth. Left: a histogram of observed taxa, which varies from draw to draw around its mean (vertical line). Right: the running average of observed taxa over the number of draws, which fluctuates for the first few draws and then settles.

Every draw gives a slightly different answer

Repeat many times and average

  • Alpha diversity: rarefy many times, compute the index each time, take the average
  • Beta diversity: compute the dissimilarity for each rarefied table, take the average
  • This is the recommended way to use rarefaction for diversity analysis
tse <- addAlpha(tse, index = "shannon", sample = depth, niter = 100)

d <- getDissimilarity(tse, method = "bray", sample = depth, niter = 100)

One rarefied table in mia

tse_rarefy <- rarefyAssay(
    tse,
    assay.type = "counts"
)
Dot plot with one column per GlobalPatterns sample, sorted by original library size. Blue dots show the observed taxa of each sample before rarefaction; brown dots show the observed taxa after all samples were subsampled to the same depth. The brown dots are lower for almost every sample.

A debated method

  • For: makes depth equal, removes the depth effect on richness
  • Against: throws data away
  • Single rarefied table is not recommended for differential abundance testing
  • Re-evaluated recently: repeat many times and average for alpha and beta diversity

Take-home

  • Sequencing depth varies between samples and affects the number of observed taxa
  • Rarefaction curves show whether depth is enough
  • Rarefaction = random subsampling of reads to a common depth
  • For alpha and beta diversity: repeat many times and average
  • In mia: rarefyAssay()

Further reading

  • OMA online book: Rarefaction
  • Sanders (1968) Marine benthic diversity: a comparative study. The American Naturalist 102:243–282
  • Hurlbert (1971) The nonconcept of species diversity: a critique and alternative parameters. Ecology 52:577–586
  • McMurdie and Holmes (2014) Waste not, want not: why rarefying microbiome data is inadmissible. PLoS Comput Biol
  • Schloss (2024) Rarefaction is currently the best approach to control for uneven sequencing effort in amplicon sequence analyses. mSphere