View source: R/diversity_functions.R
calculate_simpson | R Documentation |
#' Calculate Simpson index for a vector of transcript-level expression values of one gene.
calculate_simpson(x)
x |
Vector of expression values. |
The function calculates a Simpson index as part of different diversity calculations. Given a vector of transcript-level expression values of a gene, this function characterize the diversity of splicing isoforms for a gene. If there only one single transcript, the resulted index will be NaN, as diversity cannot be calculated. If the expression of the given gene is 0, the diversity index will be NA.
A single gene-level Simpson index.
# read counts for the transcripts of a single gene with 5 transcripts x <- rnbinom(5, size = 10, prob = 0.4) # calculate Simpson index simpson <- calculate_simpson(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.