Algorithm Search⌘K

Problemcore

Transcript abundance estimation

Also called isoform quantification, expression quantification.

Estimate how much of each transcript is in a sample when many reads are compatible with several isoforms or genes, usually as a maximum likelihood estimate found by EM.

Transcript abundance estimation, or isoform quantification, finds how much of each known transcript a sample holds from its RNA-seq reads. The reads are short, and the isoforms of a gene share exons, so many reads fit two or more transcripts and cannot simply be counted. The standard answer is a probabilistic model in which each read comes from one transcript, chosen with a probability proportional to the abundance of the transcript times its length. The maximum likelihood estimate of the abundances is found by the EM algorithm. The log-likelihood is concave, so every local maximum is a global one, but the maximum is not unique when two transcripts cannot be told apart by the reads. RSEM, Cufflinks, kallisto and Salmon all solve versions of this problem.

In plain words

You have a box of pieces from many messages, and you want to know how many copies of each message were in the sample. A piece that fits only one message is easy: it counts for that message. But many pieces fit two or three messages, because the messages share parts.

You cannot count such a piece for all of them, and dropping it throws away information. The fair way is to share it out. If message A is three times as common as message B, a piece that fits both is three times as likely to be from A. But you do not know how common A and B are; that is the question.

So you guess, share the pieces by the guess, count again, and repeat. The guess gets better each time and settles on the answer that best explains all the pieces.

Definition

Input. A set of mm transcripts with effective lengths ℓ1,…,ℓm\ell_1, \ldots, \ell_m, where the effective length is the number of positions at which a fragment can start. A set of NN reads or read pairs, and for each read rr the probability P(r∣t)P(r \mid t) that a fragment from transcript tt gives this read, which is 0 when rr does not fit tt. In the simplest model, P(r∣t)=1/ℓtP(r \mid t) = 1 / \ell_t for every transcript that the read fits.

Model. A fragment comes from transcript tt with probability αt\alpha_t, and α\alpha is in the simplex: αt≥0\alpha_t \ge 0 and ∑tαt=1\sum_t \alpha_t = 1. The reads are independent, so

log⁡L(α)=∑rlog⁡∑tαt P(r∣t).\log L(\alpha) = \sum_{r} \log \sum_{t} \alpha_t \, P(r \mid t).

Output. The α\alpha that maximizes log⁡L\log L, or a posterior distribution over α\alpha. The fractions of molecules are τt=(αt/ℓt)/∑u(αu/ℓu)\tau_t = (\alpha_t / \ell_t) / \sum_u (\alpha_u / \ell_u), and the transcripts per million are 106τt10^6 \tau_t. FPKM uses the expected counts NαtN \alpha_t instead: FPKMt=Nαt⋅109/(ℓtN)\mathrm{FPKM}_t = N \alpha_t \cdot 10^9 / (\ell_t N).

Equivalence classes. With P(r∣t)=1/ℓtP(r \mid t) = 1/\ell_t, two reads that fit the same set of transcripts add the same term to log⁡L\log L. Grouping the reads by their set ee, with cec_e reads in it, gives log⁡L(α)=∑ecelog⁡∑t∈eαt/ℓt\log L(\alpha) = \sum_e c_e \log \sum_{t \in e} \alpha_t / \ell_t, which has one term per class instead of one per read.

Variants

  • How reads are matched to transcripts. Full alignment to the transcripts or to the genome with a read mapper, pseudoalignment, which returns only the set of compatible transcripts, or selective alignment, which also scores the alignment.
  • Bias models. P(r∣t)P(r \mid t) can depend on the fragment length, the position in the transcript, the GC content and the sequence near the fragment ends. Salmon fits such bias models and folds them into the effective lengths.
  • Point estimate or uncertainty. RSEM gives credibility intervals by Gibbs sampling, kallisto gives bootstrap estimates by running the EM on resampled counts, and Salmon offers both bootstrap and Gibbs samples. See bootstrap and Gibbs sampling.
  • Gene-level estimates. The abundance of a gene is the sum over its isoforms. It is far less uncertain than the isoform values, because reads shared between isoforms of one gene do not matter for the sum.
  • Count-based models. Jiang and Wong (2009) model the read counts in exon regions as Poisson variables whose means are sums over the isoforms, which gives the same kind of likelihood.
  • Single-cell counts. In single-cell RNA-seq, molecules are counted by barcodes after UMI deduplication, and the same sharing problem appears for molecules that fit several genes.

