Source: https://github.com/markziemann/enrichment_recipe

Introduction

Load libraries and dataset.

tbl <- readRDS("scDEres.Rds")

suppressPackageStartupMessages({
  library("getDEE2")
  library("DESeq2")
  library("kableExtra")
  library("clusterProfiler")
  library("fgsea")
  library("eulerr")
  library("gplots")
})
ora <- function(fg,bg,genesets,n_pw=10,mincount=5) {

ora_res <- as.data.frame(enricher(gene = fg ,
  universe = bg,  maxGSSize = 5000, TERM2GENE = genesets,
  pAdjustMethod="fdr",  pvalueCutoff = 1, qvalueCutoff = 1  ))

if ( nrow(ora_res > 1 ) ) {

ora_res$geneID <- NULL
ora_res <- subset(ora_res,p.adjust<0.05 & Count >=mincount)
ora_res_sets <- rownames(ora_res)

gr <- as.numeric(sapply(strsplit(ora_res$GeneRatio,"/"),"[[",1)) /
  as.numeric(sapply(strsplit(ora_res$GeneRatio,"/"),"[[",2))

br <- as.numeric(sapply(strsplit(ora_res$BgRatio,"/"),"[[",1)) /
  as.numeric(sapply(strsplit(ora_res$BgRatio,"/"),"[[",2))

ora_res$es <- gr/br
ora_res <- ora_res[order(-ora_res$es),]
ora_res$Description=NULL
return(ora_res)
}

}

orafix <- function(fg,bg,genesets,n_pw=10,mincount=5) {

bgdf <- data.frame("background",bg)
colnames(bgdf) <- c("term","gene")
genesets_fix <- rbind(genesets,bgdf)

ora_res <- as.data.frame(enricher(gene = fg ,
  universe = bg,  maxGSSize = 5000, TERM2GENE = genesets_fix,
  pAdjustMethod="fdr",  pvalueCutoff = 1, qvalueCutoff = 1  ))

if ( nrow(ora_res > 1 ) ) {

ora_res$geneID <- NULL
ora_res <- subset(ora_res,p.adjust<0.05 & Count >=mincount)
ora_res_sets <- rownames(ora_res)

gr <- as.numeric(sapply(strsplit(ora_res$GeneRatio,"/"),"[[",1)) /
  as.numeric(sapply(strsplit(ora_res$GeneRatio,"/"),"[[",2))

br <- as.numeric(sapply(strsplit(ora_res$BgRatio,"/"),"[[",1)) /
  as.numeric(sapply(strsplit(ora_res$BgRatio,"/"),"[[",2))

ora_res$es <- gr/br
ora_res <- ora_res[order(-ora_res$es),]
ora_res$Description=NULL
return(ora_res)
}

}

For this report I will use a SingleCellExperiment (SCE) containing 10x droplet-based scRNA-seq PBCM data from 8 Lupus patients obtained before and after 6h-treatment with IFN-β (Kang et al. 2018).

The complete raw data, as well as gene and cell metadata is available through the NCBI GEO, accession number GSE96583.

Downstream analysis was done according to the vignette from Seurat. Link: https://satijalab.org/seurat/archive/v3.1/immune_alignment.html

names(tbl)
##  [1] "CD14 Mono"    "pDC"          "CD4 Memory T" "T activated"  "CD4 Naive T" 
##  [6] "CD8 T"        "Mk"           "B Activated"  "B"            "DC"          
## [11] "CD16 Mono"    "NK"           "Eryth"        "HSPC"
message("Total detected genes in each cluster and differentially expressed")
## Total detected genes in each cluster and differentially expressed
x <- lapply(tbl, function(x) {
  nsig <- nrow(subset(x,p_val_adj<0.05))
  ntot <- nrow(x)
  c(ntot,nsig)
} )

x
## $`CD14 Mono`
## [1] 1411 1388
## 
## $pDC
## [1] 2183   92
## 
## $`CD4 Memory T`
## [1] 553 261
## 
## $`T activated`
## [1] 892 123
## 
## $`CD4 Naive T`
## [1] 529 336
## 
## $`CD8 T`
## [1] 635 165
## 
## $Mk
## [1] 1042   43
## 
## $`B Activated`
## [1] 863 125
## 
## $B
## [1] 815 297
## 
## $DC
## [1] 1636  661
## 
## $`CD16 Mono`
## [1] 1266  773
## 
## $NK
## [1] 812 180
## 
## $Eryth
## [1] 1422   10
## 
## $HSPC
## [1] 2763    0
x <- do.call(rbind,x)
colnames(x) <- c("ngenes","nsig")
x <- as.data.frame(x)

x <- subset(x,ngenes>=800 & nsig>=100)

x
##             ngenes nsig
## CD14 Mono     1411 1388
## T activated    892  123
## B Activated    863  125
## B              815  297
## DC            1636  661
## CD16 Mono     1266  773
## NK             812  180
x <- rownames(x)

tbl <- tbl[names(tbl) %in% x]

str(tbl)
## List of 7
##  $ CD14 Mono  :'data.frame': 1411 obs. of  5 variables:
##   ..$ p_val     : num [1:1411] 0 0 0 0 0 0 0 0 0 0 ...
##   ..$ avg_log2FC: num [1:1411] 2.37 6.33 3.33 -1.82 2.32 ...
##   ..$ pct.1     : num [1:1411] 0.532 1 0.996 0.504 0.696 0.904 0.686 0.698 0.69 0.644 ...
##   ..$ pct.2     : num [1:1411] 0.007 0.326 0.288 0.899 0.039 0.308 0.085 0.111 0.026 0.012 ...
##   ..$ p_val_adj : num [1:1411] 0 0 0 0 0 0 0 0 0 0 ...
##  $ T activated:'data.frame': 892 obs. of  5 variables:
##   ..$ p_val     : num [1:892] 2.54e-86 6.42e-86 2.19e-75 1.27e-69 1.08e-68 ...
##   ..$ avg_log2FC: num [1:892] 3.88 4.15 3.91 3.25 3.67 ...
##   ..$ pct.1     : num [1:892] 0.977 0.883 0.803 0.764 0.761 0.751 0.764 0.68 0.741 0.845 ...
##   ..$ pct.2     : num [1:892] 0.323 0.035 0.025 0.018 0.032 0.032 0.074 0.039 0.103 0.33 ...
##   ..$ p_val_adj : num [1:892] 3.57e-82 9.02e-82 3.07e-71 1.79e-65 1.51e-64 ...
##  $ B Activated:'data.frame': 863 obs. of  5 variables:
##   ..$ p_val     : num [1:863] 1.20e-72 2.83e-69 3.03e-62 4.63e-58 6.25e-52 ...
##   ..$ avg_log2FC: num [1:863] 4.91 3.53 4.5 3.77 3.62 ...
##   ..$ pct.1     : num [1:863] 1 1 0.864 0.851 0.801 0.747 0.765 0.778 0.633 0.633 ...
##   ..$ pct.2     : num [1:863] 0.188 0.482 0 0.036 0.041 0.051 0.086 0.137 0 0.005 ...
##   ..$ p_val_adj : num [1:863] 1.69e-68 3.98e-65 4.26e-58 6.51e-54 8.78e-48 ...
##  $ B          :'data.frame': 815 obs. of  5 variables:
##   ..$ p_val     : num [1:815] 2.19e-155 4.04e-151 3.41e-149 2.91e-146 1.08e-137 ...
##   ..$ avg_log2FC: num [1:815] 4.6 4.51 4.24 2.94 4.13 ...
##   ..$ pct.1     : num [1:815] 0.998 0.966 0.966 1 0.913 0.912 0.897 0.794 0.789 1 ...
##   ..$ pct.2     : num [1:815] 0.241 0.053 0.08 0.674 0.033 0.113 0.153 0.023 0.035 1 ...
##   ..$ p_val_adj : num [1:815] 3.08e-151 5.67e-147 4.79e-145 4.09e-142 1.51e-133 ...
##  $ DC         :'data.frame': 1636 obs. of  5 variables:
##   ..$ p_val     : num [1:1636] 6.58e-95 2.14e-94 5.48e-94 5.48e-94 6.41e-94 ...
##   ..$ avg_log2FC: num [1:1636] 5.21 5.19 4.86 5.12 7.39 ...
##   ..$ pct.1     : num [1:1636] 0.991 0.987 0.991 0.982 0.982 0.978 1 0.969 1 0.969 ...
##   ..$ pct.2     : num [1:1636] 0.022 0.018 0.026 0.015 0.011 0.011 0.089 0.007 0.144 0.041 ...
##   ..$ p_val_adj : num [1:1636] 9.24e-91 3.00e-90 7.70e-90 7.70e-90 9.01e-90 ...
##  $ CD16 Mono  :'data.frame': 1266 obs. of  5 variables:
##   ..$ p_val     : num [1:1266] 2.99e-189 5.24e-178 5.09e-177 4.31e-176 2.52e-173 ...
##   ..$ avg_log2FC: num [1:1266] 4.81 5.23 3.91 3.84 3.02 ...
##   ..$ pct.1     : num [1:1266] 1 1 0.993 1 1 0.973 0.998 0.955 1 1 ...
##   ..$ pct.2     : num [1:1266] 0.093 0.487 0.311 0.447 0.648 0.166 0.375 0.081 0.416 0.482 ...
##   ..$ p_val_adj : num [1:1266] 4.21e-185 7.36e-174 7.15e-173 6.06e-172 3.54e-169 ...
##  $ NK         :'data.frame': 812 obs. of  5 variables:
##   ..$ p_val     : num [1:812] 3.33e-104 2.70e-101 2.42e-96 3.76e-90 1.26e-85 ...
##   ..$ avg_log2FC: num [1:812] 4.31 4.31 3.2 4.07 4.43 ...
##   ..$ pct.1     : num [1:812] 0.969 0.988 0.991 0.868 0.843 0.895 0.954 0.797 0.735 0.763 ...
##   ..$ pct.2     : num [1:812] 0.099 0.317 0.469 0.036 0.04 0.119 0.363 0.142 0.122 0.162 ...
##   ..$ p_val_adj : num [1:812] 4.68e-100 3.79e-97 3.40e-92 5.29e-86 1.77e-81 ...
head(tbl[["CD4 T cells"]])  %>%
  kbl(caption="Example of muscat dataset. Control vs IFN-beta treatment") %>%
  kable_paper("hover", full_width = F)
Example of muscat dataset. Control vs IFN-beta treatment

KEGG pathway analysis

In the next sections I will run enrichment analysis with over-representation analysis (ORA) test and compare it to functional class scoring. I will also investigate some strange behviour of the ORA tool clusterprofiler.

ORA with Clusterprofiler custom background with otherwise default analysis

I’ve compiled a reporting checklist:

Reporting criteria Method/resource used
Origin of gene sets KEGG (2023-06-16)
Tool used ClusterProfiler (check version at foot of report)
Statistical test used hypergeometric test
P-value correction for multiple comparisons FDR method
Background list As defined by Seurat
Gene Selection Criteria Seurat FDR<0.05
ORA directionality Separate tests for up- and down-regulation
Data availability SeuratData ifnb
Other parameters Min gene set size of 5

Here I provide a custom background gene list.

Get the gene sets loaded in R. These are KEGG gene sets

# from https://www.gsea-msigdb.org/gsea/msigdb/human/collections.jsp 16th June 2023
genesets2 <- read.gmt("../ref/c2.cp.kegg.v2023.1.Hs.symbols.gmt")
gsets <- gmtPathways("../ref/c2.cp.kegg.v2023.1.Hs.symbols.gmt")

message(paste("number of genes described in the annotation set:",length(unique(genesets2$gene))))
## number of genes described in the annotation set: 5244

Now filter the gene names into three lists, up-regulated, down-regulated and background. Background is simply all genes that were detected.

