Adds module activity scores to a Seurat object based on gene partitions and optionally smooths scores locally.

AddModuleActivityScore(
  srat,
  gene_partition,
  assay = "RNA",
  do_local_smooth = FALSE,
  knn = 10,
  major_vote = 6,
  nloop = 100,
  module_names = NULL
)

Arguments

srat

Seurat object; the single-cell RNA-seq data.

gene_partition

factor; the gene modules.

assay

character; the assay used for calculating module score. Default is "RNA".

do_local_smooth

logical; if TRUE, smooths the module score for each cell by its neighborhoods. Default is FALSE.

knn

integer; the neighborhood size for local smoothing. Default is 10.

major_vote

integer; the majority vote number for local smoothing. Default is 6.

nloop

integer; the number of sampling iterations. Default is 100.

module_names

character vector; the prefix name for each gene module. If NULL, default names are used.

Value

A Seurat object with module activity scores added to the metadata.

Details

This function computes module activity scores for gene partitions in a Seurat object. It allows for optional local smoothing of the scores based on neighborhood information.