Function to convert a single-cell count matrix and a corresponding single-cell cluster vector into a rank matrix that can be used with the Rank enrichment option.

makeSignMatrixRank(
  sc_matrix,
  sc_cluster_ids,
  ties_method = c("random", "max"),
  gobject = NULL
)

Arguments

sc_matrix

matrix of single-cell RNAseq expression data

sc_cluster_ids

vector of cluster ids

ties_method

how to handle rank ties

gobject

if giotto object is given then only genes present in both datasets will be considered

Value

matrix

See also

rankEnrich

Examples

sign_gene <- c(
    "Bcl11b", "Lmo1", "F3", "Cnih3", "Ppp1r3c", "Rims2", "Gfap",
    "Gjc3", "Chrna4", "Prkcd", "Prr18", "Grb14", "Tprn", "Clic1", "Olig2",
    "Hrh3", "Tmbim1", "Carhsp1", "Tmem88b", "Ugt8a", "Arpp19", "Lamp5",
    "Galnt6", "Hlf", "Hs3st2", "Tbr1", "Myl4", "Cygb", "Ttc9b", "Ipcef1"
)

sign_matrix <- matrix(rnorm(length(sign_gene) * 3), nrow = length(sign_gene))
rownames(sign_matrix) <- sign_gene
colnames(sign_matrix) <- c("cell_type1", "cell_type2", "cell_type3")

makeSignMatrixRank(
    sc_matrix = sign_matrix,
    sc_cluster_ids = c("cell_type1", "cell_type2", "cell_type3")
)
#> Warning: NaNs produced
#> 30 x 3 Matrix of class "dgeMatrix"
#>         cell_type1 cell_type2 cell_type3
#> Bcl11b           8         26         19
#> Lmo1             6          7         29
#> F3              13         21         14
#> Cnih3           23         10         12
#> Ppp1r3c         10         11         23
#> Rims2            1         30          1
#> Gfap             2         29          2
#> Gjc3            15         28          9
#> Chrna4          18         27          5
#> Prkcd           25         12          6
#> Prr18            3         16         30
#> Grb14           26          1         28
#> Tprn            11          5         26
#> Clic1           19         20          8
#> Olig2            7         19         22
#> Hrh3            20          6         18
#> Tmbim1          28          3         13
#> Carhsp1         17          8         21
#> Tmem88b         29          4         17
#> Ugt8a           27          2         27
#> Arpp19          22         23          4
#> Lamp5            4         22         25
#> Galnt6           9         15         24
#> Hlf             24         17          3
#> Hs3st2          14         24         11
#> Tbr1            16         13         16
#> Myl4             5         25         20
#> Cygb            21         14         10
#> Ttc9b           30          9          7
#> Ipcef1          12         18         15