def <- lapply(tbl , function(x) {
  bg <- unique(rownames(x))
  up <- unique(rownames(subset(x,p_val_adj<0.05 & avg_log2FC>0)))
  dn <- unique(rownames(subset(x,p_val_adj<0.05 & avg_log2FC<0)))
  return(list("bg"=bg,"up"=up,"dn"=dn))
} )

str(def)
## List of 7
##  $ CD14 Mono  :List of 3
##   ..$ bg: chr [1:1411] "HES4" "ISG15" "IFI6" "MARCKSL1" ...
##   ..$ up: chr [1:505] "HES4" "ISG15" "IFI6" "IFI44L" ...
##   ..$ dn: chr [1:883] "MARCKSL1" "RPL15" "IL8" "CD14" ...
##  $ T activated:List of 3
##   ..$ bg: chr [1:892] "ISG15" "IFIT3" "IFIT1" "RSAD2" ...
##   ..$ up: chr [1:113] "ISG15" "IFIT3" "IFIT1" "RSAD2" ...
##   ..$ dn: chr [1:10] "FTH1" "RGCC" "TUBA4A" "PRR7" ...
##  $ B Activated:List of 3
##   ..$ bg: chr [1:863] "ISG15" "ISG20" "IFIT3" "IFI6" ...
##   ..$ up: chr [1:103] "ISG15" "ISG20" "IFIT3" "IFI6" ...
##   ..$ dn: chr [1:22] "RPL10" "RPS3" "EEF1A1" "RPL3" ...
##  $ B          :List of 3
##   ..$ bg: chr [1:815] "ISG15" "IFIT3" "IFI6" "ISG20" ...
##   ..$ up: chr [1:190] "ISG15" "IFIT3" "IFI6" "ISG20" ...
##   ..$ dn: chr [1:107] "GSTP1" "RPL10" "EEF1A1" "RPL7" ...
##  $ DC         :List of 3
##   ..$ bg: chr [1:1636] "IFIT3" "TNFSF10" "RSAD2" "IFIT1" ...
##   ..$ up: chr [1:399] "IFIT3" "TNFSF10" "RSAD2" "IFIT1" ...
##   ..$ dn: chr [1:262] "RPL6" "RPL7" "RPL15" "PFN1" ...
##  $ CD16 Mono  :List of 3
##   ..$ bg: chr [1:1266] "IFIT1" "ISG15" "IFIT3" "ISG20" ...
##   ..$ up: chr [1:410] "IFIT1" "ISG15" "IFIT3" "ISG20" ...
##   ..$ dn: chr [1:363] "FTH1" "ACTB" "PFN1" "TMSB4X" ...
##  $ NK         :List of 3
##   ..$ bg: chr [1:812] "IFI6" "ISG15" "ISG20" "IFIT1" ...
##   ..$ up: chr [1:135] "IFI6" "ISG15" "ISG20" "IFIT1" ...
##   ..$ dn: chr [1:45] "RPL7" "RPL10" "CYBA" "RPS2" ...

Enrichment firstly with upregulated genes

ups <- lapply(1:length(def),function(i) {
  ora(def[[i]]$up,def[[i]]$bg,genesets=genesets2)
})

up_sets <- unlist(lapply(1:length(ups) , function(i) {
  nm <- names(def)[[i]]
  sets <- ups[[i]]$ID
  if ( length(sets) >0 ) { paste(nm,sets) }
} ) )

length(up_sets)
## [1] 46
up_sets
##  [1] "CD14 Mono KEGG_RIG_I_LIKE_RECEPTOR_SIGNALING_PATHWAY"       
##  [2] "CD14 Mono KEGG_ALLOGRAFT_REJECTION"                         
##  [3] "CD14 Mono KEGG_AUTOIMMUNE_THYROID_DISEASE"                  
##  [4] "CD14 Mono KEGG_ANTIGEN_PROCESSING_AND_PRESENTATION"         
##  [5] "CD14 Mono KEGG_CYTOSOLIC_DNA_SENSING_PATHWAY"               
##  [6] "CD14 Mono KEGG_GRAFT_VERSUS_HOST_DISEASE"                   
##  [7] "CD14 Mono KEGG_TYPE_I_DIABETES_MELLITUS"                    
##  [8] "CD14 Mono KEGG_INTESTINAL_IMMUNE_NETWORK_FOR_IGA_PRODUCTION"
##  [9] "CD14 Mono KEGG_CELL_ADHESION_MOLECULES_CAMS"                
## [10] "CD14 Mono KEGG_NOD_LIKE_RECEPTOR_SIGNALING_PATHWAY"         
## [11] "CD14 Mono KEGG_APOPTOSIS"                                   
## [12] "CD14 Mono KEGG_CYTOKINE_CYTOKINE_RECEPTOR_INTERACTION"      
## [13] "CD14 Mono KEGG_CHEMOKINE_SIGNALING_PATHWAY"                 
## [14] "CD14 Mono KEGG_TOLL_LIKE_RECEPTOR_SIGNALING_PATHWAY"        
## [15] "T activated KEGG_ANTIGEN_PROCESSING_AND_PRESENTATION"       
## [16] "B KEGG_CHEMOKINE_SIGNALING_PATHWAY"                         
## [17] "B KEGG_ANTIGEN_PROCESSING_AND_PRESENTATION"                 
## [18] "DC KEGG_RIG_I_LIKE_RECEPTOR_SIGNALING_PATHWAY"              
## [19] "DC KEGG_NATURAL_KILLER_CELL_MEDIATED_CYTOTOXICITY"          
## [20] "DC KEGG_CYTOSOLIC_DNA_SENSING_PATHWAY"                      
## [21] "DC KEGG_ANTIGEN_PROCESSING_AND_PRESENTATION"                
## [22] "DC KEGG_ALLOGRAFT_REJECTION"                                
## [23] "DC KEGG_AUTOIMMUNE_THYROID_DISEASE"                         
## [24] "DC KEGG_JAK_STAT_SIGNALING_PATHWAY"                         
## [25] "DC KEGG_TOLL_LIKE_RECEPTOR_SIGNALING_PATHWAY"               
## [26] "DC KEGG_TYPE_I_DIABETES_MELLITUS"                           
## [27] "DC KEGG_CELL_ADHESION_MOLECULES_CAMS"                       
## [28] "DC KEGG_GRAFT_VERSUS_HOST_DISEASE"                          
## [29] "DC KEGG_CYTOKINE_CYTOKINE_RECEPTOR_INTERACTION"             
## [30] "DC KEGG_ENDOCYTOSIS"                                        
## [31] "DC KEGG_CHEMOKINE_SIGNALING_PATHWAY"                        
## [32] "CD16 Mono KEGG_ALLOGRAFT_REJECTION"                         
## [33] "CD16 Mono KEGG_AUTOIMMUNE_THYROID_DISEASE"                  
## [34] "CD16 Mono KEGG_ANTIGEN_PROCESSING_AND_PRESENTATION"         
## [35] "CD16 Mono KEGG_GRAFT_VERSUS_HOST_DISEASE"                   
## [36] "CD16 Mono KEGG_RIG_I_LIKE_RECEPTOR_SIGNALING_PATHWAY"       
## [37] "CD16 Mono KEGG_TYPE_I_DIABETES_MELLITUS"                    
## [38] "CD16 Mono KEGG_INTESTINAL_IMMUNE_NETWORK_FOR_IGA_PRODUCTION"
## [39] "CD16 Mono KEGG_NOD_LIKE_RECEPTOR_SIGNALING_PATHWAY"         
## [40] "CD16 Mono KEGG_CELL_ADHESION_MOLECULES_CAMS"                
## [41] "CD16 Mono KEGG_SYSTEMIC_LUPUS_ERYTHEMATOSUS"                
## [42] "CD16 Mono KEGG_ENDOCYTOSIS"                                 
## [43] "CD16 Mono KEGG_CYTOKINE_CYTOKINE_RECEPTOR_INTERACTION"      
## [44] "CD16 Mono KEGG_CHEMOKINE_SIGNALING_PATHWAY"                 
## [45] "NK KEGG_ANTIGEN_PROCESSING_AND_PRESENTATION"                
## [46] "NK KEGG_NATURAL_KILLER_CELL_MEDIATED_CYTOTOXICITY"

Now repeat with the downregulated genes

dns <- lapply(1:length(def),function(i) {
  ora(def[[i]]$dn,def[[i]]$bg,genesets=genesets2)
})

dn_sets <- unlist(lapply(1:length(dns) , function(i) {
  nm <- names(def)[[i]]
  sets <- dns[[i]]$ID
  if ( length(sets) >0 ) { paste(nm,sets) }
} ) )

length(dn_sets)
## [1] 12
dn_sets
##  [1] "CD14 Mono KEGG_RIBOSOME"                  
##  [2] "CD14 Mono KEGG_PARKINSONS_DISEASE"        
##  [3] "CD14 Mono KEGG_HUNTINGTONS_DISEASE"       
##  [4] "CD14 Mono KEGG_OXIDATIVE_PHOSPHORYLATION" 
##  [5] "CD14 Mono KEGG_CARDIAC_MUSCLE_CONTRACTION"
##  [6] "CD14 Mono KEGG_ALZHEIMERS_DISEASE"        
##  [7] "CD14 Mono KEGG_SPLICEOSOME"               
##  [8] "B Activated KEGG_RIBOSOME"                
##  [9] "B KEGG_RIBOSOME"                          
## [10] "DC KEGG_RIBOSOME"                         
## [11] "CD16 Mono KEGG_RIBOSOME"                  
## [12] "NK KEGG_RIBOSOME"

ORA with Clusterprofiler with custom background and special gene set list to fix the potential bug

I’ve compiled a reporting checklist:

Reporting criteria Method/resource used
Origin of gene sets KEGG (2023-06-16)
Tool used ClusterProfiler (check version at foot of report)
Statistical test used hypergeometric test
P-value correction for multiple comparisons FDR method
Background list As defined by Seurat
Gene Selection Criteria Seurat FDR<0.05
ORA directionality Separate tests for up- and down-regulation
Data availability SeuratData ifnb
Other parameters Min gene set size of 10 + BUG FIX

Here I provide a background gene list for cluterprofiler to use, like a user should.

I have also done some modification to the KEGG gene sets, to en

Now filter the gene names into three lists, up-regulated, down-regulated and background. Background is simply all genes that were detected.

Enrichment firstly with upregulated genes

fixups <- lapply(1:length(def),function(i) {
  orafix(def[[i]]$up,def[[i]]$bg,genesets=genesets2)
})

fixup_sets <- unlist(lapply(1:length(fixups) , function(i) {
  nm <- names(def)[[i]]
  sets <- fixups[[i]]$ID
  if ( length(sets) >0 ) { paste(nm,sets) }
} ) )

length(fixup_sets)
## [1] 17
fixup_sets
##  [1] "CD14 Mono KEGG_RIG_I_LIKE_RECEPTOR_SIGNALING_PATHWAY"
##  [2] "CD14 Mono KEGG_ALLOGRAFT_REJECTION"                  
##  [3] "CD14 Mono KEGG_AUTOIMMUNE_THYROID_DISEASE"           
##  [4] "CD14 Mono KEGG_ANTIGEN_PROCESSING_AND_PRESENTATION"  
##  [5] "CD14 Mono KEGG_CELL_ADHESION_MOLECULES_CAMS"         
##  [6] "T activated KEGG_ANTIGEN_PROCESSING_AND_PRESENTATION"
##  [7] "B KEGG_CHEMOKINE_SIGNALING_PATHWAY"                  
##  [8] "B KEGG_ANTIGEN_PROCESSING_AND_PRESENTATION"          
##  [9] "DC KEGG_ANTIGEN_PROCESSING_AND_PRESENTATION"         
## [10] "CD16 Mono KEGG_ALLOGRAFT_REJECTION"                  
## [11] "CD16 Mono KEGG_AUTOIMMUNE_THYROID_DISEASE"           
## [12] "CD16 Mono KEGG_ANTIGEN_PROCESSING_AND_PRESENTATION"  
## [13] "CD16 Mono KEGG_GRAFT_VERSUS_HOST_DISEASE"            
## [14] "CD16 Mono KEGG_RIG_I_LIKE_RECEPTOR_SIGNALING_PATHWAY"
## [15] "CD16 Mono KEGG_TYPE_I_DIABETES_MELLITUS"             
## [16] "CD16 Mono KEGG_CELL_ADHESION_MOLECULES_CAMS"         
## [17] "NK KEGG_ANTIGEN_PROCESSING_AND_PRESENTATION"

