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