Skip to contents

Convert expression matrix to GSEA pathway scores (would take a similar place in workflow before average_clusters/binarize)

Usage

calculate_pathway_gsea(
  mat,
  pathway_list,
  n_perm = 1000,
  scale = TRUE,
  no_warnings = TRUE
)

Arguments

mat

expression matrix

pathway_list

a list of vectors, each named for a specific pathway, or dataframe

n_perm

Number of permutation for fgsea function. Defaults to 1000.

scale

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

no_warnings

suppress warnings from gsea ties

Value

matrix of GSEA NES values, cell types as row names, pathways as column names

Examples

gl <- list(
    "n" = c("PPBP", "LYZ", "S100A9"),
    "a" = c("IGLL5", "GNLY", "FTL")
)

pbmc_avg <- average_clusters(
    mat = pbmc_matrix_small,
    metadata = pbmc_meta,
    cluster_col = "classified"
)

calculate_pathway_gsea(
    mat = pbmc_avg,
    pathway_list = gl
)
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |================================================================| 100%
#> 
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |================================================================| 100%
#> 
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |================================================================| 100%
#> 
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |================================================================| 100%
#> 
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |================================================================| 100%
#> 
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |================================================================| 100%
#> 
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |================================================================| 100%
#> 
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |================================================================| 100%
#> 
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |================================================================| 100%
#> 
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |================================================================| 100%
#> 
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |================================================================| 100%
#> 
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |================================================================| 100%
#> 
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |================================================================| 100%
#> 
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |================================================================| 100%
#> 
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |================================================================| 100%
#> 
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |================================================================| 100%
#> 
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |================================================================| 100%
#> 
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |================================================================| 100%
#> 
#>                       n          a
#> Naive CD4 T  -1.1579075 -1.1633110
#> Memory CD4 T -1.2632236 -1.3145221
#> CD14+ Mono    1.5104606  0.9836238
#> B            -1.1353593  1.2163426
#> CD8 T        -1.4018615 -0.5521752
#> FCGR3A+ Mono  0.9800621  1.0993582
#> NK           -1.4049167  1.0580399
#> DC            1.1234128 -0.8697296
#> Platelet      1.8403415  1.2670729