Now repeat with the downregulated genes

fixdns <- lapply(1:length(def),function(i) {
  orafix(def[[i]]$dn,def[[i]]$bg,genesets=genesets2)
})

fixdn_sets <- unlist(lapply(1:length(fixdns) , function(i) {
  nm <- names(def)[[i]]
  sets <- fixdns[[i]]$ID
  if ( length(sets) >0 ) { paste(nm,sets) }
} ) )

length(fixdn_sets)
## [1] 19
fixdn_sets
##  [1] "CD14 Mono KEGG_RIBOSOME"                             
##  [2] "CD14 Mono KEGG_PARKINSONS_DISEASE"                   
##  [3] "CD14 Mono KEGG_HUNTINGTONS_DISEASE"                  
##  [4] "CD14 Mono KEGG_OXIDATIVE_PHOSPHORYLATION"            
##  [5] "CD14 Mono KEGG_CARDIAC_MUSCLE_CONTRACTION"           
##  [6] "CD14 Mono KEGG_ALZHEIMERS_DISEASE"                   
##  [7] "CD14 Mono KEGG_SPLICEOSOME"                          
##  [8] "B Activated KEGG_RIBOSOME"                           
##  [9] "B KEGG_RIBOSOME"                                     
## [10] "B KEGG_INTESTINAL_IMMUNE_NETWORK_FOR_IGA_PRODUCTION" 
## [11] "B KEGG_LEISHMANIA_INFECTION"                         
## [12] "DC KEGG_RIBOSOME"                                    
## [13] "DC KEGG_GLYCOLYSIS_GLUCONEOGENESIS"                  
## [14] "DC KEGG_HEMATOPOIETIC_CELL_LINEAGE"                  
## [15] "DC KEGG_REGULATION_OF_ACTIN_CYTOSKELETON"            
## [16] "CD16 Mono KEGG_RIBOSOME"                             
## [17] "CD16 Mono KEGG_PATHOGENIC_ESCHERICHIA_COLI_INFECTION"
## [18] "CD16 Mono KEGG_REGULATION_OF_ACTIN_CYTOSKELETON"     
## [19] "NK KEGG_RIBOSOME"

Compare pathway results

v1 <- list("ORA up"=up_sets, "ORA fix up"=fixup_sets)
v2 <- list("ORA dn"=dn_sets, "ORA fix dn"=fixdn_sets)
v3 <- list("ORA"=union(up_sets,dn_sets),
  "ORA fix"=union(fixup_sets,fixdn_sets))

par(mar=c(10,10,10,10))
par(mfrow=c(2,1))
plot(euler(v1),quantities = list(cex = 2), labels = list(cex = 2),main="upregulated KEGG pathways")

plot(euler(v2),quantities = list(cex = 2), labels = list(cex = 2),main="downregulated KEGG pathways")

plot(euler(v3),quantities = list(cex = 2), labels = list(cex = 2),main="up- and down-regulated KEGG pathways")

png("scrna2_kegg_euler.png")
plot(euler(v3),quantities = list(cex = 2), labels = list(cex = 2),main="up- and down-regulated KEGG pathways")
dev.off()
## png 
##   2

Jaccard index comparing ORA and ORA fix.

jaccard <- function(a, b) {
    intersection = length(intersect(a, b))
    union = length(a) + length(b) - intersection
    return (intersection/union)
}

orasets <- c(up_sets,dn_sets)
orafixsets <- c(fixup_sets,fixdn_sets)

jaccard(orasets,orafixsets)
## [1] 0.4461538

Reactome Gene sets

ORA with Clusterprofiler custom background with otherwise default analysis

I’ve compiled a reporting checklist:

Reporting criteria Method/resource used
Origin of gene sets Reactome (2023-03-06)
Tool used ClusterProfiler (check version at foot of report)
Statistical test used hypergeometric test
P-value correction for multiple comparisons FDR method
Background list As defined by Seurat
Gene Selection Criteria Seurat FDR<0.05
ORA directionality Separate tests for up- and down-regulation
Data availability SeuratData ifnb
Other parameters Min gene set size of 10

Here I provide a custom background gene list.

Get the gene sets loaded in R. These are Reactome gene sets

genesets2 <- read.gmt("../ref/ReactomePathways_2023-03-06.gmt")
gsets <- gmtPathways("../ref/ReactomePathways_2023-03-06.gmt")

message(paste("number of genes described in the annotation set:",length(unique(genesets2$gene))))
## number of genes described in the annotation set: 11457

Enrichment firstly with upregulated genes

ups <- lapply(1:length(def),function(i) {
  ora(def[[i]]$up,def[[i]]$bg,genesets=genesets2)
})

up_sets <- unlist(lapply(1:length(ups) , function(i) {
  nm <- names(def)[[i]]
  sets <- ups[[i]]$ID
  if ( length(sets) >0 ) { paste(nm,sets) }
} ) )

length(up_sets)
## [1] 94
up_sets
##  [1] "CD14 Mono Interferon alpha/beta signaling"                                           
##  [2] "CD14 Mono Immunoregulatory interactions between a Lymphoid and a non-Lymphoid cell"  
##  [3] "CD14 Mono Interferon gamma signaling"                                                
##  [4] "CD14 Mono Interferon Signaling"                                                      
##  [5] "CD14 Mono SARS-CoV-2 activates/modulates innate and adaptive immune responses"       
##  [6] "CD14 Mono Class A/1 (Rhodopsin-like receptors)"                                      
##  [7] "CD14 Mono GPCR ligand binding"                                                       
##  [8] "CD14 Mono Cytokine Signaling in Immune system"                                       
##  [9] "CD14 Mono Adaptive Immune System"                                                    
## [10] "CD14 Mono Immune System"                                                             
## [11] "T activated Interferon gamma signaling"                                              
## [12] "T activated Interferon alpha/beta signaling"                                         
## [13] "T activated Interferon Signaling"                                                    
## [14] "T activated SARS-CoV-2 activates/modulates innate and adaptive immune responses"     
## [15] "T activated Antiviral mechanism by IFN-stimulated genes"                             
## [16] "T activated ISG15 antiviral mechanism"                                               
## [17] "T activated SARS-CoV-2-host interactions"                                            
## [18] "T activated Immunoregulatory interactions between a Lymphoid and a non-Lymphoid cell"
## [19] "T activated SARS-CoV-2 Infection"                                                    
## [20] "T activated Cytokine Signaling in Immune system"                                     
## [21] "T activated Class I MHC mediated antigen processing & presentation"                  
## [22] "T activated ER-Phagosome pathway"                                                    
## [23] "T activated Antigen processing-Cross presentation"                                   
## [24] "T activated SARS-CoV Infections"                                                     
## [25] "T activated Antigen processing: Ubiquitination & Proteasome degradation"             
## [26] "T activated Immune System"                                                           
## [27] "T activated Adaptive Immune System"                                                  
## [28] "B Activated Interferon alpha/beta signaling"                                         
## [29] "B Activated Antiviral mechanism by IFN-stimulated genes"                             
## [30] "B Activated Interferon Signaling"                                                    
## [31] "B Activated ISG15 antiviral mechanism"                                               
## [32] "B Activated SARS-CoV-2 activates/modulates innate and adaptive immune responses"     
## [33] "B Activated Interferon gamma signaling"                                              
## [34] "B Activated DDX58/IFIH1-mediated induction of interferon-alpha/beta"                 
## [35] "B Activated ER-Phagosome pathway"                                                    
## [36] "B Activated Cytokine Signaling in Immune system"                                     
## [37] "B Activated Antigen processing: Ubiquitination & Proteasome degradation"             
## [38] "B Activated Antigen processing-Cross presentation"                                   
## [39] "B Activated Class I MHC mediated antigen processing & presentation"                  
## [40] "B Activated Immune System"                                                           
## [41] "B Activated Adaptive Immune System"                                                  
## [42] "B Interferon alpha/beta signaling"                                                   
## [43] "B SARS-CoV-2 activates/modulates innate and adaptive immune responses"               
## [44] "B Antiviral mechanism by IFN-stimulated genes"                                       
## [45] "B Immunoregulatory interactions between a Lymphoid and a non-Lymphoid cell"          
## [46] "B Interferon Signaling"                                                              
## [47] "B ISG15 antiviral mechanism"                                                         
## [48] "B Interferon gamma signaling"                                                        
## [49] "B DDX58/IFIH1-mediated induction of interferon-alpha/beta"                           
## [50] "B ER-Phagosome pathway"                                                              
## [51] "B Antigen processing-Cross presentation"                                             
## [52] "B Cytokine Signaling in Immune system"                                               
## [53] "B Class I MHC mediated antigen processing & presentation"                            
## [54] "B Antigen processing: Ubiquitination & Proteasome degradation"                       
## [55] "B Immune System"                                                                     
## [56] "DC Interferon alpha/beta signaling"                                                  
## [57] "DC Antigen Presentation: Folding, assembly and peptide loading of class I MHC"       
## [58] "DC Interferon gamma signaling"                                                       
## [59] "DC Immunoregulatory interactions between a Lymphoid and a non-Lymphoid cell"         
## [60] "DC Interferon Signaling"                                                             
## [61] "DC SARS-CoV-2 activates/modulates innate and adaptive immune responses"              
## [62] "DC DDX58/IFIH1-mediated induction of interferon-alpha/beta"                          
## [63] "DC Cytokine Signaling in Immune system"                                              
## [64] "DC Class I MHC mediated antigen processing & presentation"                           
## [65] "DC Immune System"                                                                    
## [66] "DC Adaptive Immune System"                                                           
## [67] "CD16 Mono Interferon alpha/beta signaling"                                           
## [68] "CD16 Mono Regulation of necroptotic cell death"                                      
## [69] "CD16 Mono RIPK1-mediated regulated necrosis"                                         
## [70] "CD16 Mono Interferon gamma signaling"                                                
## [71] "CD16 Mono Immunoregulatory interactions between a Lymphoid and a non-Lymphoid cell"  
## [72] "CD16 Mono Regulation of TNFR1 signaling"                                             
## [73] "CD16 Mono TNF signaling"                                                             
## [74] "CD16 Mono Interferon Signaling"                                                      
## [75] "CD16 Mono DDX58/IFIH1-mediated induction of interferon-alpha/beta"                   
## [76] "CD16 Mono Metabolism of vitamins and cofactors"                                      
## [77] "CD16 Mono Regulated Necrosis"                                                        
## [78] "CD16 Mono SARS-CoV-2 activates/modulates innate and adaptive immune responses"       
## [79] "CD16 Mono Cytokine Signaling in Immune system"                                       
## [80] "CD16 Mono Class I MHC mediated antigen processing & presentation"                    
## [81] "CD16 Mono Adaptive Immune System"                                                    
## [82] "CD16 Mono Immune System"                                                             
## [83] "NK Interferon alpha/beta signaling"                                                  
## [84] "NK Antiviral mechanism by IFN-stimulated genes"                                      
## [85] "NK Interferon Signaling"                                                             
## [86] "NK SARS-CoV-2 activates/modulates innate and adaptive immune responses"              
## [87] "NK Interferon gamma signaling"                                                       
## [88] "NK ISG15 antiviral mechanism"                                                        
## [89] "NK Immunoregulatory interactions between a Lymphoid and a non-Lymphoid cell"         
## [90] "NK DDX58/IFIH1-mediated induction of interferon-alpha/beta"                          
## [91] "NK Cytokine Signaling in Immune system"                                              
## [92] "NK Class I MHC mediated antigen processing & presentation"                           
## [93] "NK Immune System"                                                                    
## [94] "NK Adaptive Immune System"

