How the isoforms of each gene share its expression
Source:R/rsem_isoform_usage.R
rsem_isoform_usage.RdFor every gene with at least two transcripts, and every sample, describes the split of the gene's
TPM among its transcripts: the share of the dominant transcript, the number of transcripts above a
share, and the Shannon entropy of the shares, with exp(entropy) as the effective number of
isoforms. These are descriptions of one sample; they are not a test of a change of isoform usage
between conditions (see edgeR::catchRSEM(), DRIMSeq or DEXSeq for that).
Usage
rsem_isoform_usage(
x,
tx2gene = attr(x, "tx2gene", exact = TRUE),
min_share = 0.05
)Arguments
- x
A table of transcript TPM made by
rsem_read(level = "isoform", expr = "tpm").- tx2gene
The transcript-to-gene table (
transcript_id,gene_id); by default the attribute thatrsem_read()sets.A transcript counts as expressed when its share is at least this (default 0.05).
Value
A data frame with one row per gene and sample: gene_id, sample_id, n_isoforms
(in the reference), gene_tpm, dominant, dominant_share, n_expressed (shares of at least
min_share), entropy (natural logarithm) and effective_isoforms.
Details
The share of a transcript is its TPM divided by the TPM of its gene (the sum over its
transcripts). When the gene has no TPM in a sample the shares do not exist and every number is NA, not 0.
IsoPct of RSEM is the same share in percent; a gene with one transcript has IsoPct 100 whether it
is expressed or not, and is left out here.
Examples
x <- data.frame(S1 = c(30, 10, 0, 0), S2 = c(0, 0, 0, 5), row.names = c("t1", "t2", "t3", "t4"))
tx <- data.frame(transcript_id = rownames(x), gene_id = c("g1", "g1", "g2", "g2"))
rsem_isoform_usage(x, tx2gene = tx)
#> rsem_isoform_usage: 2 genes with several transcripts, 2 samples; 2 gene-sample pairs without TPM
#> gene_id sample_id n_isoforms gene_tpm dominant dominant_share n_expressed
#> 1 g1 S1 2 40 t1 0.75 2
#> 2 g1 S2 2 0 <NA> NA NA
#> 3 g2 S1 2 0 <NA> NA NA
#> 4 g2 S2 2 5 t4 1.00 1
#> entropy effective_isoforms
#> 1 0.5623351 1.754765
#> 2 NA NA
#> 3 NA NA
#> 4 0.0000000 1.000000