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