Now repeat with the downregulated genes

dns <- lapply(1:length(def),function(i) {
  ora(def[[i]]$dn,def[[i]]$bg,genesets=genesets2)
})

dn_sets <- unlist(lapply(1:length(dns) , function(i) {
  nm <- names(def)[[i]]
  sets <- dns[[i]]$ID
  if ( length(sets) >0 ) { paste(nm,sets) }
} ) )

length(dn_sets)
## [1] 289
dn_sets
##   [1] "CD14 Mono Activation of the mRNA upon binding of the cap-binding complex and eIFs, and subsequent binding to 43S"             
##   [2] "CD14 Mono Ribosomal scanning and start codon recognition"                                                                     
##   [3] "CD14 Mono Translation initiation complex formation"                                                                           
##   [4] "CD14 Mono SARS-CoV-2 modulates host translation machinery"                                                                    
##   [5] "CD14 Mono Complex I biogenesis"                                                                                               
##   [6] "CD14 Mono Nucleotide Excision Repair"                                                                                         
##   [7] "CD14 Mono mRNA Splicing - Minor Pathway"                                                                                      
##   [8] "CD14 Mono Signaling by NTRKs"                                                                                                 
##   [9] "CD14 Mono Signaling by NTRK1 (TRKA)"                                                                                          
##  [10] "CD14 Mono Transcription-Coupled Nucleotide Excision Repair (TC-NER)"                                                          
##  [11] "CD14 Mono Formation of the ternary complex, and subsequently, the 43S complex"                                                
##  [12] "CD14 Mono SARS-CoV-1 modulates host translation machinery"                                                                    
##  [13] "CD14 Mono Global Genome Nucleotide Excision Repair (GG-NER)"                                                                  
##  [14] "CD14 Mono Cap-dependent Translation Initiation"                                                                               
##  [15] "CD14 Mono Eukaryotic Translation Initiation"                                                                                  
##  [16] "CD14 Mono GTP hydrolysis and joining of the 60S ribosomal subunit"                                                            
##  [17] "CD14 Mono L13a-mediated translational silencing of Ceruloplasmin expression"                                                  
##  [18] "CD14 Mono Formation of a pool of free 40S subunits"                                                                           
##  [19] "CD14 Mono Eukaryotic Translation Elongation"                                                                                  
##  [20] "CD14 Mono Selenoamino acid metabolism"                                                                                        
##  [21] "CD14 Mono Eukaryotic Translation Termination"                                                                                 
##  [22] "CD14 Mono Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                       
##  [23] "CD14 Mono Peptide chain elongation"                                                                                           
##  [24] "CD14 Mono Selenocysteine synthesis"                                                                                           
##  [25] "CD14 Mono Viral mRNA Translation"                                                                                             
##  [26] "CD14 Mono The citric acid (TCA) cycle and respiratory electron transport"                                                     
##  [27] "CD14 Mono Respiratory electron transport, ATP synthesis by chemiosmotic coupling, and heat production by uncoupling proteins."
##  [28] "CD14 Mono Respiratory electron transport"                                                                                     
##  [29] "CD14 Mono Influenza Viral RNA Transcription and Replication"                                                                  
##  [30] "CD14 Mono rRNA processing"                                                                                                    
##  [31] "CD14 Mono SRP-dependent cotranslational protein targeting to membrane"                                                        
##  [32] "CD14 Mono Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                          
##  [33] "CD14 Mono Nonsense-Mediated Decay (NMD)"                                                                                      
##  [34] "CD14 Mono rRNA processing in the nucleus and cytosol"                                                                         
##  [35] "CD14 Mono Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                                
##  [36] "CD14 Mono Major pathway of rRNA processing in the nucleolus and cytosol"                                                      
##  [37] "CD14 Mono Translation"                                                                                                        
##  [38] "CD14 Mono Cellular response to starvation"                                                                                    
##  [39] "CD14 Mono RNA Polymerase II Transcription Termination"                                                                        
##  [40] "CD14 Mono Signaling by ROBO receptors"                                                                                        
##  [41] "CD14 Mono Influenza Infection"                                                                                                
##  [42] "CD14 Mono Regulation of expression of SLITs and ROBOs"                                                                        
##  [43] "CD14 Mono mRNA Splicing"                                                                                                      
##  [44] "CD14 Mono mRNA Splicing - Major Pathway"                                                                                      
##  [45] "CD14 Mono Processing of Capped Intron-Containing Pre-mRNA"                                                                    
##  [46] "CD14 Mono Axon guidance"                                                                                                      
##  [47] "CD14 Mono Nervous system development"                                                                                         
##  [48] "CD14 Mono Metabolism of RNA"                                                                                                  
##  [49] "CD14 Mono Metabolism of amino acids and derivatives"                                                                          
##  [50] "CD14 Mono Developmental Biology"                                                                                              
##  [51] "CD14 Mono SARS-CoV-1-host interactions"                                                                                       
##  [52] "CD14 Mono Signaling by Receptor Tyrosine Kinases"                                                                             
##  [53] "CD14 Mono Cellular responses to stress"                                                                                       
##  [54] "CD14 Mono Metabolism of proteins"                                                                                             
##  [55] "CD14 Mono Cellular responses to stimuli"                                                                                      
##  [56] "CD14 Mono Metabolism"                                                                                                         
##  [57] "CD14 Mono Infectious disease"                                                                                                 
##  [58] "CD14 Mono Disease"                                                                                                            
##  [59] "B Activated SARS-CoV-1 modulates host translation machinery"                                                                  
##  [60] "B Activated Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                     
##  [61] "B Activated Peptide chain elongation"                                                                                         
##  [62] "B Activated Eukaryotic Translation Termination"                                                                               
##  [63] "B Activated Selenocysteine synthesis"                                                                                         
##  [64] "B Activated Eukaryotic Translation Elongation"                                                                                
##  [65] "B Activated Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                        
##  [66] "B Activated Nonsense-Mediated Decay (NMD)"                                                                                    
##  [67] "B Activated Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                              
##  [68] "B Activated Viral mRNA Translation"                                                                                           
##  [69] "B Activated Translation initiation complex formation"                                                                         
##  [70] "B Activated L13a-mediated translational silencing of Ceruloplasmin expression"                                                
##  [71] "B Activated Activation of the mRNA upon binding of the cap-binding complex and eIFs, and subsequent binding to 43S"           
##  [72] "B Activated Cap-dependent Translation Initiation"                                                                             
##  [73] "B Activated Eukaryotic Translation Initiation"                                                                                
##  [74] "B Activated Selenoamino acid metabolism"                                                                                      
##  [75] "B Activated Cellular response to starvation"                                                                                  
##  [76] "B Activated Formation of a pool of free 40S subunits"                                                                         
##  [77] "B Activated GTP hydrolysis and joining of the 60S ribosomal subunit"                                                          
##  [78] "B Activated SRP-dependent cotranslational protein targeting to membrane"                                                      
##  [79] "B Activated SARS-CoV-1-host interactions"                                                                                     
##  [80] "B Activated Influenza Viral RNA Transcription and Replication"                                                                
##  [81] "B Activated Regulation of expression of SLITs and ROBOs"                                                                      
##  [82] "B Activated Signaling by ROBO receptors"                                                                                      
##  [83] "B Activated Major pathway of rRNA processing in the nucleolus and cytosol"                                                    
##  [84] "B Activated SARS-CoV-1 Infection"                                                                                             
##  [85] "B Activated Influenza Infection"                                                                                              
##  [86] "B Activated rRNA processing"                                                                                                  
##  [87] "B Activated rRNA processing in the nucleus and cytosol"                                                                       
##  [88] "B Activated Axon guidance"                                                                                                    
##  [89] "B Activated Nervous system development"                                                                                       
##  [90] "B Activated Translation"                                                                                                      
##  [91] "B Activated Metabolism of amino acids and derivatives"                                                                        
##  [92] "B Activated Developmental Biology"                                                                                            
##  [93] "B Activated Metabolism of RNA"                                                                                                
##  [94] "B Activated SARS-CoV Infections"                                                                                              
##  [95] "B Activated Cellular responses to stress"                                                                                     
##  [96] "B Activated Cellular responses to stimuli"                                                                                    
##  [97] "B Activated Infectious disease"                                                                                               
##  [98] "B Activated Disease"                                                                                                          
##  [99] "B Activated Metabolism of proteins"                                                                                           
## [100] "B SARS-CoV-1 modulates host translation machinery"                                                                            
## [101] "B Peptide chain elongation"                                                                                                   
## [102] "B Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                               
## [103] "B Eukaryotic Translation Termination"                                                                                         
## [104] "B Viral mRNA Translation"                                                                                                     
## [105] "B Eukaryotic Translation Elongation"                                                                                          
## [106] "B Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                                        
## [107] "B Selenoamino acid metabolism"                                                                                                
## [108] "B Selenocysteine synthesis"                                                                                                   
## [109] "B Formation of a pool of free 40S subunits"                                                                                   
## [110] "B Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                                  
## [111] "B Nonsense-Mediated Decay (NMD)"                                                                                              
## [112] "B SARS-CoV-2 modulates host translation machinery"                                                                            
## [113] "B Major pathway of rRNA processing in the nucleolus and cytosol"                                                              
## [114] "B rRNA processing"                                                                                                            
## [115] "B rRNA processing in the nucleus and cytosol"                                                                                 
## [116] "B SRP-dependent cotranslational protein targeting to membrane"                                                                
## [117] "B Cap-dependent Translation Initiation"                                                                                       
## [118] "B Eukaryotic Translation Initiation"                                                                                          
## [119] "B L13a-mediated translational silencing of Ceruloplasmin expression"                                                          
## [120] "B GTP hydrolysis and joining of the 60S ribosomal subunit"                                                                    
## [121] "B Formation of the ternary complex, and subsequently, the 43S complex"                                                        
## [122] "B Cellular response to starvation"                                                                                            
## [123] "B Influenza Viral RNA Transcription and Replication"                                                                          
## [124] "B Influenza Infection"                                                                                                        
## [125] "B Activation of the mRNA upon binding of the cap-binding complex and eIFs, and subsequent binding to 43S"                     
## [126] "B Translation initiation complex formation"                                                                                   
## [127] "B Ribosomal scanning and start codon recognition"                                                                             
## [128] "B Regulation of expression of SLITs and ROBOs"                                                                                
## [129] "B Signaling by ROBO receptors"                                                                                                
## [130] "B SARS-CoV-1-host interactions"                                                                                               
## [131] "B Metabolism of amino acids and derivatives"                                                                                  
## [132] "B Translation"                                                                                                                
## [133] "B Axon guidance"                                                                                                              
## [134] "B Nervous system development"                                                                                                 
## [135] "B SARS-CoV-1 Infection"                                                                                                       
## [136] "B Developmental Biology"                                                                                                      
## [137] "B Cellular responses to stress"                                                                                               
## [138] "B Metabolism of RNA"                                                                                                          
## [139] "B Cellular responses to stimuli"                                                                                              
## [140] "B Metabolism"                                                                                                                 
## [141] "B Infectious disease"                                                                                                         
## [142] "B Disease"                                                                                                                    
## [143] "B Metabolism of proteins"                                                                                                     
## [144] "DC SARS-CoV-1 modulates host translation machinery"                                                                           
## [145] "DC Eukaryotic Translation Elongation"                                                                                         
## [146] "DC Peptide chain elongation"                                                                                                  
## [147] "DC Selenocysteine synthesis"                                                                                                  
## [148] "DC Viral mRNA Translation"                                                                                                    
## [149] "DC Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                                       
## [150] "DC Eukaryotic Translation Termination"                                                                                        
## [151] "DC Selenoamino acid metabolism"                                                                                               
## [152] "DC Formation of a pool of free 40S subunits"                                                                                  
## [153] "DC Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                              
## [154] "DC SARS-CoV-2 modulates host translation machinery"                                                                           
## [155] "DC L13a-mediated translational silencing of Ceruloplasmin expression"                                                         
## [156] "DC Formation of the ternary complex, and subsequently, the 43S complex"                                                       
## [157] "DC Cap-dependent Translation Initiation"                                                                                      
## [158] "DC Eukaryotic Translation Initiation"                                                                                         
## [159] "DC GTP hydrolysis and joining of the 60S ribosomal subunit"                                                                   
## [160] "DC SRP-dependent cotranslational protein targeting to membrane"                                                               
## [161] "DC Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                                 
## [162] "DC Nonsense-Mediated Decay (NMD)"                                                                                             
## [163] "DC Influenza Viral RNA Transcription and Replication"                                                                         
## [164] "DC Activation of the mRNA upon binding of the cap-binding complex and eIFs, and subsequent binding to 43S"                    
## [165] "DC Translation initiation complex formation"                                                                                  
## [166] "DC Ribosomal scanning and start codon recognition"                                                                            
## [167] "DC Major pathway of rRNA processing in the nucleolus and cytosol"                                                             
## [168] "DC Cellular response to starvation"                                                                                           
## [169] "DC rRNA processing in the nucleus and cytosol"                                                                                
## [170] "DC rRNA processing"                                                                                                           
## [171] "DC Influenza Infection"                                                                                                       
## [172] "DC Regulation of expression of SLITs and ROBOs"                                                                               
## [173] "DC Signaling by ROBO receptors"                                                                                               
## [174] "DC SARS-CoV-1-host interactions"                                                                                              
## [175] "DC Glycolysis"                                                                                                                
## [176] "DC Axon guidance"                                                                                                             
## [177] "DC Nervous system development"                                                                                                
## [178] "DC Metabolism of amino acids and derivatives"                                                                                 
## [179] "DC Translation"                                                                                                               
## [180] "DC Selective autophagy"                                                                                                       
## [181] "DC SARS-CoV-1 Infection"                                                                                                      
## [182] "DC Developmental Biology"                                                                                                     
## [183] "DC SARS-CoV-2-host interactions"                                                                                              
## [184] "DC SARS-CoV-2 Infection"                                                                                                      
## [185] "DC Cellular responses to stress"                                                                                              
## [186] "DC Cellular responses to stimuli"                                                                                             
## [187] "DC Infectious disease"                                                                                                        
## [188] "DC Metabolism of RNA"                                                                                                         
## [189] "DC SARS-CoV Infections"                                                                                                       
## [190] "DC Disease"                                                                                                                   
## [191] "DC Metabolism"                                                                                                                
## [192] "DC Metabolism of proteins"                                                                                                    
## [193] "CD16 Mono Eukaryotic Translation Elongation"                                                                                  
## [194] "CD16 Mono Peptide chain elongation"                                                                                           
## [195] "CD16 Mono Selenocysteine synthesis"                                                                                           
## [196] "CD16 Mono Viral mRNA Translation"                                                                                             
## [197] "CD16 Mono SARS-CoV-1 modulates host translation machinery"                                                                    
## [198] "CD16 Mono Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                       
## [199] "CD16 Mono Selenoamino acid metabolism"                                                                                        
## [200] "CD16 Mono EPHB-mediated forward signaling"                                                                                    
## [201] "CD16 Mono Eukaryotic Translation Termination"                                                                                 
## [202] "CD16 Mono Formation of a pool of free 40S subunits"                                                                           
## [203] "CD16 Mono SARS-CoV-2 modulates host translation machinery"                                                                    
## [204] "CD16 Mono L13a-mediated translational silencing of Ceruloplasmin expression"                                                  
## [205] "CD16 Mono Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                                
## [206] "CD16 Mono Influenza Viral RNA Transcription and Replication"                                                                  
## [207] "CD16 Mono Major pathway of rRNA processing in the nucleolus and cytosol"                                                      
## [208] "CD16 Mono Cap-dependent Translation Initiation"                                                                               
## [209] "CD16 Mono Eukaryotic Translation Initiation"                                                                                  
## [210] "CD16 Mono GTP hydrolysis and joining of the 60S ribosomal subunit"                                                            
## [211] "CD16 Mono rRNA processing in the nucleus and cytosol"                                                                         
## [212] "CD16 Mono SRP-dependent cotranslational protein targeting to membrane"                                                        
## [213] "CD16 Mono Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                          
## [214] "CD16 Mono Nonsense-Mediated Decay (NMD)"                                                                                      
## [215] "CD16 Mono rRNA processing"                                                                                                    
## [216] "CD16 Mono RHO GTPases Activate Formins"                                                                                       
## [217] "CD16 Mono Formation of the ternary complex, and subsequently, the 43S complex"                                                
## [218] "CD16 Mono Activation of the mRNA upon binding of the cap-binding complex and eIFs, and subsequent binding to 43S"             
## [219] "CD16 Mono Translation initiation complex formation"                                                                           
## [220] "CD16 Mono Ribosomal scanning and start codon recognition"                                                                     
## [221] "CD16 Mono EPH-Ephrin signaling"                                                                                               
## [222] "CD16 Mono Cellular response to starvation"                                                                                    
## [223] "CD16 Mono Influenza Infection"                                                                                                
## [224] "CD16 Mono Estrogen-dependent gene expression"                                                                                 
## [225] "CD16 Mono Translation"                                                                                                        
## [226] "CD16 Mono Signaling by ROBO receptors"                                                                                        
## [227] "CD16 Mono Regulation of expression of SLITs and ROBOs"                                                                        
## [228] "CD16 Mono Metabolism of amino acids and derivatives"                                                                          
## [229] "CD16 Mono Platelet degranulation"                                                                                             
## [230] "CD16 Mono Response to elevated platelet cytosolic Ca2+"                                                                       
## [231] "CD16 Mono Metabolism of carbohydrates"                                                                                        
## [232] "CD16 Mono Axon guidance"                                                                                                      
## [233] "CD16 Mono Nervous system development"                                                                                         
## [234] "CD16 Mono SARS-CoV-1-host interactions"                                                                                       
## [235] "CD16 Mono Developmental Biology"                                                                                              
## [236] "CD16 Mono Metabolism of RNA"                                                                                                  
## [237] "CD16 Mono Infectious disease"                                                                                                 
## [238] "CD16 Mono Cellular responses to stress"                                                                                       
## [239] "CD16 Mono Metabolism"                                                                                                         
## [240] "CD16 Mono Cellular responses to stimuli"                                                                                      
## [241] "CD16 Mono Disease"                                                                                                            
## [242] "CD16 Mono Metabolism of proteins"                                                                                             
## [243] "NK Peptide chain elongation"                                                                                                  
## [244] "NK Selenoamino acid metabolism"                                                                                               
## [245] "NK Selenocysteine synthesis"                                                                                                  
## [246] "NK Eukaryotic Translation Termination"                                                                                        
## [247] "NK Major pathway of rRNA processing in the nucleolus and cytosol"                                                             
## [248] "NK Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                                       
## [249] "NK Viral mRNA Translation"                                                                                                    
## [250] "NK Eukaryotic Translation Elongation"                                                                                         
## [251] "NK Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                              
## [252] "NK rRNA processing in the nucleus and cytosol"                                                                                
## [253] "NK SARS-CoV-1 modulates host translation machinery"                                                                           
## [254] "NK rRNA processing"                                                                                                           
## [255] "NK Cellular response to starvation"                                                                                           
## [256] "NK Influenza Viral RNA Transcription and Replication"                                                                         
## [257] "NK Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                                 
## [258] "NK Nonsense-Mediated Decay (NMD)"                                                                                             
## [259] "NK SARS-CoV-2 modulates host translation machinery"                                                                           
## [260] "NK Formation of a pool of free 40S subunits"                                                                                  
## [261] "NK Influenza Infection"                                                                                                       
## [262] "NK SRP-dependent cotranslational protein targeting to membrane"                                                               
## [263] "NK GTP hydrolysis and joining of the 60S ribosomal subunit"                                                                   
## [264] "NK L13a-mediated translational silencing of Ceruloplasmin expression"                                                         
## [265] "NK Cap-dependent Translation Initiation"                                                                                      
## [266] "NK Eukaryotic Translation Initiation"                                                                                         
## [267] "NK Signaling by ROBO receptors"                                                                                               
## [268] "NK Regulation of expression of SLITs and ROBOs"                                                                               
## [269] "NK Metabolism of amino acids and derivatives"                                                                                 
## [270] "NK SARS-CoV-1-host interactions"                                                                                              
## [271] "NK Axon guidance"                                                                                                             
## [272] "NK Nervous system development"                                                                                                
## [273] "NK Formation of the ternary complex, and subsequently, the 43S complex"                                                       
## [274] "NK Ribosomal scanning and start codon recognition"                                                                            
## [275] "NK SARS-CoV-1 Infection"                                                                                                      
## [276] "NK Translation initiation complex formation"                                                                                  
## [277] "NK Translation"                                                                                                               
## [278] "NK Activation of the mRNA upon binding of the cap-binding complex and eIFs, and subsequent binding to 43S"                    
## [279] "NK Developmental Biology"                                                                                                     
## [280] "NK Cellular responses to stress"                                                                                              
## [281] "NK Cellular responses to stimuli"                                                                                             
## [282] "NK SARS-CoV-2-host interactions"                                                                                              
## [283] "NK Metabolism of RNA"                                                                                                         
## [284] "NK Infectious disease"                                                                                                        
## [285] "NK SARS-CoV-2 Infection"                                                                                                      
## [286] "NK Metabolism"                                                                                                                
## [287] "NK SARS-CoV Infections"                                                                                                       
## [288] "NK Disease"                                                                                                                   
## [289] "NK Metabolism of proteins"