Examples

Sharing reads by EM. Two transcripts t1t_1 and t2t_2 have effective lengths 1000 and 500. Of 100 reads, 30 fit only t1t_1, 30 fit only t2t_2, and 40 fit both. The log-likelihood is

30log⁡α11000+40log⁡(α11000+α2500)+30log⁡α2500.30 \log \frac{\alpha_1}{1000} + 40 \log\Big(\frac{\alpha_1}{1000} + \frac{\alpha_2}{500}\Big) + 30 \log \frac{\alpha_2}{500}.

The maximum is at α=(0.4,0.6)\alpha = (0.4, 0.6): setting α2=1−α1\alpha_2 = 1 - \alpha_1, the derivative is 30/α1−40⋅0.001/(0.002−0.001α1)−30/(1−α1)30/\alpha_1 - 40 \cdot 0.001 / (0.002 - 0.001 \alpha_1) - 30/(1 - \alpha_1), and at α1=0.4\alpha_1 = 0.4 it is 75−25−50=075 - 25 - 50 = 0. The 40 shared reads are split 10 to t1t_1 and 30 to t2t_2, because a read that fits both is three times as likely to come from t2t_2 at these values. The molecule fractions are 0.4/1000:0.6/500=1:30.4/1000 : 0.6/500 = 1 : 3, so the TPM values are 250000 and 750000. Two simple rules give other answers. Dropping the shared reads, or splitting them equally, gives the counts 30 and 30 or 50 and 50, and in both cases TPM values of 333333 and 666667. The EM page runs the iteration on these numbers.

A ridge. Two transcripts t1t_1 and t2t_2 have the same effective length, and every read fits both. Then log⁡L\log L depends only on α1+α2\alpha_1 + \alpha_2, and every split of the reads between the two is a maximum. No method can tell how the reads divide, and the EM returns a point on the ridge that depends on where it starts. The gene-level sum is still well defined.

Lengths matter. A transcript of effective length 2000 and one of 500 have the same number of molecules. The first gets four times as many reads, so α=(0.8,0.2)\alpha = (0.8, 0.2), while the molecule fractions are τ=(0.5,0.5)\tau = (0.5, 0.5) and both have the TPM 500000.

Known algorithms

  • EM on reads or on equivalence classes. Li, Ruotti, Stewart, Thomson and Dewey (2010) gave the EM for this model with a noise transcript, and RSEM (2011) added effective lengths, TPM and credibility intervals. kallisto and Salmon run the EM on equivalence classes, which is much faster. See EM isoform quantification.
  • Cufflinks. Trapnell and colleagues (2010) maximize the likelihood of the fragments over the transcripts of each locus, with a fragment length model, and report FPKM. They note that the maximum is unique when the model is identifiable.
  • kallisto. Bray, Pimentel, Melsted and Pachter (2016) find the equivalence class of each read by pseudoalignment and then run the EM on the class counts.
  • Salmon. Patro, Duggal, Love, Irizarry and Kingsford (2017) map the reads, fit bias models, and estimate the abundances with an online phase followed by an EM or variational Bayes phase on equivalence classes. Its mapping step is now selective alignment.
  • Simple rules. Counting only unique reads, or splitting each shared read equally, are fast but biased, as the first example shows. Mortazavi and colleagues (2008) gave an early rule that gave the reads of a multi-mapping group to their places in proportion to the unique reads near each place.
AlgorithmTimeSpacePropertiesCode
EM isoform quantificationO(T·(R+m)) worstO(m) extradeterministicnot exactofflineiterative1 language
PseudoalignmentO(L·(k+m)) worstO(n·(k+m)) extradeterministicnot exactonlineiterative1 language
Selective alignmentO(L·k + h^2 + c·L·(L+b)) worstO(h + L·(L+b)) extradeterministicnot exactonlineiterative1 language

