Score a Matrix by Gene sigs (Signatures). Raw scores are generated with scalop::baseScores (i.e. average expression level of genes in the signature in question). Options to normalise scores either by centering by the average expression level across all genes for each column of <m> (cells/samples) or by subtracting a score from an expression-bin-matched group. The default is the latter.

sigScores(
  m,
  sigs,
  groups = NULL,
  center.rows = TRUE,
  center = T,
  expr.center = T,
  expr.bin.m = NULL,
  expr.bins = NULL,
  expr.sigs = NULL,
  expr.nbin = 30,
  expr.binsize = 100,
  conserved.genes = 0.7,
  replace = F
)

Arguments

m

a non-centered matrix of genes X cells/samples. The matrix will be row-centered internally prior to scoring.

sigs

a character vector of genes or list of character vectors. Sigs will be filtered to remove genes that are missing from rows in <m>.

groups

if scores should be calculated intra-tumour, a list of cell IDs by sample. Default: NULL

center

Only relevant if expr.center = FALSE. If TRUE, normalise the scores by subtracting the mean expression level across all genes (i.e. centering). No scaling is performed. Set to FALSE i f not desired. If expr.center = T and center = T, expr.center takes precedence. Default: T

expr.center

normalise scores by subtracting scores generated from expression-bin-matched sigs. Set to FALSE if not desired. If expr.center = T and center = T, expr.center takes precedence. Default: T

expr.bin.m

if provided, this matrix will be used to bin the genes and generated expression-bin-matched sigs. Only relevant if expr.center = T. If NULL, <m> will be used. Default: NULL

expr.bins

if provided, these bins will be used to generated bin-matched sigs. Useful if you would like to use the same bins across several scoring analyses, or if your bins control for something other than global gene expression levels. Should be a vector of bin IDs with gene names as vector names. If NULL, will be computed from expr.bin.m (see above). Only relevant if expr.center = T. Default: NULL

expr.sigs

if provided, a character vector or list of character vectors of the same length as <sigs>. Scores with expr.sigs will be subtracted from the real group scores. If NULL and expr.center = T, these will be defined internally as expression-bin-matched sigs to correct the scores. Default: NULL

expr.nbin

if expr.center = T and the expr.sigs are to be generated from scratch, the number of desired expression bins. For example, you should make expr.nbin smaller if you have fewer genes, as you would like a good number of bin-matched genes in each bin group. Default: 30

expr.binsize

the number of bin-matched genes to take per gene in each group. Default: 100

conserved.genes

minimum fraction of genes retained in sigs after filtering that is allowed. sigs not passing this cutoff will not be used to score the matrix. This can be ignored if all genes in sigs are present in rownames(<m>). Default: 0.7

replace

if TRUE, the same bin-matched gene can be taken more than once for the control expr.group. Default: F

Value

a dataframe of cell/sample scores. Has the same number of rows as there are columns in <m> and the same number of columns as there are sigs to score (assumming no sigs are filtered out because of missing genes).