ORA with Clusterprofiler with custom background and special gene set list to fix the potential bug

I’ve compiled a reporting checklist:

Reporting criteria Method/resource used
Origin of gene sets Reactome (2023-03-06)
Tool used ClusterProfiler (check version at foot of report)
Statistical test used hypergeometric test
P-value correction for multiple comparisons FDR method
Background list As defined by Seurat
Gene Selection Criteria Seurat FDR<0.05
ORA directionality Separate tests for up- and down-regulation
Data availability SeuratData ifnb
Other parameters Min gene set size of 10 + BUG FIX
fixups <- lapply(1:length(def),function(i) {
  orafix(def[[i]]$up,def[[i]]$bg,genesets=genesets2)
})

fixup_sets <- unlist(lapply(1:length(fixups) , function(i) {
  nm <- names(def)[[i]]
  sets <- fixups[[i]]$ID
  if ( length(sets) >0 ) { paste(nm,sets) }
} ) )

length(fixup_sets)
## [1] 86
fixup_sets
##  [1] "CD14 Mono Interferon alpha/beta signaling"                                           
##  [2] "CD14 Mono Immunoregulatory interactions between a Lymphoid and a non-Lymphoid cell"  
##  [3] "CD14 Mono Interferon gamma signaling"                                                
##  [4] "CD14 Mono Interferon Signaling"                                                      
##  [5] "CD14 Mono SARS-CoV-2 activates/modulates innate and adaptive immune responses"       
##  [6] "CD14 Mono Cytokine Signaling in Immune system"                                       
##  [7] "CD14 Mono Adaptive Immune System"                                                    
##  [8] "CD14 Mono Immune System"                                                             
##  [9] "T activated Interferon gamma signaling"                                              
## [10] "T activated Interferon alpha/beta signaling"                                         
## [11] "T activated Interferon Signaling"                                                    
## [12] "T activated SARS-CoV-2 activates/modulates innate and adaptive immune responses"     
## [13] "T activated Antiviral mechanism by IFN-stimulated genes"                             
## [14] "T activated ISG15 antiviral mechanism"                                               
## [15] "T activated SARS-CoV-2-host interactions"                                            
## [16] "T activated Immunoregulatory interactions between a Lymphoid and a non-Lymphoid cell"
## [17] "T activated SARS-CoV-2 Infection"                                                    
## [18] "T activated Cytokine Signaling in Immune system"                                     
## [19] "T activated Class I MHC mediated antigen processing & presentation"                  
## [20] "T activated ER-Phagosome pathway"                                                    
## [21] "T activated Antigen processing-Cross presentation"                                   
## [22] "T activated SARS-CoV Infections"                                                     
## [23] "T activated Antigen processing: Ubiquitination & Proteasome degradation"             
## [24] "T activated Immune System"                                                           
## [25] "T activated Adaptive Immune System"                                                  
## [26] "B Activated Interferon alpha/beta signaling"                                         
## [27] "B Activated Antiviral mechanism by IFN-stimulated genes"                             
## [28] "B Activated Interferon Signaling"                                                    
## [29] "B Activated ISG15 antiviral mechanism"                                               
## [30] "B Activated SARS-CoV-2 activates/modulates innate and adaptive immune responses"     
## [31] "B Activated Interferon gamma signaling"                                              
## [32] "B Activated DDX58/IFIH1-mediated induction of interferon-alpha/beta"                 
## [33] "B Activated ER-Phagosome pathway"                                                    
## [34] "B Activated Cytokine Signaling in Immune system"                                     
## [35] "B Activated Antigen processing: Ubiquitination & Proteasome degradation"             
## [36] "B Activated Antigen processing-Cross presentation"                                   
## [37] "B Activated Class I MHC mediated antigen processing & presentation"                  
## [38] "B Activated Immune System"                                                           
## [39] "B Activated Adaptive Immune System"                                                  
## [40] "B Interferon alpha/beta signaling"                                                   
## [41] "B SARS-CoV-2 activates/modulates innate and adaptive immune responses"               
## [42] "B Antiviral mechanism by IFN-stimulated genes"                                       
## [43] "B Immunoregulatory interactions between a Lymphoid and a non-Lymphoid cell"          
## [44] "B Interferon Signaling"                                                              
## [45] "B ISG15 antiviral mechanism"                                                         
## [46] "B Interferon gamma signaling"                                                        
## [47] "B DDX58/IFIH1-mediated induction of interferon-alpha/beta"                           
## [48] "B ER-Phagosome pathway"                                                              
## [49] "B Antigen processing-Cross presentation"                                             
## [50] "B Cytokine Signaling in Immune system"                                               
## [51] "B Class I MHC mediated antigen processing & presentation"                            
## [52] "B Antigen processing: Ubiquitination & Proteasome degradation"                       
## [53] "B Immune System"                                                                     
## [54] "DC Interferon alpha/beta signaling"                                                  
## [55] "DC Antigen Presentation: Folding, assembly and peptide loading of class I MHC"       
## [56] "DC Interferon gamma signaling"                                                       
## [57] "DC Immunoregulatory interactions between a Lymphoid and a non-Lymphoid cell"         
## [58] "DC Interferon Signaling"                                                             
## [59] "DC SARS-CoV-2 activates/modulates innate and adaptive immune responses"              
## [60] "DC Cytokine Signaling in Immune system"                                              
## [61] "DC Immune System"                                                                    
## [62] "DC Adaptive Immune System"                                                           
## [63] "CD16 Mono Interferon alpha/beta signaling"                                           
## [64] "CD16 Mono Regulation of necroptotic cell death"                                      
## [65] "CD16 Mono RIPK1-mediated regulated necrosis"                                         
## [66] "CD16 Mono Interferon gamma signaling"                                                
## [67] "CD16 Mono Immunoregulatory interactions between a Lymphoid and a non-Lymphoid cell"  
## [68] "CD16 Mono Interferon Signaling"                                                      
## [69] "CD16 Mono DDX58/IFIH1-mediated induction of interferon-alpha/beta"                   
## [70] "CD16 Mono Regulated Necrosis"                                                        
## [71] "CD16 Mono SARS-CoV-2 activates/modulates innate and adaptive immune responses"       
## [72] "CD16 Mono Cytokine Signaling in Immune system"                                       
## [73] "CD16 Mono Adaptive Immune System"                                                    
## [74] "CD16 Mono Immune System"                                                             
## [75] "NK Interferon alpha/beta signaling"                                                  
## [76] "NK Antiviral mechanism by IFN-stimulated genes"                                      
## [77] "NK Interferon Signaling"                                                             
## [78] "NK SARS-CoV-2 activates/modulates innate and adaptive immune responses"              
## [79] "NK Interferon gamma signaling"                                                       
## [80] "NK ISG15 antiviral mechanism"                                                        
## [81] "NK Immunoregulatory interactions between a Lymphoid and a non-Lymphoid cell"         
## [82] "NK DDX58/IFIH1-mediated induction of interferon-alpha/beta"                          
## [83] "NK Cytokine Signaling in Immune system"                                              
## [84] "NK Class I MHC mediated antigen processing & presentation"                           
## [85] "NK Immune System"                                                                    
## [86] "NK Adaptive Immune System"

