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