Skip to contents

Column-ranks an expression matrix. If stable_genes is provided, uses the stable-genes ranking method (unit-normalised ranks against a small set of stable genes); otherwise standard column ranks. Sets attr(., "stable") so downstream singscore functions know which bounds formula to use.

Usage

calc_singscore_rank(exp, stable_genes = NULL)

Arguments

exp

Numerical matrix. Rows = genes, columns = samples.

stable_genes

Character vector or NULL. Gene names of stable genes. Defaults to NULL (standard ranking).

Value

A rank matrix with the same shape as exp and attr(., "stable") set to TRUE or FALSE.

References

1.) Foroutan et al., BMC Bioinformatics, 2018.; 2.) Bhuva, et al., Nucleic Acids Res., 2020

Examples

# column ranks of an expression matrix, ready for singscore
set.seed(123L)
exp_mat <- matrix(
  rnorm(200 * 10),
  nrow = 200,
  dimnames = list(sprintf("gene_%03i", 1:200), sprintf("sample_%i", 1:10))
)
ranks <- calc_singscore_rank(exp_mat)
dim(ranks)
#> [1] 200  10