Now repeat with the downregulated genes

fixdns <- lapply(1:length(def),function(i) {
  orafix(def[[i]]$dn,def[[i]]$bg,genesets=genesets2)
})

fixdn_sets <- unlist(lapply(1:length(fixdns) , function(i) {
  nm <- names(def)[[i]]
  sets <- fixdns[[i]]$ID
  if ( length(sets) >0 ) { paste(nm,sets) }
} ) )

length(fixdn_sets)
## [1] 310
fixdn_sets
##   [1] "CD14 Mono Activation of the mRNA upon binding of the cap-binding complex and eIFs, and subsequent binding to 43S"             
##   [2] "CD14 Mono Ribosomal scanning and start codon recognition"                                                                     
##   [3] "CD14 Mono Translation initiation complex formation"                                                                           
##   [4] "CD14 Mono Formation of the ternary complex, and subsequently, the 43S complex"                                                
##   [5] "CD14 Mono SARS-CoV-2 modulates host translation machinery"                                                                    
##   [6] "CD14 Mono SARS-CoV-1 modulates host translation machinery"                                                                    
##   [7] "CD14 Mono Complex I biogenesis"                                                                                               
##   [8] "CD14 Mono Nucleotide Excision Repair"                                                                                         
##   [9] "CD14 Mono Global Genome Nucleotide Excision Repair (GG-NER)"                                                                  
##  [10] "CD14 Mono Signaling by NTRK1 (TRKA)"                                                                                          
##  [11] "CD14 Mono Transcription-Coupled Nucleotide Excision Repair (TC-NER)"                                                          
##  [12] "CD14 Mono Dual incision in TC-NER"                                                                                            
##  [13] "CD14 Mono Gap-filling DNA repair synthesis and ligation in TC-NER"                                                            
##  [14] "CD14 Mono mRNA Splicing - Minor Pathway"                                                                                      
##  [15] "CD14 Mono Signaling by NTRKs"                                                                                                 
##  [16] "CD14 Mono Cap-dependent Translation Initiation"                                                                               
##  [17] "CD14 Mono Eukaryotic Translation Initiation"                                                                                  
##  [18] "CD14 Mono GTP hydrolysis and joining of the 60S ribosomal subunit"                                                            
##  [19] "CD14 Mono L13a-mediated translational silencing of Ceruloplasmin expression"                                                  
##  [20] "CD14 Mono Formation of a pool of free 40S subunits"                                                                           
##  [21] "CD14 Mono Eukaryotic Translation Elongation"                                                                                  
##  [22] "CD14 Mono Selenoamino acid metabolism"                                                                                        
##  [23] "CD14 Mono Eukaryotic Translation Termination"                                                                                 
##  [24] "CD14 Mono Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                       
##  [25] "CD14 Mono Peptide chain elongation"                                                                                           
##  [26] "CD14 Mono Selenocysteine synthesis"                                                                                           
##  [27] "CD14 Mono Viral mRNA Translation"                                                                                             
##  [28] "CD14 Mono The citric acid (TCA) cycle and respiratory electron transport"                                                     
##  [29] "CD14 Mono Respiratory electron transport, ATP synthesis by chemiosmotic coupling, and heat production by uncoupling proteins."
##  [30] "CD14 Mono Respiratory electron transport"                                                                                     
##  [31] "CD14 Mono Influenza Viral RNA Transcription and Replication"                                                                  
##  [32] "CD14 Mono rRNA processing"                                                                                                    
##  [33] "CD14 Mono SRP-dependent cotranslational protein targeting to membrane"                                                        
##  [34] "CD14 Mono Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                          
##  [35] "CD14 Mono Nonsense-Mediated Decay (NMD)"                                                                                      
##  [36] "CD14 Mono rRNA processing in the nucleus and cytosol"                                                                         
##  [37] "CD14 Mono Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                                
##  [38] "CD14 Mono Major pathway of rRNA processing in the nucleolus and cytosol"                                                      
##  [39] "CD14 Mono Translation"                                                                                                        
##  [40] "CD14 Mono Cellular response to starvation"                                                                                    
##  [41] "CD14 Mono RNA Polymerase II Transcription Termination"                                                                        
##  [42] "CD14 Mono Signaling by ROBO receptors"                                                                                        
##  [43] "CD14 Mono Influenza Infection"                                                                                                
##  [44] "CD14 Mono Regulation of expression of SLITs and ROBOs"                                                                        
##  [45] "CD14 Mono mRNA Splicing"                                                                                                      
##  [46] "CD14 Mono mRNA Splicing - Major Pathway"                                                                                      
##  [47] "CD14 Mono Processing of Capped Intron-Containing Pre-mRNA"                                                                    
##  [48] "CD14 Mono Axon guidance"                                                                                                      
##  [49] "CD14 Mono Nervous system development"                                                                                         
##  [50] "CD14 Mono Metabolism of RNA"                                                                                                  
##  [51] "CD14 Mono Metabolism of amino acids and derivatives"                                                                          
##  [52] "CD14 Mono Developmental Biology"                                                                                              
##  [53] "CD14 Mono DNA Repair"                                                                                                         
##  [54] "CD14 Mono SARS-CoV-1-host interactions"                                                                                       
##  [55] "CD14 Mono Signaling by Receptor Tyrosine Kinases"                                                                             
##  [56] "CD14 Mono Cellular responses to stress"                                                                                       
##  [57] "CD14 Mono Metabolism of proteins"                                                                                             
##  [58] "CD14 Mono Cellular responses to stimuli"                                                                                      
##  [59] "CD14 Mono SARS-CoV-1 Infection"                                                                                               
##  [60] "CD14 Mono Metabolism"                                                                                                         
##  [61] "CD14 Mono Infectious disease"                                                                                                 
##  [62] "CD14 Mono RNA Polymerase II Transcription"                                                                                    
##  [63] "CD14 Mono Gene expression (Transcription)"                                                                                    
##  [64] "CD14 Mono Disease"                                                                                                            
##  [65] "B Activated SARS-CoV-1 modulates host translation machinery"                                                                  
##  [66] "B Activated Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                     
##  [67] "B Activated Peptide chain elongation"                                                                                         
##  [68] "B Activated Eukaryotic Translation Termination"                                                                               
##  [69] "B Activated Selenocysteine synthesis"                                                                                         
##  [70] "B Activated Eukaryotic Translation Elongation"                                                                                
##  [71] "B Activated Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                        
##  [72] "B Activated Nonsense-Mediated Decay (NMD)"                                                                                    
##  [73] "B Activated Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                              
##  [74] "B Activated Viral mRNA Translation"                                                                                           
##  [75] "B Activated Translation initiation complex formation"                                                                         
##  [76] "B Activated L13a-mediated translational silencing of Ceruloplasmin expression"                                                
##  [77] "B Activated Activation of the mRNA upon binding of the cap-binding complex and eIFs, and subsequent binding to 43S"           
##  [78] "B Activated Cap-dependent Translation Initiation"                                                                             
##  [79] "B Activated Eukaryotic Translation Initiation"                                                                                
##  [80] "B Activated Selenoamino acid metabolism"                                                                                      
##  [81] "B Activated Cellular response to starvation"                                                                                  
##  [82] "B Activated Formation of a pool of free 40S subunits"                                                                         
##  [83] "B Activated GTP hydrolysis and joining of the 60S ribosomal subunit"                                                          
##  [84] "B Activated SRP-dependent cotranslational protein targeting to membrane"                                                      
##  [85] "B Activated SARS-CoV-1-host interactions"                                                                                     
##  [86] "B Activated Influenza Viral RNA Transcription and Replication"                                                                
##  [87] "B Activated Regulation of expression of SLITs and ROBOs"                                                                      
##  [88] "B Activated Signaling by ROBO receptors"                                                                                      
##  [89] "B Activated Major pathway of rRNA processing in the nucleolus and cytosol"                                                    
##  [90] "B Activated SARS-CoV-1 Infection"                                                                                             
##  [91] "B Activated Influenza Infection"                                                                                              
##  [92] "B Activated rRNA processing"                                                                                                  
##  [93] "B Activated rRNA processing in the nucleus and cytosol"                                                                       
##  [94] "B Activated Axon guidance"                                                                                                    
##  [95] "B Activated Nervous system development"                                                                                       
##  [96] "B Activated Translation"                                                                                                      
##  [97] "B Activated Metabolism of amino acids and derivatives"                                                                        
##  [98] "B Activated Developmental Biology"                                                                                            
##  [99] "B Activated Metabolism of RNA"                                                                                                
## [100] "B Activated SARS-CoV Infections"                                                                                              
## [101] "B Activated Cellular responses to stress"                                                                                     
## [102] "B Activated Cellular responses to stimuli"                                                                                    
## [103] "B Activated Infectious disease"                                                                                               
## [104] "B Activated Disease"                                                                                                          
## [105] "B Activated Neutrophil degranulation"                                                                                         
## [106] "B Activated Metabolism of proteins"                                                                                           
## [107] "B Activated Metabolism"                                                                                                       
## [108] "B SARS-CoV-1 modulates host translation machinery"                                                                            
## [109] "B Peptide chain elongation"                                                                                                   
## [110] "B Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                               
## [111] "B Eukaryotic Translation Termination"                                                                                         
## [112] "B Viral mRNA Translation"                                                                                                     
## [113] "B Eukaryotic Translation Elongation"                                                                                          
## [114] "B Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                                        
## [115] "B Selenoamino acid metabolism"                                                                                                
## [116] "B Selenocysteine synthesis"                                                                                                   
## [117] "B Formation of a pool of free 40S subunits"                                                                                   
## [118] "B Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                                  
## [119] "B Nonsense-Mediated Decay (NMD)"                                                                                              
## [120] "B SARS-CoV-2 modulates host translation machinery"                                                                            
## [121] "B Major pathway of rRNA processing in the nucleolus and cytosol"                                                              
## [122] "B rRNA processing"                                                                                                            
## [123] "B rRNA processing in the nucleus and cytosol"                                                                                 
## [124] "B SRP-dependent cotranslational protein targeting to membrane"                                                                
## [125] "B Cap-dependent Translation Initiation"                                                                                       
## [126] "B Eukaryotic Translation Initiation"                                                                                          
## [127] "B L13a-mediated translational silencing of Ceruloplasmin expression"                                                          
## [128] "B GTP hydrolysis and joining of the 60S ribosomal subunit"                                                                    
## [129] "B Formation of the ternary complex, and subsequently, the 43S complex"                                                        
## [130] "B Cellular response to starvation"                                                                                            
## [131] "B Influenza Viral RNA Transcription and Replication"                                                                          
## [132] "B Influenza Infection"                                                                                                        
## [133] "B Activation of the mRNA upon binding of the cap-binding complex and eIFs, and subsequent binding to 43S"                     
## [134] "B Translation initiation complex formation"                                                                                   
## [135] "B Ribosomal scanning and start codon recognition"                                                                             
## [136] "B Regulation of expression of SLITs and ROBOs"                                                                                
## [137] "B Signaling by ROBO receptors"                                                                                                
## [138] "B SARS-CoV-1-host interactions"                                                                                               
## [139] "B Metabolism of amino acids and derivatives"                                                                                  
## [140] "B Translation"                                                                                                                
## [141] "B Axon guidance"                                                                                                              
## [142] "B Nervous system development"                                                                                                 
## [143] "B SARS-CoV-1 Infection"                                                                                                       
## [144] "B Developmental Biology"                                                                                                      
## [145] "B Cellular responses to stress"                                                                                               
## [146] "B Metabolism of RNA"                                                                                                          
## [147] "B Cellular responses to stimuli"                                                                                              
## [148] "B Metabolism"                                                                                                                 
## [149] "B Infectious disease"                                                                                                         
## [150] "B Disease"                                                                                                                    
## [151] "B Metabolism of proteins"                                                                                                     
## [152] "DC SARS-CoV-1 modulates host translation machinery"                                                                           
## [153] "DC Eukaryotic Translation Elongation"                                                                                         
## [154] "DC Peptide chain elongation"                                                                                                  
## [155] "DC Selenocysteine synthesis"                                                                                                  
## [156] "DC Viral mRNA Translation"                                                                                                    
## [157] "DC Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                                       
## [158] "DC Eukaryotic Translation Termination"                                                                                        
## [159] "DC Selenoamino acid metabolism"                                                                                               
## [160] "DC Formation of a pool of free 40S subunits"                                                                                  
## [161] "DC Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                              
## [162] "DC SARS-CoV-2 modulates host translation machinery"                                                                           
## [163] "DC L13a-mediated translational silencing of Ceruloplasmin expression"                                                         
## [164] "DC Formation of the ternary complex, and subsequently, the 43S complex"                                                       
## [165] "DC Cap-dependent Translation Initiation"                                                                                      
## [166] "DC Eukaryotic Translation Initiation"                                                                                         
## [167] "DC GTP hydrolysis and joining of the 60S ribosomal subunit"                                                                   
## [168] "DC SRP-dependent cotranslational protein targeting to membrane"                                                               
## [169] "DC Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                                 
## [170] "DC Nonsense-Mediated Decay (NMD)"                                                                                             
## [171] "DC Influenza Viral RNA Transcription and Replication"                                                                         
## [172] "DC Activation of the mRNA upon binding of the cap-binding complex and eIFs, and subsequent binding to 43S"                    
## [173] "DC Translation initiation complex formation"                                                                                  
## [174] "DC Ribosomal scanning and start codon recognition"                                                                            
## [175] "DC Major pathway of rRNA processing in the nucleolus and cytosol"                                                             
## [176] "DC Cellular response to starvation"                                                                                           
## [177] "DC rRNA processing in the nucleus and cytosol"                                                                                
## [178] "DC rRNA processing"                                                                                                           
## [179] "DC Influenza Infection"                                                                                                       
## [180] "DC Regulation of expression of SLITs and ROBOs"                                                                               
## [181] "DC Signaling by ROBO receptors"                                                                                               
## [182] "DC SARS-CoV-1-host interactions"                                                                                              
## [183] "DC Glycolysis"                                                                                                                
## [184] "DC Axon guidance"                                                                                                             
## [185] "DC Nervous system development"                                                                                                
## [186] "DC Metabolism of amino acids and derivatives"                                                                                 
## [187] "DC Translation"                                                                                                               
## [188] "DC Selective autophagy"                                                                                                       
## [189] "DC SARS-CoV-1 Infection"                                                                                                      
## [190] "DC Developmental Biology"                                                                                                     
## [191] "DC Cell-Cell communication"                                                                                                   
## [192] "DC Sensory Perception"                                                                                                        
## [193] "DC SARS-CoV-2-host interactions"                                                                                              
## [194] "DC EPH-Ephrin signaling"                                                                                                      
## [195] "DC MyD88:MAL(TIRAP) cascade initiated on plasma membrane"                                                                     
## [196] "DC Toll Like Receptor 2 (TLR2) Cascade"                                                                                       
## [197] "DC Toll Like Receptor TLR1:TLR2 Cascade"                                                                                      
## [198] "DC Toll Like Receptor TLR6:TLR2 Cascade"                                                                                      
## [199] "DC SARS-CoV-2 Infection"                                                                                                      
## [200] "DC Cellular responses to stress"                                                                                              
## [201] "DC Cellular responses to stimuli"                                                                                             
## [202] "DC Infectious disease"                                                                                                        
## [203] "DC Metabolism of RNA"                                                                                                         
## [204] "DC Platelet activation, signaling and aggregation"                                                                            
## [205] "DC SARS-CoV Infections"                                                                                                       
## [206] "DC Disease"                                                                                                                   
## [207] "DC Metabolism"                                                                                                                
## [208] "DC Hemostasis"                                                                                                                
## [209] "DC Metabolism of proteins"                                                                                                    
## [210] "CD16 Mono Eukaryotic Translation Elongation"                                                                                  
## [211] "CD16 Mono Peptide chain elongation"                                                                                           
## [212] "CD16 Mono Selenocysteine synthesis"                                                                                           
## [213] "CD16 Mono Viral mRNA Translation"                                                                                             
## [214] "CD16 Mono SARS-CoV-1 modulates host translation machinery"                                                                    
## [215] "CD16 Mono Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                       
## [216] "CD16 Mono Selenoamino acid metabolism"                                                                                        
## [217] "CD16 Mono EPHB-mediated forward signaling"                                                                                    
## [218] "CD16 Mono Eukaryotic Translation Termination"                                                                                 
## [219] "CD16 Mono Formation of a pool of free 40S subunits"                                                                           
## [220] "CD16 Mono SARS-CoV-2 modulates host translation machinery"                                                                    
## [221] "CD16 Mono L13a-mediated translational silencing of Ceruloplasmin expression"                                                  
## [222] "CD16 Mono Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                                
## [223] "CD16 Mono Influenza Viral RNA Transcription and Replication"                                                                  
## [224] "CD16 Mono Major pathway of rRNA processing in the nucleolus and cytosol"                                                      
## [225] "CD16 Mono Cap-dependent Translation Initiation"                                                                               
## [226] "CD16 Mono Eukaryotic Translation Initiation"                                                                                  
## [227] "CD16 Mono GTP hydrolysis and joining of the 60S ribosomal subunit"                                                            
## [228] "CD16 Mono rRNA processing in the nucleus and cytosol"                                                                         
## [229] "CD16 Mono SRP-dependent cotranslational protein targeting to membrane"                                                        
## [230] "CD16 Mono Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                          
## [231] "CD16 Mono Nonsense-Mediated Decay (NMD)"                                                                                      
## [232] "CD16 Mono rRNA processing"                                                                                                    
## [233] "CD16 Mono RHO GTPases Activate Formins"                                                                                       
## [234] "CD16 Mono Formation of the ternary complex, and subsequently, the 43S complex"                                                
## [235] "CD16 Mono Activation of the mRNA upon binding of the cap-binding complex and eIFs, and subsequent binding to 43S"             
## [236] "CD16 Mono Translation initiation complex formation"                                                                           
## [237] "CD16 Mono Ribosomal scanning and start codon recognition"                                                                     
## [238] "CD16 Mono EPH-Ephrin signaling"                                                                                               
## [239] "CD16 Mono Cellular response to starvation"                                                                                    
## [240] "CD16 Mono Influenza Infection"                                                                                                
## [241] "CD16 Mono Estrogen-dependent gene expression"                                                                                 
## [242] "CD16 Mono Glucose metabolism"                                                                                                 
## [243] "CD16 Mono Translation"                                                                                                        
## [244] "CD16 Mono Signaling by ROBO receptors"                                                                                        
## [245] "CD16 Mono Regulation of expression of SLITs and ROBOs"                                                                        
## [246] "CD16 Mono Metabolism of amino acids and derivatives"                                                                          
## [247] "CD16 Mono Platelet degranulation"                                                                                             
## [248] "CD16 Mono Response to elevated platelet cytosolic Ca2+"                                                                       
## [249] "CD16 Mono Metabolism of carbohydrates"                                                                                        
## [250] "CD16 Mono Axon guidance"                                                                                                      
## [251] "CD16 Mono Nervous system development"                                                                                         
## [252] "CD16 Mono RHO GTPase Effectors"                                                                                               
## [253] "CD16 Mono SARS-CoV-1-host interactions"                                                                                       
## [254] "CD16 Mono Developmental Biology"                                                                                              
## [255] "CD16 Mono Metabolism of RNA"                                                                                                  
## [256] "CD16 Mono SARS-CoV-1 Infection"                                                                                               
## [257] "CD16 Mono Infectious disease"                                                                                                 
## [258] "CD16 Mono Cellular responses to stress"                                                                                       
## [259] "CD16 Mono Metabolism"                                                                                                         
## [260] "CD16 Mono Cellular responses to stimuli"                                                                                      
## [261] "CD16 Mono SARS-CoV Infections"                                                                                                
## [262] "CD16 Mono Disease"                                                                                                            
## [263] "CD16 Mono Metabolism of proteins"                                                                                             
## [264] "NK Peptide chain elongation"                                                                                                  
## [265] "NK Selenoamino acid metabolism"                                                                                               
## [266] "NK Selenocysteine synthesis"                                                                                                  
## [267] "NK Eukaryotic Translation Termination"                                                                                        
## [268] "NK Major pathway of rRNA processing in the nucleolus and cytosol"                                                             
## [269] "NK Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                                       
## [270] "NK Viral mRNA Translation"                                                                                                    
## [271] "NK Eukaryotic Translation Elongation"                                                                                         
## [272] "NK Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                              
## [273] "NK rRNA processing in the nucleus and cytosol"                                                                                
## [274] "NK SARS-CoV-1 modulates host translation machinery"                                                                           
## [275] "NK rRNA processing"                                                                                                           
## [276] "NK Cellular response to starvation"                                                                                           
## [277] "NK Influenza Viral RNA Transcription and Replication"                                                                         
## [278] "NK Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                                 
## [279] "NK Nonsense-Mediated Decay (NMD)"                                                                                             
## [280] "NK SARS-CoV-2 modulates host translation machinery"                                                                           
## [281] "NK Formation of a pool of free 40S subunits"                                                                                  
## [282] "NK Influenza Infection"                                                                                                       
## [283] "NK SRP-dependent cotranslational protein targeting to membrane"                                                               
## [284] "NK GTP hydrolysis and joining of the 60S ribosomal subunit"                                                                   
## [285] "NK L13a-mediated translational silencing of Ceruloplasmin expression"                                                         
## [286] "NK Cap-dependent Translation Initiation"                                                                                      
## [287] "NK Eukaryotic Translation Initiation"                                                                                         
## [288] "NK Signaling by ROBO receptors"                                                                                               
## [289] "NK Regulation of expression of SLITs and ROBOs"                                                                               
## [290] "NK Metabolism of amino acids and derivatives"                                                                                 
## [291] "NK SARS-CoV-1-host interactions"                                                                                              
## [292] "NK Axon guidance"                                                                                                             
## [293] "NK Nervous system development"                                                                                                
## [294] "NK Formation of the ternary complex, and subsequently, the 43S complex"                                                       
## [295] "NK Ribosomal scanning and start codon recognition"                                                                            
## [296] "NK SARS-CoV-1 Infection"                                                                                                      
## [297] "NK Translation initiation complex formation"                                                                                  
## [298] "NK Translation"                                                                                                               
## [299] "NK Activation of the mRNA upon binding of the cap-binding complex and eIFs, and subsequent binding to 43S"                    
## [300] "NK Developmental Biology"                                                                                                     
## [301] "NK Cellular responses to stress"                                                                                              
## [302] "NK Cellular responses to stimuli"                                                                                             
## [303] "NK SARS-CoV-2-host interactions"                                                                                              
## [304] "NK Metabolism of RNA"                                                                                                         
## [305] "NK Infectious disease"                                                                                                        
## [306] "NK SARS-CoV-2 Infection"                                                                                                      
## [307] "NK Metabolism"                                                                                                                
## [308] "NK SARS-CoV Infections"                                                                                                       
## [309] "NK Disease"                                                                                                                   
## [310] "NK Metabolism of proteins"

