sig_score: Compute gene signature scores

View source: R/sig_score.R

sig_scoreR Documentation

Compute gene signature scores

Description

Compute gene signature scores for a matrix, returning one score per column. The scoring procedure is that used in Tirosh et al. 2016 (https://www.nature.com/articles/nature20123). This function is a simplified version of the sigScores function from the scalop package (https://github.com/jlaffy/scalop).

Usage

sig_score(
  mat,
  sig,
  nbin = nrow(mat)%/%110,
  n = 100,
  replace = FALSE,
  return_control_sets = FALSE,
  cap = c(-Inf, Inf)
)

Arguments

mat

A matrix with genes for rows and samples for columns.

sig

A character vector of signature genes.

nbin

The number of expression bins into which to divide the genes.

n

The number of control genes to sample for each gene. Should be less than or equal to nrow(mat)/nbin.

replace

Logical indicating whether to sample with replacement. Default: FALSE.

return_control_sets

Logical indicating whether to return the control genes. Default: FALSE.

cap

Numeric vector of length 2 specifying limits for relative expression levels of signature genes. Values outside this interval will be shrunk to the maximum/minimum. Default: c(-Inf, Inf).

Value

If return_control_sets is FALSE, a vector of scores with length equal to ncol(mat). If return_control_sets is TRUE, a list with three elements: scores, a vector of scores with length equal to ncol(mat); controls, a list of the control gene sets used for each gene in sig; and comparable_gene_sets, a list of length n and a rearrangement of controls, each element being a vector of genes with comparable expression levels to those in sig (this is redundant but possibly helpful).


m20ty/matkot documentation built on July 1, 2023, 8:11 p.m.