calculate_entropy: Calculate entropy for a vector of transcript-level expression...

Description Usage Arguments Details Value Examples

View source: R/diversity_functions.R

Description

Calculate entropy for a vector of transcript-level expression values of one gene.

Usage

1
calculate_entropy(x, norm = TRUE, pseudocount = 0)

Arguments

x

Vector of expression values.

norm

If TRUE, the entropy values are normalized to the number of transcripts for each gene. The normalized entropy values are always between 0 and 1. If FALSE, genes cannot be compared to each other, due to possibly different maximum entropy values.

pseudocount

Pseudocount added to each transcript expression value. Default is 0, while Laplace entropy uses a pseudocount of 1.

Details

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.

Value

A single gene-level entropy value.

Examples

1
2
3
4
5
6
7
# 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)

esebesty/SplicingFactory documentation built on Feb. 27, 2022, 12:08 a.m.