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