R/caesar_enrichscore.R
CAESAR.enrich.score.RdThis function calculates spot level enrichment scores for a list of pathways based on a cell-gene distance matrix in a Seurat object. The function uses a permutation-based approach to determine the significance of the enrichment scores.
CAESAR.enrich.score(
seu,
pathwaylist,
assay.dist = "distce",
reduction.name = "caesar",
gene.use = NULL,
n_fake = 1001,
seed = 1
)A Seurat object containing the gene expression data.
A list of pathways, where each pathway is represented by a vector of genes.
A character string specifying the assay that contains the distance matrix. Default is "distce".
A character string specifying the reduction method to use if the distance matrix needs to be computed. Default is "caesar".
A character vector specifying which genes to use in the analysis. If NULL, all genes in the distance matrix will be used. Default is NULL.
An integer specifying the number of random permutations to generate for significance testing. Default is 1001.
An integer specifying the random seed for reproducibility. Default is 1.
A matrix of enrichment scores with cells as rows and pathways as columns.
data(toydata)
seu <- toydata$seu
pathway_list <- toydata$pathway_list
enrich.score <- CAESAR.enrich.score(seu, pathway_list)
#> Calculate co-embedding distance...
#> There are 2 pathways. The largest pathway has 48 genes.
#> Pathways with 37 genes finished, which includes 1 pathways, elapsed time is 1s.
#> Pathways with 48 genes finished, which includes 1 pathways, elapsed time is 0.05s.
head(enrich.score)
#> GOBP_VASCULATURE_DEVELOPMENT GOBP_T_CELL_ACTIVATION
#> 24387 0.8761239 0.000000000
#> 4049 0.3816184 0.001998002
#> 11570 0.2707293 0.001998002
#> 25172 0.2807193 0.000999001
#> 32617 0.9280719 0.997002997
#> 13902 0.3096903 0.000000000