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

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