labeled inverse average expression: probability based

iae_prob(expr, features = NULL, label, multi = TRUE, thres = 0)

Arguments

expr

a matrix, features in row and cells in column

features

vector, feature names or indexes to compute

label

vector, group label of each cell

multi

logical, if to compute based on binary (FALSE) or multi-class (TRUE)

thres

numeric, cell only counts when expr > threshold, default 0

Value

a matrix of inverse average expression score

Details

$$\mathbf{IAE_{i,j}} = log(1+\frac{mean(N_{i,j\in D})}{max(mean(N_{i,j\in \hat D}))+ e^{-8}}*mean(N_{i,j\in D}))$$ where \(N_{i,j\in D}\) is the counts of feature \(i\) in cell \(j\) within class \(D\), and \(\hat D\) is the class except \(D\).

Examples

data <- matrix(rpois(100, 2), 10, dimnames = list(1:10))
smartid:::iae_prob(data, label = sample(c("A", "B"), 10, replace = TRUE))
#>            B         B         B         B         B          A         B
#> 1  0.6731064 0.6731064 0.6731064 0.6731064 0.6731064 2.03885626 0.6731064
#> 2  1.0479686 1.0479686 1.0479686 1.0479686 1.0479686 0.85441532 1.0479686
#> 3  1.1260113 1.1260113 1.1260113 1.1260113 1.1260113 1.52605630 1.1260113
#> 4  0.8040479 0.8040479 0.8040479 0.8040479 0.8040479 1.39562568 0.8040479
#> 5  1.0216512 1.0216512 1.0216512 1.0216512 1.0216512 0.55961578 1.0216512
#> 6  1.4377265 1.4377265 1.4377265 1.4377265 1.4377265 1.16498736 1.4377265
#> 7  2.4567358 2.4567358 2.4567358 2.4567358 2.4567358 0.44628710 2.4567358
#> 8  1.8632184 1.8632184 1.8632184 1.8632184 1.8632184 0.05218575 1.8632184
#> 9  1.0348965 1.0348965 1.0348965 1.0348965 1.0348965 0.39348891 1.0348965
#> 10 1.7013754 1.7013754 1.7013754 1.7013754 1.7013754 1.23969088 1.7013754
#>             A          A          A
#> 1  2.03885626 2.03885626 2.03885626
#> 2  0.85441532 0.85441532 0.85441532
#> 3  1.52605630 1.52605630 1.52605630
#> 4  1.39562568 1.39562568 1.39562568
#> 5  0.55961578 0.55961578 0.55961578
#> 6  1.16498736 1.16498736 1.16498736
#> 7  0.44628710 0.44628710 0.44628710
#> 8  0.05218575 0.05218575 0.05218575
#> 9  0.39348891 0.39348891 0.39348891
#> 10 1.23969088 1.23969088 1.23969088