Entropy-based sample diversity

entropyDiversity(mat, norm = FALSE)

Arguments

mat

A matrix (usually an expression matrix), with genes (features) in rows and samples in columns.

norm

Logical, whether the diversity should be normalized by log2(nrow(mat)).

Value

A vector as long as the column number of the input matrix

References

Martinez and Reyes-Valdes (2008) Defining diversity, specialization, and gene specificity in transcriptomes through information theory. PNAS 105(28):9709--9714

See also

Examples

myMat <- rbind(c(3,4,5),c(6,6,6), c(0,2,4))
entropyDiversity(myMat)
#> [1] 0.9182958 1.4591479 1.5655962
entropyDiversity(myMat, norm=TRUE)
#> [1] 0.5793802 0.9206198 0.9877812

myRandomMat <- matrix(runif(1000), ncol=20)
entropyDiversity(myRandomMat)
#>  [1] 5.471615 5.396532 5.311530 5.427096 5.274963 5.393415 5.357073 5.258416
#>  [9] 5.368650 5.387446 5.426566 5.417680 5.370706 5.279274 5.362626 5.376345
#> [17] 5.470712 5.393161 5.415612 5.377141
entropyDiversity(myRandomMat, norm=TRUE)
#>  [1] 0.9694816 0.9561782 0.9411172 0.9615935 0.9346381 0.9556258 0.9491866
#>  [8] 0.9317063 0.9512380 0.9545682 0.9614996 0.9599253 0.9516022 0.9354019
#> [15] 0.9501706 0.9526014 0.9693217 0.9555808 0.9595588 0.9527424