View source: R/diversity_functions.R
calculate_entropy | R Documentation |
Calculate entropy for a vector of transcript-level expression values of one gene.
calculate_entropy(x, norm = TRUE, pseudocount = 0)
x |
Vector of expression values. |
norm |
If |
pseudocount |
Pseudocount added to each transcript expression value. Default is 0, while Laplace entropy uses a pseudocount of 1. |
The function calculates an entropy value as part of different diversity calculations. Given a vector of transcript-level expression values of a gene, this function characterizes the diversity of splicing isoforms for a gene. If there only a single transcript, the diversity value will be NaN, as it cannot be calculated. If the expression of the given gene is 0, the diversity value will be NA.
A single gene-level entropy value.
# read counts for the transcripts of a single gene with 5 transcripts x <- rnbinom(5, size = 10, prob = 0.4) # calculate non-normalized naive entropy value entropy <- calculate_entropy(x, norm = FALSE) # calculate Laplace-entropy, also normalized for transcript number # (the default) norm_laplace_entropy <- calculate_entropy(x, pseudocount = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.