gene_het {SCEnt}R Documentation

Find the Heterogeneity of a Gene Within a Population

Description

Find the Heterogeneity of a Gene Within a Population

Usage

gene_het(expr, unit = "log2", normalise = TRUE, transpose = FALSE)

Arguments

expr

A vector or matrix of gene expressions. For the matrix, genes should be represented as rows and cells as columns.

unit

The units to be parsed to the entropy function.

normalise

A logical value representing whether the gene frequencies should be normalised into a distribution.

transpose

A logical value representing whether the matrix should be transposed before any calculations are performed.

Value

A vector of the information gained from the gene distribution compared to the uniform distribution. The higher the value more heterogeneous the cell is within the population.

Examples

#Creating Data
gene1 <- c(0,0,0,0,1,2,3)
gene2 <- c(5,5,3,2,0,0,0)
gene3 <- c(2,0,2,1,3,0,1)
gene4 <- c(3,3,3,3,3,3,3)
gene5 <- c(0,0,0,0,5,0,0)
gene_counts <- matrix(c(gene1,gene2,gene3,gene4,gene5), ncol = 5)
rownames(gene_counts) <- paste0("cell",1:7)
colnames(gene_counts) <- paste0("gene",1:5)

#Calculating Heterogeneity For Each Gene
gene_het(gene1)
gene_het(gene2)
gene_het(gene3)
gene_het(gene4)
gene_het(gene5)

#Calculating Heterogeneity For a Matrix
gene_het(gene_counts)

[Package SCEnt version 0.0.1 Index]