run_gsea {clustifyr}R Documentation

Run GSEA to compare a gene list(s) to per cell or per cluster expression data

Description

Use fgsea algorithm to compute normalized enrichment scores and pvalues for gene set ovelap

Usage

run_gsea(
  expr_mat,
  query_genes,
  cluster_ids = NULL,
  n_perm = 1000,
  per_cell = FALSE,
  scale = FALSE,
  no_warnings = TRUE
)

Arguments

expr_mat

single-cell expression matrix or Seurat object

query_genes

A vector or named list of vectors of genesets of interest to compare via GSEA. If supplying a named list, then the gene set names will appear in the output.

cluster_ids

vector of cell cluster assignments, supplied as a vector with order that matches columns in expr_mat. Not required if running per cell.

n_perm

Number of permutation for fgsea function. Defaults to 1000.

per_cell

if true run per cell, otherwise per cluster.

scale

convert expr_mat into zscores prior to running GSEA?, default = FALSE

no_warnings

suppress warnings from gsea ties

Value

dataframe of gsea scores (pval, NES), with clusters as rownames

Examples

run_gsea(
    expr_mat = pbmc_matrix_small,
    query_genes = pbmc_vargenes[1:100],
    n_perm = 10,
    cluster_ids = pbmc_meta$classified,
    no_warnings = TRUE
)

[Package clustifyr version 1.2.0 Index]