Skip to content

Inferential replicates

Transcript abundance estimates carry inferential uncertainty: reads that map ambiguously to several transcripts can be apportioned in more than one way. salmon can quantify this uncertainty by producing inferential replicates — repeated abundance estimates that downstream tools (fishpond/swish) use to separate biological signal from inferential noise.

Terminal window
salmon quant -i salmon_index -l A \
-1 r1.fq.gz -2 r2.fq.gz -p 16 \
--numBootstraps 100 \
-o out

Gibbs sampling draws posterior samples from the abundance model. It is mutually exclusive with bootstrapping.

Terminal window
salmon quant -i salmon_index -l A \
-1 r1.fq.gz -2 r2.fq.gz -p 16 \
--numGibbsSamples 100 \
--thinningFactor 16 \
-o out

The two methods answer different questions, which is why salmon provides both:

  • Bootstrap: how much would the estimates move if this library had yielded slightly different counts? Each replicate resamples the equivalence-class counts and re-runs the optimizer.
  • Gibbs sampling: which abundances does the model support, given these counts? The sampler repeatedly reassigns fragments to transcripts in proportion to the current abundances, and draws the abundances again from the result, so its samples come from the posterior.

They differ most where the likelihood is nearly flat, as it is across isoforms that share almost all of their sequence. Each bootstrap replicate re-runs the optimizer from the same starting point, so replicates can settle on similar allocations even when the data barely distinguish them. The Gibbs sampler moves along such directions, so it shows that ambiguity more fully.

Both methods work from a single library’s mapping results. Bootstrapping resamples that library’s equivalence-class counts and re-runs the optimizer; Gibbs sampling explores the abundances those same classes support. The equivalence classes, their conditional weights and the bias-corrected effective lengths stay as they were in the original run.

Replicates therefore describe the uncertainty within one library. They do not include what changes when the same RNA goes through a new library preparation or sequencing run, such as fragmentation, complexity, duplication or read length. They can understate the differences seen between technical replicate libraries, and should not be used as an estimate of that variance. Only sequencing replicate libraries measures it.

This matters most for isoform proportions, and for anything derived from them. The gene-level average transcript length that tximport turns into DESeq2 offsets is an abundance-weighted mean of effective lengths, so it inherits any instability in how a gene’s reads are divided among its isoforms. In one report on technical replicates of whole-blood total RNA, sequenced two years apart at 2x51 and 2x59 bp, the between-library spread of this quantity was about twice what 30 bootstraps predicted. That is a single dataset, whose two runs also differed in platform and duplication rate, not a general calibration factor, and its replicates were bootstraps, which can understate isoform ambiguity as described above.

If you have technical replicates and proportions do not reproduce, these are useful checks:

  • Fix each gene’s isoform proportions at their mean across samples and recompute the average transcript length. If the instability disappears, it comes from the proportions rather than the bias-corrected effective lengths.
  • Re-run with --useEM. When isoforms are nearly identical the likelihood can be almost flat across them, so the allocation may be sensitive to the optimizer. A large difference from the default VBEM points to this; it does not show which result is correct.
  • Draw Gibbs samples (--numGibbsSamples) as well as bootstraps, and compare their spread for the affected genes with the bootstrap spread.
  • Compare downstream results with and without the length offsets, to see how much of a change between conditions comes from the offsets alone.

Replicates are written to aux_info/bootstrap/:

  • names.tsv.gz — the transcript names, in index order.
  • bootstraps.gz — the replicate abundances as raw little-endian f64s (n_replicates × num_transcripts, contiguous).

aux_info/meta_info.json records num_bootstraps and samp_type ("bootstrap" or "gibbs"). This is the same format C++ salmon used, so it loads directly in the standard R tools. See the output format specification for the exact byte layout.

library(tximport)
library(fishpond)
# txi$infReps holds the inferential replicate matrices
txi <- tximport("out/quant.sf", type = "salmon", txOut = TRUE)

tximport reads the replicates automatically when they are present; fishpond and swish then use them for differential-expression testing with uncertainty.