Compare pathway results

v1 <- list("ORA up"=up_sets, "ORA fix up"=fixup_sets)
v2 <- list("ORA dn"=dn_sets, "ORA fix dn"=fixdn_sets)
v3 <- list("ORA"=union(up_sets,dn_sets),
  "ORA fix"=union(fixup_sets,fixdn_sets))

par(mar=c(10,10,10,10))
par(mfrow=c(2,1))
plot(euler(v1),quantities = list(cex = 2), labels = list(cex = 2),main="upregulated Reactomes")

plot(euler(v2),quantities = list(cex = 2), labels = list(cex = 2),main="downregulated Reactomes")

plot(euler(v3),quantities = list(cex = 2), labels = list(cex = 2),main="up- and down-regulated Reactomes")

png("scrna2_reactome_euler.png")
plot(euler(v3),quantities = list(cex = 2), labels = list(cex = 2),main="up- and down-regulated Reactomes")
dev.off()
## png 
##   2

Jaccard index comparing ORA and ORA fix.

jaccard <- function(a, b) {
    intersection = length(intersect(a, b))
    union = length(a) + length(b) - intersection
    return (intersection/union)
}

ora <- c(up_sets,dn_sets)
orafix <- c(fixup_sets,fixdn_sets)

jaccard(ora,orafix)
## [1] 0.9282178