Bounds

  • Concavity. log⁡L\log L is a sum of logarithms of linear functions of α\alpha, so it is concave on the simplex. Every local maximum is a global maximum, and the set of maxima is convex. This is a theorem, stated by Li and colleagues (2010).
  • Uniqueness. The maximum is unique when the vectors (P(r∣t))r(P(r \mid t))_r for the transcripts tt are linearly independent, so that the class probabilities fix α\alpha. If they are not, as in the ridge example, a whole segment of maxima exists. This is a property of the data and no estimator can avoid it.
  • EM. Each EM round costs O(∑e∣e∣)O(\sum_e |e|) time on equivalence classes, and the log-likelihood never decreases. A fixed point of the EM at which every αt>0\alpha_t > 0 is a global maximum, by concavity. Both are theorems, proved on the EM page. In practice the EM needs many rounds when transcripts are almost indistinguishable, which is a measurement, not a bound.
  • Statistical error. Even with a perfect method, the estimate has the sampling error of NN reads, which is large for transcripts with few reads and for isoforms that share most of their sequence.

Reductions

  • To mixture weights. The problem is the maximum likelihood estimate of the weights of a finite mixture whose components P(r∣t)P(r \mid t) are fixed, the classic setting of expectation maximization.
  • To Poisson regression. With counts per exon region, the expected counts are linear in the abundances, and the model becomes a Poisson regression with nonnegative coefficients.
  • From transcript assembly. When the transcripts are not known, transcript assembly or de novo assembly gives them first. StringTie and Cufflinks do both steps.

Applications

  • Isoform-level and gene-level expression tables, the input of differential expression analysis.
  • Changes in isoform use between conditions, where gene-level counts stay the same.
  • Allele-specific expression, with the two alleles of a gene as two transcripts.
  • Expression in species without a genome, against a de novo assembled transcript set.

References

  1. Hui Jiang and Wing Hung Wong, Statistical inferences for isoform expression in RNA-Seq, Bioinformatics 25(8) (2009), pp. 1026 to 1032 (a Poisson model of read counts over exon regions)
  2. Bo Li, Victor Ruotti, Ron M. Stewart, James A. Thomson and Colin N. Dewey, RNA-Seq gene expression estimation with read mapping uncertainty, Bioinformatics 26(4) (2010), pp. 493 to 500, Section 2.2 (the EM algorithm and the concave likelihood)
  3. Bo Li and Colin N. Dewey, RSEM, accurate transcript quantification from RNA-Seq data with or without a reference genome, BMC Bioinformatics 12 (2011), Article 323, Methods (effective length, TPM and credibility intervals)
  4. Cole Trapnell, Brian A. Williams, Geo Pertea, Ali Mortazavi, Gordon Kwan, Marijke J. van Baren, Steven L. Salzberg, Barbara J. Wold and Lior Pachter, Transcript assembly and quantification by RNA-Seq reveals unannotated transcripts and isoform switching during cell differentiation, Nature Biotechnology 28(5) (2010), pp. 511 to 515, Online Methods (the likelihood of the fragments, its unique maximum when the model is identifiable, and FPKM)
  5. Nicolas L. Bray, Harold Pimentel, Páll Melsted and Lior Pachter, Near-optimal probabilistic RNA-seq quantification, Nature Biotechnology 34(5) (2016), pp. 525 to 527 (pseudoalignment and the EM on equivalence classes)
  6. Rob Patro, Geet Duggal, Michael I. Love, Rafael A. Irizarry and Carl Kingsford, Salmon provides fast and bias-aware quantification of transcript expression, Nature Methods 14(4) (2017), pp. 417 to 419 (the bias models and the inference on equivalence classes)
  7. Ali Mortazavi, Brian A. Williams, Kenneth McCue, Lorian Schaeffer and Barbara Wold, Mapping and quantifying mammalian transcriptomes by RNA-Seq, Nature Methods 5(7) (2008), pp. 621 to 628 (RPKM and the reassignment of multireads)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a contract.yaml