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