List gene sets identified only in the “fixed” analysis.

setdiff(orafix,ora)
##  [1] "CD14 Mono Dual incision in TC-NER"                                
##  [2] "CD14 Mono Gap-filling DNA repair synthesis and ligation in TC-NER"
##  [3] "CD14 Mono DNA Repair"                                             
##  [4] "CD14 Mono SARS-CoV-1 Infection"                                   
##  [5] "CD14 Mono RNA Polymerase II Transcription"                        
##  [6] "CD14 Mono Gene expression (Transcription)"                        
##  [7] "B Activated Neutrophil degranulation"                             
##  [8] "B Activated Metabolism"                                           
##  [9] "DC Cell-Cell communication"                                       
## [10] "DC Sensory Perception"                                            
## [11] "DC EPH-Ephrin signaling"                                          
## [12] "DC MyD88:MAL(TIRAP) cascade initiated on plasma membrane"         
## [13] "DC Toll Like Receptor 2 (TLR2) Cascade"                           
## [14] "DC Toll Like Receptor TLR1:TLR2 Cascade"                          
## [15] "DC Toll Like Receptor TLR6:TLR2 Cascade"                          
## [16] "DC Platelet activation, signaling and aggregation"                
## [17] "DC Hemostasis"                                                    
## [18] "CD16 Mono Glucose metabolism"                                     
## [19] "CD16 Mono RHO GTPase Effectors"                                   
## [20] "CD16 Mono SARS-CoV-1 Infection"                                   
## [21] "CD16 Mono SARS-CoV Infections"

Session information

For reproducibility


Click HERE to show session info

sessionInfo()
## R version 4.3.1 (2023-06-16)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 22.04.3 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
## 
## locale:
##  [1] LC_CTYPE=en_AU.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_AU.UTF-8        LC_COLLATE=en_AU.UTF-8    
##  [5] LC_MONETARY=en_AU.UTF-8    LC_MESSAGES=en_AU.UTF-8   
##  [7] LC_PAPER=en_AU.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C       
## 
## time zone: Australia/Melbourne
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] gplots_3.1.3                eulerr_7.0.0               
##  [3] fgsea_1.26.0                clusterProfiler_4.8.3      
##  [5] kableExtra_1.3.4            DESeq2_1.40.2              
##  [7] SummarizedExperiment_1.30.2 Biobase_2.60.0             
##  [9] MatrixGenerics_1.12.3       matrixStats_1.0.0          
## [11] GenomicRanges_1.52.0        GenomeInfoDb_1.36.2        
## [13] IRanges_2.34.1              S4Vectors_0.38.1           
## [15] BiocGenerics_0.46.0         getDEE2_1.10.0             
## 
## loaded via a namespace (and not attached):
##   [1] RColorBrewer_1.1-3      rstudioapi_0.15.0       jsonlite_1.8.7         
##   [4] magrittr_2.0.3          farver_2.1.1            rmarkdown_2.24         
##   [7] zlibbioc_1.46.0         vctrs_0.6.3             memoise_2.0.1          
##  [10] RCurl_1.98-1.12         ggtree_3.8.2            webshot_0.5.5          
##  [13] htmltools_0.5.6         S4Arrays_1.0.6          gridGraphics_0.5-1     
##  [16] sass_0.4.7              KernSmooth_2.23-22      bslib_0.5.1            
##  [19] plyr_1.8.8              cachem_1.0.8            igraph_1.5.1           
##  [22] lifecycle_1.0.3         pkgconfig_2.0.3         gson_0.1.0             
##  [25] Matrix_1.6-1            R6_2.5.1                fastmap_1.1.1          
##  [28] GenomeInfoDbData_1.2.10 digest_0.6.33           aplot_0.2.0            
##  [31] enrichplot_1.20.1       colorspace_2.1-0        patchwork_1.1.3        
##  [34] AnnotationDbi_1.62.2    RSQLite_2.3.1           fansi_1.0.4            
##  [37] httr_1.4.7              polyclip_1.10-4         abind_1.4-5            
##  [40] compiler_4.3.1          bit64_4.0.5             withr_2.5.0            
##  [43] downloader_0.4          BiocParallel_1.34.2     viridis_0.6.4          
##  [46] DBI_1.1.3               highr_0.10              ggforce_0.4.1          
##  [49] MASS_7.3-60             DelayedArray_0.26.7     HDO.db_0.99.1          
##  [52] caTools_1.18.2          gtools_3.9.4            tools_4.3.1            
##  [55] scatterpie_0.2.1        ape_5.7-1               glue_1.6.2             
##  [58] nlme_3.1-163            GOSemSim_2.26.1         polylabelr_0.2.0       
##  [61] shadowtext_0.1.2        grid_4.3.1              reshape2_1.4.4         
##  [64] generics_0.1.3          gtable_0.3.4            tidyr_1.3.0            
##  [67] data.table_1.14.8       tidygraph_1.2.3         xml2_1.3.5             
##  [70] utf8_1.2.3              XVector_0.40.0          ggrepel_0.9.3          
##  [73] pillar_1.9.0            stringr_1.5.0           yulab.utils_0.0.9      
##  [76] splines_4.3.1           dplyr_1.1.3             tweenr_2.0.2           
##  [79] treeio_1.24.3           lattice_0.21-8          bit_4.0.5              
##  [82] tidyselect_1.2.0        GO.db_3.17.0            locfit_1.5-9.8         
##  [85] Biostrings_2.68.1       knitr_1.43              gridExtra_2.3          
##  [88] svglite_2.1.1           xfun_0.40               graphlayouts_1.0.0     
##  [91] stringi_1.7.12          lazyeval_0.2.2          ggfun_0.1.2            
##  [94] yaml_2.3.7              evaluate_0.21           codetools_0.2-19       
##  [97] ggraph_2.1.0            tibble_3.2.1            qvalue_2.32.0          
## [100] ggplotify_0.1.2         cli_3.6.1               systemfonts_1.0.4      
## [103] munsell_0.5.0           jquerylib_0.1.4         Rcpp_1.0.11            
## [106] png_0.1-8               parallel_4.3.1          ggplot2_3.4.3          
## [109] blob_1.2.4              DOSE_3.26.1             htm2txt_2.2.2          
## [112] bitops_1.0-7            viridisLite_0.4.2       tidytree_0.4.5         
## [115] scales_1.2.1            purrr_1.0.2             crayon_1.5.2           
## [118] rlang_1.1.1             cowplot_1.1.1           fastmatch_1.1-4        
## [121] KEGGREST_1.40.0         rvest_1.0.3