Entropy-based gene-expression specificity

entropySpecificity(mat, norm = FALSE)

Arguments

mat

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

norm

Logical, whether the specificity should be normalized by log2(ncol(mat)).

Value

A vector of the length of the row number of the input matrix, namely the specificity score of genes.

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))
entropySpecificity(myMat)
#> [1] 0.00000000 0.03168154 0.62372590
entropySpecificity(myMat, norm=TRUE)
#> [1] 0.00000000 0.01998883 0.39352723

myRandomMat <- matrix(runif(1000), ncol=20)
entropySpecificity(myRandomMat)
#>  [1] 0.4734984 0.2292974 0.2268135 0.3919452 0.3339594 0.1957019 0.4519255
#>  [8] 0.2698869 0.2345754 0.3638077 0.3314800 0.3449184 0.2647697 0.3102982
#> [15] 0.1483810 0.3911850 0.1488267 0.3080968 0.1274874 0.2892327 0.3329632
#> [22] 0.1512100 0.2043834 0.1252499 0.2457518 0.1220473 0.3991334 0.2337664
#> [29] 0.3587629 0.2058470 0.4324957 0.3353806 0.3400223 0.2606774 0.2588615
#> [36] 0.2817851 0.2206203 0.1581032 0.2744203 0.4356452 0.2706423 0.3533230
#> [43] 0.2215322 0.2190592 0.2305404 0.1917310 0.3701828 0.2835171 0.2268321
#> [50] 0.2294353
entropySpecificity(myRandomMat, norm=TRUE)
#>  [1] 0.10955720 0.05305442 0.05247969 0.09068757 0.07727093 0.04528115
#>  [7] 0.10456572 0.06244594 0.05427565 0.08417717 0.07669725 0.07980661
#> [13] 0.06126194 0.07179624 0.03433212 0.09051168 0.03443526 0.07128688
#> [19] 0.02949780 0.06692214 0.07704043 0.03498670 0.04728988 0.02898009
#> [25] 0.05686161 0.02823909 0.09235077 0.05408845 0.08300992 0.04762852
#> [31] 0.10007007 0.07759978 0.07867374 0.06031508 0.05989491 0.06519894
#> [37] 0.05104672 0.03658163 0.06349488 0.10079882 0.06262073 0.08175124
#> [43] 0.05125771 0.05068554 0.05334204 0.04436238 0.08565225 0.06559968
#> [49] 0.05248401 0.05308632