labeled inverse average expression: relative frequency

iae_rf(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} = log(1+\frac{mean(N_{i,j\in D})}{max(mean(N_{i,j\in \hat D}))+ e^{-8}})$$ 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_rf(data, label = sample(c("A", "B"), 10, replace = TRUE))
#>            B         B         A         B         A         B         A
#> 1  0.6418539 0.6418539 0.7472144 0.6418539 0.7472144 0.6418539 0.7472144
#> 2  0.9162907 0.9162907 0.5108256 0.9162907 0.5108256 0.9162907 0.5108256
#> 3  0.5260931 0.5260931 0.8938179 0.5260931 0.8938179 0.5260931 0.8938179
#> 4  1.0414539 1.0414539 0.4353181 1.0414539 0.4353181 1.0414539 0.4353181
#> 5  0.6190392 0.6190392 0.7731899 0.6190392 0.7731899 0.6190392 0.7731899
#> 6  0.8109302 0.8109302 0.5877867 0.8109302 0.5877867 0.8109302 0.5877867
#> 7  0.6931472 0.6931472 0.6931472 0.6931472 0.6931472 0.6931472 0.6931472
#> 8  0.5596158 0.5596158 0.8472979 0.5596158 0.8472979 0.5596158 0.8472979
#> 9  0.3429447 0.3429447 1.2367626 0.3429447 1.2367626 0.3429447 1.2367626
#> 10 0.5877867 0.5877867 0.8109302 0.5877867 0.8109302 0.5877867 0.8109302
#>            A         A         A
#> 1  0.7472144 0.7472144 0.7472144
#> 2  0.5108256 0.5108256 0.5108256
#> 3  0.8938179 0.8938179 0.8938179
#> 4  0.4353181 0.4353181 0.4353181
#> 5  0.7731899 0.7731899 0.7731899
#> 6  0.5877867 0.5877867 0.5877867
#> 7  0.6931472 0.6931472 0.6931472
#> 8  0.8472979 0.8472979 0.8472979
#> 9  1.2367626 1.2367626 1.2367626
#> 10 0.8109302 0.8109302 0.8109302