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

Introduction

Load libraries and dataset.

load("muscat_vignette.RData")

ls()
##  [1] "cs_by_k"    "cs100"      "de_gs_by_k" "def"        "dn_sets"   
##  [6] "dns"        "dr"         "eh"         "fixdn_sets" "fixdns"    
## [11] "fixup_sets" "fixups"     "frq"        "frq10"      "genesets2" 
## [16] "gids"       "gsets"      "jaccard"    "k1"         "kids"      
## [21] "n_de"       "nk"         "ns"         "ol"         "ora"       
## [26] "orafix"     "orafixsets" "orasets"    "p_de"       "pb"        
## [31] "pb_mds"     "ps"         "ps_tsne"    "ps_umap"    "qc"        
## [36] "res"        "sce"        "sids"       "tbl"        "tbl_fil"   
## [41] "tbl_fil2"   "top2"       "top8"       "up_sets"    "ups"       
## [46] "v1"         "v2"         "v3"
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 Muscat vignette.

Focusing on CD4 T-cells.

names(tbl)
## [1] "B cells"           "CD14+ Monocytes"   "CD4 T cells"      
## [4] "CD8 T cells"       "Dendritic cells"   "FCGR3A+ Monocytes"
## [7] "Megakaryocytes"    "NK cells"
message("Total detected genes in each cluster and differentially expressed")
## Total detected genes in each cluster and differentially expressed
lapply(tbl, function(x) {
  nsig <- nrow(subset(x,p_adj.loc<0.05))
  ntot <- nrow(x)
  c(ntot,nsig)
} )
## $`B cells`
## [1] 1967  630
## 
## $`CD14+ Monocytes`
## [1] 3783 2408
## 
## $`CD4 T cells`
## [1] 5158 1135
## 
## $`CD8 T cells`
## [1] 1276  298
## 
## $`Dendritic cells`
## [1] 491 182
## 
## $`FCGR3A+ Monocytes`
## [1] 1698  910
## 
## $Megakaryocytes
## [1] 270  31
## 
## $`NK cells`
## [1] 1732  462
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
gene cluster_id logFC logCPM F p_val p_adj.loc p_adj.glb contrast
NOC2L CD4 T cells 0.0910082 6.216100 0.5023970 0.4852317 0.6877783 0.6323301 stim
HES4 CD4 T cells 1.8668514 4.672222 27.2979773 0.0000231 0.0003084 0.0001515 stim
ISG15 CD4 T cells 4.9031126 11.733097 448.6998912 0.0000000 0.0000000 0.0000000 stim
TNFRSF18 CD4 T cells -0.0938135 5.346666 0.0696188 0.7941298 0.9066228 0.8792343 stim
TNFRSF4 CD4 T cells 0.3725061 6.497121 1.8176922 0.1900917 0.3842058 0.3201102 stim
SDF4 CD4 T cells -0.2750367 5.939776 3.0151886 0.0952230 0.2400587 0.1862935 stim

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 Genes with >=10 reads per sample on average across all samples
Gene Selection Criteria Muscat FDR<0.05 CD4 T-cells
ORA directionality Separate tests for up- and down-regulation
Data availability R/Experiment hub “Kang” or GSE96583.
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(x$gene)
  up <- unique(subset(x,p_adj.loc<0.05&logFC>0)$gene)
  dn <- unique(subset(x,p_adj.loc<0.05&logFC<0)$gene)
  return(list("bg"=bg,"up"=up,"dn"=dn))
} )

str(def)
## List of 8
##  $ B cells          :List of 3
##   ..$ bg: chr [1:1967] "NOC2L" "ISG15" "TNFRSF18" "CPSF3L" ...
##   ..$ up: chr [1:348] "ISG15" "FBXO6" "SZRD1" "TMEM50A" ...
##   ..$ dn: chr [1:282] "TNFRSF18" "PRDM2" "ID3" "STMN1" ...
##  $ CD14+ Monocytes  :List of 3
##   ..$ bg: chr [1:3783] "HES4" "ISG15" "SDF4" "UBE2J2" ...
##   ..$ up: chr [1:1120] "HES4" "ISG15" "NADK" "GNB1" ...
##   ..$ dn: chr [1:1288] "SDF4" "UBE2J2" "CPSF3L" "AURKAIP1" ...
##  $ CD4 T cells      :List of 3
##   ..$ bg: chr [1:5158] "NOC2L" "HES4" "ISG15" "TNFRSF18" ...
##   ..$ up: chr [1:637] "HES4" "ISG15" "TNFRSF14" "ENO1" ...
##   ..$ dn: chr [1:498] "MIB2" "PGD" "SPEN" "AKR7A2" ...
##  $ CD8 T cells      :List of 3
##   ..$ bg: chr [1:1276] "ISG15" "AURKAIP1" "MRPL20" "SSU72" ...
##   ..$ up: chr [1:181] "ISG15" "IFI6" "IFI44L" "IFI44" ...
##   ..$ dn: chr [1:117] "RPL22" "SH3BGRL3" "ATPIF1" "LAPTM5" ...
##  $ Dendritic cells  :List of 3
##   ..$ bg: chr [1:491] "HES4" "ISG15" "RPL22" "PARK7" ...
##   ..$ up: chr [1:113] "HES4" "ISG15" "TMEM50A" "IFI6" ...
##   ..$ dn: chr [1:69] "RPL22" "ENO1" "SH3BGRL3" "ATP6V0B" ...
##  $ FCGR3A+ Monocytes:List of 3
##   ..$ bg: chr [1:1698] "HES4" "ISG15" "AURKAIP1" "MRPL20" ...
##   ..$ up: chr [1:500] "HES4" "ISG15" "NADK" "GNB1" ...
##   ..$ dn: chr [1:410] "AURKAIP1" "MRPL20" "SSU72" "RPL22" ...
##  $ Megakaryocytes   :List of 3
##   ..$ bg: chr [1:270] "ISG15" "PARK7" "ENO1" "RPL11" ...
##   ..$ up: chr [1:29] "ISG15" "IFI6" "IFI44L" "SELL" ...
##   ..$ dn: chr [1:2] "VIM" "GAPDH"
##  $ NK cells         :List of 3
##   ..$ bg: chr [1:1732] "ISG15" "TNFRSF18" "TNFRSF4" "SDF4" ...
##   ..$ up: chr [1:258] "ISG15" "FBXO6" "IFI6" "THEMIS2" ...
##   ..$ dn: chr [1:204] "RPL22" "PARK7" "ENO1" "SRM" ...

Enrichment firstly with upregulated genes

ups <- lapply(1:length(def),function(i) {
  ora(def[[i]]$up,def[[i]]$bg,genesets=genesets2)
})
## No gene sets have size between 10 and 5000 ...
## --> return NULL...
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] 17
up_sets
##  [1] "B cells KEGG_RIG_I_LIKE_RECEPTOR_SIGNALING_PATHWAY"         
##  [2] "B cells KEGG_CYTOSOLIC_DNA_SENSING_PATHWAY"                 
##  [3] "B cells KEGG_ANTIGEN_PROCESSING_AND_PRESENTATION"           
##  [4] "B cells KEGG_CYTOKINE_CYTOKINE_RECEPTOR_INTERACTION"        
##  [5] "B cells KEGG_CHEMOKINE_SIGNALING_PATHWAY"                   
##  [6] "CD14+ Monocytes KEGG_RIG_I_LIKE_RECEPTOR_SIGNALING_PATHWAY" 
##  [7] "CD14+ Monocytes KEGG_NOD_LIKE_RECEPTOR_SIGNALING_PATHWAY"   
##  [8] "CD14+ Monocytes KEGG_APOPTOSIS"                             
##  [9] "CD14+ Monocytes KEGG_CHEMOKINE_SIGNALING_PATHWAY"           
## [10] "CD14+ Monocytes KEGG_CYTOKINE_CYTOKINE_RECEPTOR_INTERACTION"
## [11] "CD4 T cells KEGG_CYTOSOLIC_DNA_SENSING_PATHWAY"             
## [12] "CD4 T cells KEGG_RIG_I_LIKE_RECEPTOR_SIGNALING_PATHWAY"     
## [13] "CD4 T cells KEGG_APOPTOSIS"                                 
## [14] "Dendritic cells KEGG_ANTIGEN_PROCESSING_AND_PRESENTATION"   
## [15] "NK cells KEGG_CYTOSOLIC_DNA_SENSING_PATHWAY"                
## [16] "NK cells KEGG_ANTIGEN_PROCESSING_AND_PRESENTATION"          
## [17] "NK cells KEGG_RIG_I_LIKE_RECEPTOR_SIGNALING_PATHWAY"

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] 10
dn_sets
##  [1] "CD14+ Monocytes KEGG_MTOR_SIGNALING_PATHWAY"
##  [2] "CD14+ Monocytes KEGG_RIBOSOME"              
##  [3] "CD14+ Monocytes KEGG_HUNTINGTONS_DISEASE"   
##  [4] "CD14+ Monocytes KEGG_SPLICEOSOME"           
##  [5] "CD14+ Monocytes KEGG_PARKINSONS_DISEASE"    
##  [6] "CD8 T cells KEGG_RIBOSOME"                  
##  [7] "Dendritic cells KEGG_RIBOSOME"              
##  [8] "FCGR3A+ Monocytes KEGG_RIBOSOME"            
##  [9] "FCGR3A+ Monocytes KEGG_HUNTINGTONS_DISEASE" 
## [10] "NK cells 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 Genes with >=10 reads per sample on average across all samples
Gene Selection Criteria DESeq2 FDR<0.05
ORA directionality Separate tests for up- and down-regulation
Data availability R/Experiment hub “Kang” or GSE96583.
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] 11
fixup_sets
##  [1] "B cells KEGG_RIG_I_LIKE_RECEPTOR_SIGNALING_PATHWAY"        
##  [2] "CD14+ Monocytes KEGG_RIG_I_LIKE_RECEPTOR_SIGNALING_PATHWAY"
##  [3] "CD14+ Monocytes KEGG_NOD_LIKE_RECEPTOR_SIGNALING_PATHWAY"  
##  [4] "CD14+ Monocytes KEGG_CHEMOKINE_SIGNALING_PATHWAY"          
##  [5] "CD4 T cells KEGG_CYTOSOLIC_DNA_SENSING_PATHWAY"            
##  [6] "CD4 T cells KEGG_RIG_I_LIKE_RECEPTOR_SIGNALING_PATHWAY"    
##  [7] "CD4 T cells KEGG_P53_SIGNALING_PATHWAY"                    
##  [8] "CD4 T cells KEGG_APOPTOSIS"                                
##  [9] "CD4 T cells KEGG_ANTIGEN_PROCESSING_AND_PRESENTATION"      
## [10] "CD4 T cells KEGG_JAK_STAT_SIGNALING_PATHWAY"               
## [11] "NK cells 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] 12
fixdn_sets
##  [1] "B cells KEGG_RIBOSOME"                         
##  [2] "CD14+ Monocytes KEGG_MTOR_SIGNALING_PATHWAY"   
##  [3] "CD14+ Monocytes KEGG_RIBOSOME"                 
##  [4] "CD14+ Monocytes KEGG_HUNTINGTONS_DISEASE"      
##  [5] "CD14+ Monocytes KEGG_SPLICEOSOME"              
##  [6] "CD14+ Monocytes KEGG_PARKINSONS_DISEASE"       
##  [7] "CD14+ Monocytes KEGG_OXIDATIVE_PHOSPHORYLATION"
##  [8] "CD14+ Monocytes KEGG_ALZHEIMERS_DISEASE"       
##  [9] "CD8 T cells KEGG_RIBOSOME"                     
## [10] "Dendritic cells KEGG_RIBOSOME"                 
## [11] "FCGR3A+ Monocytes KEGG_RIBOSOME"               
## [12] "FCGR3A+ Monocytes KEGG_HUNTINGTONS_DISEASE"

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("scrna_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.5151515

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 Genes with >=10 reads per sample on average across all samples
Gene Selection Criteria DESeq2 FDR<0.05
ORA directionality Separate tests for up- and down-regulation
Data availability R/Experiment hub “Kang” or GSE96583.
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] 85
up_sets
##  [1] "B cells Interferon alpha/beta signaling"                                                                    
##  [2] "B cells Interferon gamma signaling"                                                                         
##  [3] "B cells Interferon Signaling"                                                                               
##  [4] "B cells Antiviral mechanism by IFN-stimulated genes"                                                        
##  [5] "B cells Cytokine Signaling in Immune system"                                                                
##  [6] "B cells Immune System"                                                                                      
##  [7] "CD14+ Monocytes Interferon alpha/beta signaling"                                                            
##  [8] "CD14+ Monocytes Interferon gamma signaling"                                                                 
##  [9] "CD14+ Monocytes TNFR1-induced NFkappaB signaling pathway"                                                   
## [10] "CD14+ Monocytes Regulation of necroptotic cell death"                                                       
## [11] "CD14+ Monocytes RIPK1-mediated regulated necrosis"                                                          
## [12] "CD14+ Monocytes Chemokine receptors bind chemokines"                                                        
## [13] "CD14+ Monocytes Regulation of TNFR1 signaling"                                                              
## [14] "CD14+ Monocytes TNF signaling"                                                                              
## [15] "CD14+ Monocytes Interferon Signaling"                                                                       
## [16] "CD14+ Monocytes Nucleotide-binding domain, leucine rich repeat containing receptor (NLR) signaling pathways"
## [17] "CD14+ Monocytes Regulated Necrosis"                                                                         
## [18] "CD14+ Monocytes GPCR ligand binding"                                                                        
## [19] "CD14+ Monocytes Class A/1 (Rhodopsin-like receptors)"                                                       
## [20] "CD14+ Monocytes DDX58/IFIH1-mediated induction of interferon-alpha/beta"                                    
## [21] "CD14+ Monocytes Death Receptor Signaling"                                                                   
## [22] "CD14+ Monocytes Cytokine Signaling in Immune system"                                                        
## [23] "CD14+ Monocytes Immune System"                                                                              
## [24] "CD14+ Monocytes Innate Immune System"                                                                       
## [25] "CD4 T cells Interferon alpha/beta signaling"                                                                
## [26] "CD4 T cells Interferon gamma signaling"                                                                     
## [27] "CD4 T cells Caspase activation via extrinsic apoptotic signalling pathway"                                  
## [28] "CD4 T cells Regulation of innate immune responses to cytosolic DNA"                                         
## [29] "CD4 T cells Interferon Signaling"                                                                           
## [30] "CD4 T cells Apoptotic factor-mediated response"                                                             
## [31] "CD4 T cells Peptide ligand-binding receptors"                                                               
## [32] "CD4 T cells Pyroptosis"                                                                                     
## [33] "CD4 T cells Regulated Necrosis"                                                                             
## [34] "CD4 T cells Regulation of necroptotic cell death"                                                           
## [35] "CD4 T cells RIPK1-mediated regulated necrosis"                                                              
## [36] "CD4 T cells Regulation of TNFR1 signaling"                                                                  
## [37] "CD4 T cells DDX58/IFIH1-mediated induction of interferon-alpha/beta"                                        
## [38] "CD4 T cells TNF signaling"                                                                                  
## [39] "CD4 T cells Cytosolic sensors of pathogen-associated DNA"                                                   
## [40] "CD4 T cells Cytokine Signaling in Immune system"                                                            
## [41] "CD4 T cells Antiviral mechanism by IFN-stimulated genes"                                                    
## [42] "CD4 T cells Death Receptor Signaling"                                                                       
## [43] "CD4 T cells Interleukin-1 family signaling"                                                                 
## [44] "CD4 T cells Toll-like Receptor Cascades"                                                                    
## [45] "CD4 T cells Signaling by Interleukins"                                                                      
## [46] "CD4 T cells Programmed Cell Death"                                                                          
## [47] "CD4 T cells Apoptosis"                                                                                      
## [48] "CD4 T cells Immune System"                                                                                  
## [49] "CD4 T cells Innate Immune System"                                                                           
## [50] "CD8 T cells Interferon alpha/beta signaling"                                                                
## [51] "CD8 T cells Interferon gamma signaling"                                                                     
## [52] "CD8 T cells Interferon Signaling"                                                                           
## [53] "CD8 T cells Antiviral mechanism by IFN-stimulated genes"                                                    
## [54] "CD8 T cells ISG15 antiviral mechanism"                                                                      
## [55] "CD8 T cells Cytokine Signaling in Immune system"                                                            
## [56] "CD8 T cells Immune System"                                                                                  
## [57] "Dendritic cells Interferon alpha/beta signaling"                                                            
## [58] "Dendritic cells Interferon gamma signaling"                                                                 
## [59] "Dendritic cells Interferon Signaling"                                                                       
## [60] "Dendritic cells Antiviral mechanism by IFN-stimulated genes"                                                
## [61] "Dendritic cells Cytokine Signaling in Immune system"                                                        
## [62] "Dendritic cells Immune System"                                                                              
## [63] "FCGR3A+ Monocytes Interferon alpha/beta signaling"                                                          
## [64] "FCGR3A+ Monocytes TNFR1-induced NFkappaB signaling pathway"                                                 
## [65] "FCGR3A+ Monocytes Immunoregulatory interactions between a Lymphoid and a non-Lymphoid cell"                 
## [66] "FCGR3A+ Monocytes Interferon Signaling"                                                                     
## [67] "FCGR3A+ Monocytes Interferon gamma signaling"                                                               
## [68] "FCGR3A+ Monocytes Regulation of TNFR1 signaling"                                                            
## [69] "FCGR3A+ Monocytes TNF signaling"                                                                            
## [70] "FCGR3A+ Monocytes Peptide ligand-binding receptors"                                                         
## [71] "FCGR3A+ Monocytes Antiviral mechanism by IFN-stimulated genes"                                              
## [72] "FCGR3A+ Monocytes GPCR ligand binding"                                                                      
## [73] "FCGR3A+ Monocytes Cytokine Signaling in Immune system"                                                      
## [74] "FCGR3A+ Monocytes Immune System"                                                                            
## [75] "Megakaryocytes Interferon alpha/beta signaling"                                                             
## [76] "Megakaryocytes Interferon Signaling"                                                                        
## [77] "Megakaryocytes Cytokine Signaling in Immune system"                                                         
## [78] "Megakaryocytes Immune System"                                                                               
## [79] "NK cells Interferon alpha/beta signaling"                                                                   
## [80] "NK cells Interferon gamma signaling"                                                                        
## [81] "NK cells Interferon Signaling"                                                                              
## [82] "NK cells Interleukin-4 and Interleukin-13 signaling"                                                        
## [83] "NK cells Antiviral mechanism by IFN-stimulated genes"                                                       
## [84] "NK cells Cytokine Signaling in Immune system"                                                               
## [85] "NK cells 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] 211
dn_sets
##   [1] "B cells Detoxification of Reactive Oxygen Species"                                                                                  
##   [2] "B cells SARS-CoV-1 modulates host translation machinery"                                                                            
##   [3] "B cells Eukaryotic Translation Elongation"                                                                                          
##   [4] "B cells Peptide chain elongation"                                                                                                   
##   [5] "B cells Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                               
##   [6] "B cells Viral mRNA Translation"                                                                                                     
##   [7] "B cells Selenocysteine synthesis"                                                                                                   
##   [8] "B cells Formation of a pool of free 40S subunits"                                                                                   
##   [9] "B cells Eukaryotic Translation Termination"                                                                                         
##  [10] "B cells Selenoamino acid metabolism"                                                                                                
##  [11] "B cells Cap-dependent Translation Initiation"                                                                                       
##  [12] "B cells Eukaryotic Translation Initiation"                                                                                          
##  [13] "B cells L13a-mediated translational silencing of Ceruloplasmin expression"                                                          
##  [14] "B cells Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                                        
##  [15] "B cells Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                                  
##  [16] "B cells Nonsense-Mediated Decay (NMD)"                                                                                              
##  [17] "B cells GTP hydrolysis and joining of the 60S ribosomal subunit"                                                                    
##  [18] "B cells SRP-dependent cotranslational protein targeting to membrane"                                                                
##  [19] "B cells Influenza Viral RNA Transcription and Replication"                                                                          
##  [20] "CD14+ Monocytes MicroRNA (miRNA) biogenesis"                                                                                        
##  [21] "CD14+ Monocytes FGFR2 mutant receptor activation"                                                                                   
##  [22] "CD14+ Monocytes Signaling by FGFR2 IIIa TM"                                                                                         
##  [23] "CD14+ Monocytes mRNA Splicing - Minor Pathway"                                                                                      
##  [24] "CD14+ Monocytes Activation of the mRNA upon binding of the cap-binding complex and eIFs, and subsequent binding to 43S"             
##  [25] "CD14+ Monocytes Ribosomal scanning and start codon recognition"                                                                     
##  [26] "CD14+ Monocytes Translation initiation complex formation"                                                                           
##  [27] "CD14+ Monocytes Formation of the ternary complex, and subsequently, the 43S complex"                                                
##  [28] "CD14+ Monocytes mRNA Capping"                                                                                                       
##  [29] "CD14+ Monocytes RNA Polymerase I Transcription Initiation"                                                                          
##  [30] "CD14+ Monocytes L13a-mediated translational silencing of Ceruloplasmin expression"                                                  
##  [31] "CD14+ Monocytes Metabolism of non-coding RNA"                                                                                       
##  [32] "CD14+ Monocytes snRNP Assembly"                                                                                                     
##  [33] "CD14+ Monocytes Cap-dependent Translation Initiation"                                                                               
##  [34] "CD14+ Monocytes Eukaryotic Translation Initiation"                                                                                  
##  [35] "CD14+ Monocytes GTP hydrolysis and joining of the 60S ribosomal subunit"                                                            
##  [36] "CD14+ Monocytes Formation of a pool of free 40S subunits"                                                                           
##  [37] "CD14+ Monocytes RNA Pol II CTD phosphorylation and interaction with CE"                                                             
##  [38] "CD14+ Monocytes RNA Pol II CTD phosphorylation and interaction with CE during HIV infection"                                        
##  [39] "CD14+ Monocytes Gene Silencing by RNA"                                                                                              
##  [40] "CD14+ Monocytes Transcriptional regulation by small RNAs"                                                                           
##  [41] "CD14+ Monocytes Eukaryotic Translation Elongation"                                                                                  
##  [42] "CD14+ Monocytes Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                       
##  [43] "CD14+ Monocytes SARS-CoV-2 modulates host translation machinery"                                                                    
##  [44] "CD14+ Monocytes Peptide chain elongation"                                                                                           
##  [45] "CD14+ Monocytes Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                                
##  [46] "CD14+ Monocytes Processing of Capped Intronless Pre-mRNA"                                                                           
##  [47] "CD14+ Monocytes Eukaryotic Translation Termination"                                                                                 
##  [48] "CD14+ Monocytes Selenoamino acid metabolism"                                                                                        
##  [49] "CD14+ Monocytes Selenocysteine synthesis"                                                                                           
##  [50] "CD14+ Monocytes Viral mRNA Translation"                                                                                             
##  [51] "CD14+ Monocytes FGFR2 alternative splicing"                                                                                         
##  [52] "CD14+ Monocytes Influenza Viral RNA Transcription and Replication"                                                                  
##  [53] "CD14+ Monocytes Regulation of PTEN gene transcription"                                                                              
##  [54] "CD14+ Monocytes Formation of HIV-1 elongation complex containing HIV-1 Tat"                                                         
##  [55] "CD14+ Monocytes HIV Transcription Elongation"                                                                                       
##  [56] "CD14+ Monocytes Tat-mediated elongation of the HIV-1 transcript"                                                                    
##  [57] "CD14+ Monocytes Viral Messenger RNA Synthesis"                                                                                      
##  [58] "CD14+ Monocytes Major pathway of rRNA processing in the nucleolus and cytosol"                                                      
##  [59] "CD14+ Monocytes SARS-CoV-1 modulates host translation machinery"                                                                    
##  [60] "CD14+ Monocytes rRNA processing"                                                                                                    
##  [61] "CD14+ Monocytes Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                          
##  [62] "CD14+ Monocytes Nonsense-Mediated Decay (NMD)"                                                                                      
##  [63] "CD14+ Monocytes rRNA processing in the nucleus and cytosol"                                                                         
##  [64] "CD14+ Monocytes Influenza Infection"                                                                                                
##  [65] "CD14+ Monocytes Translation"                                                                                                        
##  [66] "CD14+ Monocytes Cellular response to starvation"                                                                                    
##  [67] "CD14+ Monocytes Mitochondrial protein import"                                                                                       
##  [68] "CD14+ Monocytes SRP-dependent cotranslational protein targeting to membrane"                                                        
##  [69] "CD14+ Monocytes Transcription of the HIV genome"                                                                                    
##  [70] "CD14+ Monocytes Regulation of expression of SLITs and ROBOs"                                                                        
##  [71] "CD14+ Monocytes Mitochondrial translation elongation"                                                                               
##  [72] "CD14+ Monocytes Respiratory electron transport"                                                                                     
##  [73] "CD14+ Monocytes Metabolism of amino acids and derivatives"                                                                          
##  [74] "CD14+ Monocytes Mitochondrial translation initiation"                                                                               
##  [75] "CD14+ Monocytes Mitochondrial translation termination"                                                                              
##  [76] "CD14+ Monocytes Mitochondrial translation"                                                                                          
##  [77] "CD14+ Monocytes Signaling by ROBO receptors"                                                                                        
##  [78] "CD14+ Monocytes The citric acid (TCA) cycle and respiratory electron transport"                                                     
##  [79] "CD14+ Monocytes Respiratory electron transport, ATP synthesis by chemiosmotic coupling, and heat production by uncoupling proteins."
##  [80] "CD14+ Monocytes mRNA Splicing - Major Pathway"                                                                                      
##  [81] "CD14+ Monocytes PTEN Regulation"                                                                                                    
##  [82] "CD14+ Monocytes Metabolism of RNA"                                                                                                  
##  [83] "CD14+ Monocytes mRNA Splicing"                                                                                                      
##  [84] "CD14+ Monocytes Axon guidance"                                                                                                      
##  [85] "CD14+ Monocytes Nervous system development"                                                                                         
##  [86] "CD14+ Monocytes Processing of Capped Intron-Containing Pre-mRNA"                                                                    
##  [87] "CD14+ Monocytes Host Interactions of HIV factors"                                                                                   
##  [88] "CD14+ Monocytes DNA Repair"                                                                                                         
##  [89] "CD14+ Monocytes HIV Infection"                                                                                                      
##  [90] "CD14+ Monocytes Developmental Biology"                                                                                              
##  [91] "CD14+ Monocytes Cellular responses to stress"                                                                                       
##  [92] "CD14+ Monocytes Cellular responses to stimuli"                                                                                      
##  [93] "CD14+ Monocytes Infectious disease"                                                                                                 
##  [94] "CD14+ Monocytes Metabolism of proteins"                                                                                             
##  [95] "CD14+ Monocytes Metabolism"                                                                                                         
##  [96] "CD8 T cells Formation of a pool of free 40S subunits"                                                                               
##  [97] "CD8 T cells Peptide chain elongation"                                                                                               
##  [98] "CD8 T cells SARS-CoV-1 modulates host translation machinery"                                                                        
##  [99] "CD8 T cells Eukaryotic Translation Elongation"                                                                                      
## [100] "CD8 T cells Formation of the ternary complex, and subsequently, the 43S complex"                                                    
## [101] "CD8 T cells L13a-mediated translational silencing of Ceruloplasmin expression"                                                      
## [102] "CD8 T cells GTP hydrolysis and joining of the 60S ribosomal subunit"                                                                
## [103] "CD8 T cells Selenoamino acid metabolism"                                                                                            
## [104] "CD8 T cells Selenocysteine synthesis"                                                                                               
## [105] "CD8 T cells Viral mRNA Translation"                                                                                                 
## [106] "CD8 T cells Cap-dependent Translation Initiation"                                                                                   
## [107] "CD8 T cells Eukaryotic Translation Initiation"                                                                                      
## [108] "CD8 T cells Eukaryotic Translation Termination"                                                                                     
## [109] "CD8 T cells Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                           
## [110] "CD8 T cells Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                                    
## [111] "CD8 T cells Ribosomal scanning and start codon recognition"                                                                         
## [112] "CD8 T cells Translation initiation complex formation"                                                                               
## [113] "CD8 T cells Activation of the mRNA upon binding of the cap-binding complex and eIFs, and subsequent binding to 43S"                 
## [114] "CD8 T cells Major pathway of rRNA processing in the nucleolus and cytosol"                                                          
## [115] "CD8 T cells Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                              
## [116] "CD8 T cells Nonsense-Mediated Decay (NMD)"                                                                                          
## [117] "CD8 T cells Influenza Viral RNA Transcription and Replication"                                                                      
## [118] "CD8 T cells rRNA processing"                                                                                                        
## [119] "CD8 T cells rRNA processing in the nucleus and cytosol"                                                                             
## [120] "CD8 T cells Cellular response to starvation"                                                                                        
## [121] "CD8 T cells Influenza Infection"                                                                                                    
## [122] "CD8 T cells SRP-dependent cotranslational protein targeting to membrane"                                                            
## [123] "CD8 T cells Translation"                                                                                                            
## [124] "CD8 T cells Regulation of expression of SLITs and ROBOs"                                                                            
## [125] "CD8 T cells Metabolism of amino acids and derivatives"                                                                              
## [126] "CD8 T cells Signaling by ROBO receptors"                                                                                            
## [127] "CD8 T cells Axon guidance"                                                                                                          
## [128] "CD8 T cells Nervous system development"                                                                                             
## [129] "CD8 T cells Infectious disease"                                                                                                     
## [130] "CD8 T cells Metabolism"                                                                                                             
## [131] "CD8 T cells Disease"                                                                                                                
## [132] "Dendritic cells Cellular response to starvation"                                                                                    
## [133] "Dendritic cells GTP hydrolysis and joining of the 60S ribosomal subunit"                                                            
## [134] "Dendritic cells L13a-mediated translational silencing of Ceruloplasmin expression"                                                  
## [135] "Dendritic cells Cap-dependent Translation Initiation"                                                                               
## [136] "Dendritic cells Eukaryotic Translation Initiation"                                                                                  
## [137] "Dendritic cells Formation of a pool of free 40S subunits"                                                                           
## [138] "Dendritic cells Peptide chain elongation"                                                                                           
## [139] "Dendritic cells Translation"                                                                                                        
## [140] "Dendritic cells Eukaryotic Translation Termination"                                                                                 
## [141] "Dendritic cells Major pathway of rRNA processing in the nucleolus and cytosol"                                                      
## [142] "Dendritic cells Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                                
## [143] "Dendritic cells rRNA processing"                                                                                                    
## [144] "Dendritic cells rRNA processing in the nucleus and cytosol"                                                                         
## [145] "Dendritic cells Selenoamino acid metabolism"                                                                                        
## [146] "Dendritic cells Selenocysteine synthesis"                                                                                           
## [147] "Dendritic cells Viral mRNA Translation"                                                                                             
## [148] "Dendritic cells Eukaryotic Translation Elongation"                                                                                  
## [149] "Dendritic cells Influenza Viral RNA Transcription and Replication"                                                                  
## [150] "Dendritic cells Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                          
## [151] "Dendritic cells Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                       
## [152] "Dendritic cells Nonsense-Mediated Decay (NMD)"                                                                                      
## [153] "Dendritic cells SRP-dependent cotranslational protein targeting to membrane"                                                        
## [154] "Dendritic cells Influenza Infection"                                                                                                
## [155] "Dendritic cells Metabolism of RNA"                                                                                                  
## [156] "Dendritic cells Cellular responses to stimuli"                                                                                      
## [157] "Dendritic cells Cellular responses to stress"                                                                                       
## [158] "Dendritic cells Metabolism"                                                                                                         
## [159] "FCGR3A+ Monocytes Transcription-Coupled Nucleotide Excision Repair (TC-NER)"                                                        
## [160] "FCGR3A+ Monocytes Fatty acid metabolism"                                                                                            
## [161] "FCGR3A+ Monocytes Dual incision in TC-NER"                                                                                          
## [162] "FCGR3A+ Monocytes Gap-filling DNA repair synthesis and ligation in TC-NER"                                                          
## [163] "FCGR3A+ Monocytes Nucleotide Excision Repair"                                                                                       
## [164] "FCGR3A+ Monocytes Formation of a pool of free 40S subunits"                                                                         
## [165] "FCGR3A+ Monocytes Formation of the ternary complex, and subsequently, the 43S complex"                                              
## [166] "FCGR3A+ Monocytes L13a-mediated translational silencing of Ceruloplasmin expression"                                                
## [167] "FCGR3A+ Monocytes Activation of the mRNA upon binding of the cap-binding complex and eIFs, and subsequent binding to 43S"           
## [168] "FCGR3A+ Monocytes Translation initiation complex formation"                                                                         
## [169] "FCGR3A+ Monocytes Cap-dependent Translation Initiation"                                                                             
## [170] "FCGR3A+ Monocytes Eukaryotic Translation Initiation"                                                                                
## [171] "FCGR3A+ Monocytes GTP hydrolysis and joining of the 60S ribosomal subunit"                                                          
## [172] "FCGR3A+ Monocytes Eukaryotic Translation Elongation"                                                                                
## [173] "FCGR3A+ Monocytes Influenza Viral RNA Transcription and Replication"                                                                
## [174] "FCGR3A+ Monocytes DNA Repair"                                                                                                       
## [175] "FCGR3A+ Monocytes Peptide chain elongation"                                                                                         
## [176] "FCGR3A+ Monocytes Translation"                                                                                                      
## [177] "FCGR3A+ Monocytes Ribosomal scanning and start codon recognition"                                                                   
## [178] "FCGR3A+ Monocytes Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                     
## [179] "FCGR3A+ Monocytes Selenocysteine synthesis"                                                                                         
## [180] "FCGR3A+ Monocytes Viral mRNA Translation"                                                                                           
## [181] "FCGR3A+ Monocytes Eukaryotic Translation Termination"                                                                               
## [182] "FCGR3A+ Monocytes Selenoamino acid metabolism"                                                                                      
## [183] "FCGR3A+ Monocytes Influenza Infection"                                                                                              
## [184] "FCGR3A+ Monocytes Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                              
## [185] "FCGR3A+ Monocytes Major pathway of rRNA processing in the nucleolus and cytosol"                                                    
## [186] "FCGR3A+ Monocytes Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                        
## [187] "FCGR3A+ Monocytes Nonsense-Mediated Decay (NMD)"                                                                                    
## [188] "FCGR3A+ Monocytes rRNA processing"                                                                                                  
## [189] "FCGR3A+ Monocytes rRNA processing in the nucleus and cytosol"                                                                       
## [190] "FCGR3A+ Monocytes SRP-dependent cotranslational protein targeting to membrane"                                                      
## [191] "FCGR3A+ Monocytes Cellular response to starvation"                                                                                  
## [192] "FCGR3A+ Monocytes Regulation of expression of SLITs and ROBOs"                                                                      
## [193] "FCGR3A+ Monocytes Signaling by ROBO receptors"                                                                                      
## [194] "FCGR3A+ Monocytes Metabolism of amino acids and derivatives"                                                                        
## [195] "FCGR3A+ Monocytes Axon guidance"                                                                                                    
## [196] "FCGR3A+ Monocytes Nervous system development"                                                                                       
## [197] "FCGR3A+ Monocytes Developmental Biology"                                                                                            
## [198] "FCGR3A+ Monocytes Metabolism of RNA"                                                                                                
## [199] "FCGR3A+ Monocytes Metabolism"                                                                                                       
## [200] "FCGR3A+ Monocytes Infectious disease"                                                                                               
## [201] "FCGR3A+ Monocytes Metabolism of proteins"                                                                                           
## [202] "FCGR3A+ Monocytes Disease"                                                                                                          
## [203] "NK cells Detoxification of Reactive Oxygen Species"                                                                                 
## [204] "NK cells Eukaryotic Translation Elongation"                                                                                         
## [205] "NK cells Formation of a pool of free 40S subunits"                                                                                  
## [206] "NK cells Peptide chain elongation"                                                                                                  
## [207] "NK cells Cap-dependent Translation Initiation"                                                                                      
## [208] "NK cells Eukaryotic Translation Initiation"                                                                                         
## [209] "NK cells L13a-mediated translational silencing of Ceruloplasmin expression"                                                         
## [210] "NK cells GTP hydrolysis and joining of the 60S ribosomal subunit"                                                                   
## [211] "NK cells Translation"

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 Genes with >=10 reads per sample on average across all samples
Gene Selection Criteria DESeq2 FDR<0.05
ORA directionality Separate tests for up- and down-regulation
Data availability R/Experiment hub “Kang” or GSE96583.
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] 80
fixup_sets
##  [1] "B cells Interferon alpha/beta signaling"                                                                    
##  [2] "B cells Interferon gamma signaling"                                                                         
##  [3] "B cells Interferon Signaling"                                                                               
##  [4] "B cells Antiviral mechanism by IFN-stimulated genes"                                                        
##  [5] "B cells DDX58/IFIH1-mediated induction of interferon-alpha/beta"                                            
##  [6] "B cells Cytokine Signaling in Immune system"                                                                
##  [7] "B cells Immune System"                                                                                      
##  [8] "CD14+ Monocytes Interferon alpha/beta signaling"                                                            
##  [9] "CD14+ Monocytes Interferon gamma signaling"                                                                 
## [10] "CD14+ Monocytes Regulation of necroptotic cell death"                                                       
## [11] "CD14+ Monocytes RIPK1-mediated regulated necrosis"                                                          
## [12] "CD14+ Monocytes Regulation of TNFR1 signaling"                                                              
## [13] "CD14+ Monocytes TNF signaling"                                                                              
## [14] "CD14+ Monocytes Interferon Signaling"                                                                       
## [15] "CD14+ Monocytes Nucleotide-binding domain, leucine rich repeat containing receptor (NLR) signaling pathways"
## [16] "CD14+ Monocytes Regulated Necrosis"                                                                         
## [17] "CD14+ Monocytes GPCR ligand binding"                                                                        
## [18] "CD14+ Monocytes Class A/1 (Rhodopsin-like receptors)"                                                       
## [19] "CD14+ Monocytes DDX58/IFIH1-mediated induction of interferon-alpha/beta"                                    
## [20] "CD14+ Monocytes Death Receptor Signaling"                                                                   
## [21] "CD14+ Monocytes Cytokine Signaling in Immune system"                                                        
## [22] "CD14+ Monocytes Immune System"                                                                              
## [23] "CD14+ Monocytes Innate Immune System"                                                                       
## [24] "CD4 T cells Interferon alpha/beta signaling"                                                                
## [25] "CD4 T cells Interferon gamma signaling"                                                                     
## [26] "CD4 T cells Caspase activation via extrinsic apoptotic signalling pathway"                                  
## [27] "CD4 T cells Regulation of innate immune responses to cytosolic DNA"                                         
## [28] "CD4 T cells Interferon Signaling"                                                                           
## [29] "CD4 T cells Apoptotic factor-mediated response"                                                             
## [30] "CD4 T cells Peptide ligand-binding receptors"                                                               
## [31] "CD4 T cells Pyroptosis"                                                                                     
## [32] "CD4 T cells Regulated Necrosis"                                                                             
## [33] "CD4 T cells Regulation of necroptotic cell death"                                                           
## [34] "CD4 T cells RIPK1-mediated regulated necrosis"                                                              
## [35] "CD4 T cells Regulation of TNFR1 signaling"                                                                  
## [36] "CD4 T cells DDX58/IFIH1-mediated induction of interferon-alpha/beta"                                        
## [37] "CD4 T cells TNF signaling"                                                                                  
## [38] "CD4 T cells Cytosolic sensors of pathogen-associated DNA"                                                   
## [39] "CD4 T cells Cytokine Signaling in Immune system"                                                            
## [40] "CD4 T cells Antiviral mechanism by IFN-stimulated genes"                                                    
## [41] "CD4 T cells Death Receptor Signaling"                                                                       
## [42] "CD4 T cells Interleukin-1 family signaling"                                                                 
## [43] "CD4 T cells Toll-like Receptor Cascades"                                                                    
## [44] "CD4 T cells Toll Like Receptor 4 (TLR4) Cascade"                                                            
## [45] "CD4 T cells Signaling by Interleukins"                                                                      
## [46] "CD4 T cells Programmed Cell Death"                                                                          
## [47] "CD4 T cells Apoptosis"                                                                                      
## [48] "CD4 T cells Immune System"                                                                                  
## [49] "CD4 T cells Innate Immune System"                                                                           
## [50] "CD8 T cells Interferon alpha/beta signaling"                                                                
## [51] "CD8 T cells Interferon gamma signaling"                                                                     
## [52] "CD8 T cells Interferon Signaling"                                                                           
## [53] "CD8 T cells Antiviral mechanism by IFN-stimulated genes"                                                    
## [54] "CD8 T cells ISG15 antiviral mechanism"                                                                      
## [55] "CD8 T cells Cytokine Signaling in Immune system"                                                            
## [56] "CD8 T cells Immune System"                                                                                  
## [57] "Dendritic cells Interferon alpha/beta signaling"                                                            
## [58] "Dendritic cells Interferon gamma signaling"                                                                 
## [59] "Dendritic cells Interferon Signaling"                                                                       
## [60] "Dendritic cells Cytokine Signaling in Immune system"                                                        
## [61] "FCGR3A+ Monocytes Interferon alpha/beta signaling"                                                          
## [62] "FCGR3A+ Monocytes Immunoregulatory interactions between a Lymphoid and a non-Lymphoid cell"                 
## [63] "FCGR3A+ Monocytes Interferon Signaling"                                                                     
## [64] "FCGR3A+ Monocytes Interferon gamma signaling"                                                               
## [65] "FCGR3A+ Monocytes Cytokine Signaling in Immune system"                                                      
## [66] "FCGR3A+ Monocytes Immune System"                                                                            
## [67] "Megakaryocytes Interferon alpha/beta signaling"                                                             
## [68] "Megakaryocytes Interferon Signaling"                                                                        
## [69] "Megakaryocytes Cytokine Signaling in Immune system"                                                         
## [70] "Megakaryocytes Immune System"                                                                               
## [71] "NK cells Interferon alpha/beta signaling"                                                                   
## [72] "NK cells Interferon gamma signaling"                                                                        
## [73] "NK cells Interferon Signaling"                                                                              
## [74] "NK cells Interleukin-4 and Interleukin-13 signaling"                                                        
## [75] "NK cells Antiviral mechanism by IFN-stimulated genes"                                                       
## [76] "NK cells ISG15 antiviral mechanism"                                                                         
## [77] "NK cells Regulated Necrosis"                                                                                
## [78] "NK cells Cytokine Signaling in Immune system"                                                               
## [79] "NK cells Immune System"                                                                                     
## [80] "NK cells Signaling by Interleukins"

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] 241
fixdn_sets
##   [1] "B cells Detoxification of Reactive Oxygen Species"                                                                                  
##   [2] "B cells SARS-CoV-1 modulates host translation machinery"                                                                            
##   [3] "B cells Eukaryotic Translation Elongation"                                                                                          
##   [4] "B cells Peptide chain elongation"                                                                                                   
##   [5] "B cells Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                               
##   [6] "B cells Viral mRNA Translation"                                                                                                     
##   [7] "B cells Selenocysteine synthesis"                                                                                                   
##   [8] "B cells Formation of a pool of free 40S subunits"                                                                                   
##   [9] "B cells Eukaryotic Translation Termination"                                                                                         
##  [10] "B cells Selenoamino acid metabolism"                                                                                                
##  [11] "B cells Cap-dependent Translation Initiation"                                                                                       
##  [12] "B cells Eukaryotic Translation Initiation"                                                                                          
##  [13] "B cells L13a-mediated translational silencing of Ceruloplasmin expression"                                                          
##  [14] "B cells Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                                        
##  [15] "B cells Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                                  
##  [16] "B cells Nonsense-Mediated Decay (NMD)"                                                                                              
##  [17] "B cells GTP hydrolysis and joining of the 60S ribosomal subunit"                                                                    
##  [18] "B cells SRP-dependent cotranslational protein targeting to membrane"                                                                
##  [19] "CD14+ Monocytes MicroRNA (miRNA) biogenesis"                                                                                        
##  [20] "CD14+ Monocytes FGFR2 mutant receptor activation"                                                                                   
##  [21] "CD14+ Monocytes Signaling by FGFR2 IIIa TM"                                                                                         
##  [22] "CD14+ Monocytes mRNA Splicing - Minor Pathway"                                                                                      
##  [23] "CD14+ Monocytes Activation of the mRNA upon binding of the cap-binding complex and eIFs, and subsequent binding to 43S"             
##  [24] "CD14+ Monocytes Ribosomal scanning and start codon recognition"                                                                     
##  [25] "CD14+ Monocytes Translation initiation complex formation"                                                                           
##  [26] "CD14+ Monocytes Formation of the ternary complex, and subsequently, the 43S complex"                                                
##  [27] "CD14+ Monocytes mRNA Capping"                                                                                                       
##  [28] "CD14+ Monocytes RNA Polymerase I Transcription Initiation"                                                                          
##  [29] "CD14+ Monocytes L13a-mediated translational silencing of Ceruloplasmin expression"                                                  
##  [30] "CD14+ Monocytes Metabolism of non-coding RNA"                                                                                       
##  [31] "CD14+ Monocytes snRNP Assembly"                                                                                                     
##  [32] "CD14+ Monocytes Cap-dependent Translation Initiation"                                                                               
##  [33] "CD14+ Monocytes Eukaryotic Translation Initiation"                                                                                  
##  [34] "CD14+ Monocytes GTP hydrolysis and joining of the 60S ribosomal subunit"                                                            
##  [35] "CD14+ Monocytes Formation of a pool of free 40S subunits"                                                                           
##  [36] "CD14+ Monocytes RNA Pol II CTD phosphorylation and interaction with CE"                                                             
##  [37] "CD14+ Monocytes RNA Pol II CTD phosphorylation and interaction with CE during HIV infection"                                        
##  [38] "CD14+ Monocytes Transcriptional regulation by small RNAs"                                                                           
##  [39] "CD14+ Monocytes Abortive elongation of HIV-1 transcript in the absence of Tat"                                                      
##  [40] "CD14+ Monocytes Gene Silencing by RNA"                                                                                              
##  [41] "CD14+ Monocytes Eukaryotic Translation Elongation"                                                                                  
##  [42] "CD14+ Monocytes Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                       
##  [43] "CD14+ Monocytes SARS-CoV-2 modulates host translation machinery"                                                                    
##  [44] "CD14+ Monocytes Peptide chain elongation"                                                                                           
##  [45] "CD14+ Monocytes Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                                
##  [46] "CD14+ Monocytes Processing of Capped Intronless Pre-mRNA"                                                                           
##  [47] "CD14+ Monocytes Eukaryotic Translation Termination"                                                                                 
##  [48] "CD14+ Monocytes Selenoamino acid metabolism"                                                                                        
##  [49] "CD14+ Monocytes Selenocysteine synthesis"                                                                                           
##  [50] "CD14+ Monocytes Viral mRNA Translation"                                                                                             
##  [51] "CD14+ Monocytes FGFR2 alternative splicing"                                                                                         
##  [52] "CD14+ Monocytes Influenza Viral RNA Transcription and Replication"                                                                  
##  [53] "CD14+ Monocytes Formation of the Early Elongation Complex"                                                                          
##  [54] "CD14+ Monocytes Formation of the HIV-1 Early Elongation Complex"                                                                    
##  [55] "CD14+ Monocytes Pausing and recovery of Tat-mediated HIV elongation"                                                                
##  [56] "CD14+ Monocytes Tat-mediated HIV elongation arrest and recovery"                                                                    
##  [57] "CD14+ Monocytes Regulation of PTEN gene transcription"                                                                              
##  [58] "CD14+ Monocytes Formation of HIV-1 elongation complex containing HIV-1 Tat"                                                         
##  [59] "CD14+ Monocytes HIV Transcription Elongation"                                                                                       
##  [60] "CD14+ Monocytes Tat-mediated elongation of the HIV-1 transcript"                                                                    
##  [61] "CD14+ Monocytes Viral Messenger RNA Synthesis"                                                                                      
##  [62] "CD14+ Monocytes Major pathway of rRNA processing in the nucleolus and cytosol"                                                      
##  [63] "CD14+ Monocytes SARS-CoV-1 modulates host translation machinery"                                                                    
##  [64] "CD14+ Monocytes rRNA processing"                                                                                                    
##  [65] "CD14+ Monocytes Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                          
##  [66] "CD14+ Monocytes Nonsense-Mediated Decay (NMD)"                                                                                      
##  [67] "CD14+ Monocytes rRNA processing in the nucleus and cytosol"                                                                         
##  [68] "CD14+ Monocytes RNA Polymerase I Promoter Clearance"                                                                                
##  [69] "CD14+ Monocytes RNA Polymerase I Transcription"                                                                                     
##  [70] "CD14+ Monocytes Influenza Infection"                                                                                                
##  [71] "CD14+ Monocytes Translation"                                                                                                        
##  [72] "CD14+ Monocytes Formation of HIV elongation complex in the absence of HIV Tat"                                                      
##  [73] "CD14+ Monocytes HIV Transcription Initiation"                                                                                       
##  [74] "CD14+ Monocytes RNA Polymerase II HIV Promoter Escape"                                                                              
##  [75] "CD14+ Monocytes RNA Polymerase II Promoter Escape"                                                                                  
##  [76] "CD14+ Monocytes RNA Polymerase II Transcription Initiation"                                                                         
##  [77] "CD14+ Monocytes RNA Polymerase II Transcription Initiation And Promoter Clearance"                                                  
##  [78] "CD14+ Monocytes RNA Polymerase II Transcription Pre-Initiation And Promoter Opening"                                                
##  [79] "CD14+ Monocytes Cellular response to starvation"                                                                                    
##  [80] "CD14+ Monocytes Mitochondrial protein import"                                                                                       
##  [81] "CD14+ Monocytes Positive epigenetic regulation of rRNA expression"                                                                  
##  [82] "CD14+ Monocytes TP53 Regulates Transcription of DNA Repair Genes"                                                                   
##  [83] "CD14+ Monocytes SRP-dependent cotranslational protein targeting to membrane"                                                        
##  [84] "CD14+ Monocytes Transcription of the HIV genome"                                                                                    
##  [85] "CD14+ Monocytes Regulation of expression of SLITs and ROBOs"                                                                        
##  [86] "CD14+ Monocytes Mitochondrial translation elongation"                                                                               
##  [87] "CD14+ Monocytes Respiratory electron transport"                                                                                     
##  [88] "CD14+ Monocytes Mitochondrial translation initiation"                                                                               
##  [89] "CD14+ Monocytes Mitochondrial translation termination"                                                                              
##  [90] "CD14+ Monocytes Metabolism of amino acids and derivatives"                                                                          
##  [91] "CD14+ Monocytes Mitochondrial translation"                                                                                          
##  [92] "CD14+ Monocytes Signaling by ROBO receptors"                                                                                        
##  [93] "CD14+ Monocytes The citric acid (TCA) cycle and respiratory electron transport"                                                     
##  [94] "CD14+ Monocytes Respiratory electron transport, ATP synthesis by chemiosmotic coupling, and heat production by uncoupling proteins."
##  [95] "CD14+ Monocytes Formation of TC-NER Pre-Incision Complex"                                                                           
##  [96] "CD14+ Monocytes Complex I biogenesis"                                                                                               
##  [97] "CD14+ Monocytes Transcription-Coupled Nucleotide Excision Repair (TC-NER)"                                                          
##  [98] "CD14+ Monocytes mRNA Splicing - Major Pathway"                                                                                      
##  [99] "CD14+ Monocytes PTEN Regulation"                                                                                                    
## [100] "CD14+ Monocytes Metabolism of RNA"                                                                                                  
## [101] "CD14+ Monocytes RNA Polymerase II Transcription Termination"                                                                        
## [102] "CD14+ Monocytes mRNA Splicing"                                                                                                      
## [103] "CD14+ Monocytes Axon guidance"                                                                                                      
## [104] "CD14+ Monocytes Nervous system development"                                                                                         
## [105] "CD14+ Monocytes Processing of Capped Intron-Containing Pre-mRNA"                                                                    
## [106] "CD14+ Monocytes Protein localization"                                                                                               
## [107] "CD14+ Monocytes HIV Life Cycle"                                                                                                     
## [108] "CD14+ Monocytes Host Interactions of HIV factors"                                                                                   
## [109] "CD14+ Monocytes DNA Repair"                                                                                                         
## [110] "CD14+ Monocytes HIV Infection"                                                                                                      
## [111] "CD14+ Monocytes Developmental Biology"                                                                                              
## [112] "CD14+ Monocytes Cellular responses to stress"                                                                                       
## [113] "CD14+ Monocytes Cellular responses to stimuli"                                                                                      
## [114] "CD14+ Monocytes Infectious disease"                                                                                                 
## [115] "CD14+ Monocytes Metabolism of proteins"                                                                                             
## [116] "CD14+ Monocytes Metabolism"                                                                                                         
## [117] "CD14+ Monocytes Gene expression (Transcription)"                                                                                    
## [118] "CD14+ Monocytes RNA Polymerase II Transcription"                                                                                    
## [119] "CD14+ Monocytes Disease"                                                                                                            
## [120] "CD8 T cells Formation of a pool of free 40S subunits"                                                                               
## [121] "CD8 T cells Peptide chain elongation"                                                                                               
## [122] "CD8 T cells SARS-CoV-1 modulates host translation machinery"                                                                        
## [123] "CD8 T cells Eukaryotic Translation Elongation"                                                                                      
## [124] "CD8 T cells Formation of the ternary complex, and subsequently, the 43S complex"                                                    
## [125] "CD8 T cells L13a-mediated translational silencing of Ceruloplasmin expression"                                                      
## [126] "CD8 T cells GTP hydrolysis and joining of the 60S ribosomal subunit"                                                                
## [127] "CD8 T cells Selenoamino acid metabolism"                                                                                            
## [128] "CD8 T cells Selenocysteine synthesis"                                                                                               
## [129] "CD8 T cells Viral mRNA Translation"                                                                                                 
## [130] "CD8 T cells Cap-dependent Translation Initiation"                                                                                   
## [131] "CD8 T cells Eukaryotic Translation Initiation"                                                                                      
## [132] "CD8 T cells Eukaryotic Translation Termination"                                                                                     
## [133] "CD8 T cells Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                           
## [134] "CD8 T cells Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                                    
## [135] "CD8 T cells Ribosomal scanning and start codon recognition"                                                                         
## [136] "CD8 T cells Translation initiation complex formation"                                                                               
## [137] "CD8 T cells Activation of the mRNA upon binding of the cap-binding complex and eIFs, and subsequent binding to 43S"                 
## [138] "CD8 T cells Major pathway of rRNA processing in the nucleolus and cytosol"                                                          
## [139] "CD8 T cells Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                              
## [140] "CD8 T cells Nonsense-Mediated Decay (NMD)"                                                                                          
## [141] "CD8 T cells Influenza Viral RNA Transcription and Replication"                                                                      
## [142] "CD8 T cells rRNA processing"                                                                                                        
## [143] "CD8 T cells rRNA processing in the nucleus and cytosol"                                                                             
## [144] "CD8 T cells Cellular response to starvation"                                                                                        
## [145] "CD8 T cells Influenza Infection"                                                                                                    
## [146] "CD8 T cells SRP-dependent cotranslational protein targeting to membrane"                                                            
## [147] "CD8 T cells Translation"                                                                                                            
## [148] "CD8 T cells Regulation of expression of SLITs and ROBOs"                                                                            
## [149] "CD8 T cells Metabolism of amino acids and derivatives"                                                                              
## [150] "CD8 T cells Signaling by ROBO receptors"                                                                                            
## [151] "CD8 T cells Axon guidance"                                                                                                          
## [152] "CD8 T cells Nervous system development"                                                                                             
## [153] "CD8 T cells Infectious disease"                                                                                                     
## [154] "CD8 T cells Metabolism"                                                                                                             
## [155] "CD8 T cells Disease"                                                                                                                
## [156] "Dendritic cells Cellular response to starvation"                                                                                    
## [157] "Dendritic cells GTP hydrolysis and joining of the 60S ribosomal subunit"                                                            
## [158] "Dendritic cells L13a-mediated translational silencing of Ceruloplasmin expression"                                                  
## [159] "Dendritic cells Cap-dependent Translation Initiation"                                                                               
## [160] "Dendritic cells Eukaryotic Translation Initiation"                                                                                  
## [161] "Dendritic cells Formation of a pool of free 40S subunits"                                                                           
## [162] "Dendritic cells Peptide chain elongation"                                                                                           
## [163] "Dendritic cells Translation"                                                                                                        
## [164] "Dendritic cells Eukaryotic Translation Termination"                                                                                 
## [165] "Dendritic cells Major pathway of rRNA processing in the nucleolus and cytosol"                                                      
## [166] "Dendritic cells Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                                
## [167] "Dendritic cells rRNA processing"                                                                                                    
## [168] "Dendritic cells rRNA processing in the nucleus and cytosol"                                                                         
## [169] "Dendritic cells Selenoamino acid metabolism"                                                                                        
## [170] "Dendritic cells Selenocysteine synthesis"                                                                                           
## [171] "Dendritic cells Viral mRNA Translation"                                                                                             
## [172] "Dendritic cells Eukaryotic Translation Elongation"                                                                                  
## [173] "Dendritic cells Influenza Viral RNA Transcription and Replication"                                                                  
## [174] "Dendritic cells Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                          
## [175] "Dendritic cells Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                       
## [176] "Dendritic cells Nonsense-Mediated Decay (NMD)"                                                                                      
## [177] "Dendritic cells SRP-dependent cotranslational protein targeting to membrane"                                                        
## [178] "Dendritic cells Influenza Infection"                                                                                                
## [179] "Dendritic cells Metabolism of RNA"                                                                                                  
## [180] "Dendritic cells Cellular responses to stimuli"                                                                                      
## [181] "Dendritic cells Cellular responses to stress"                                                                                       
## [182] "Dendritic cells Metabolism"                                                                                                         
## [183] "FCGR3A+ Monocytes Transcription-Coupled Nucleotide Excision Repair (TC-NER)"                                                        
## [184] "FCGR3A+ Monocytes Fatty acid metabolism"                                                                                            
## [185] "FCGR3A+ Monocytes Dual incision in TC-NER"                                                                                          
## [186] "FCGR3A+ Monocytes Gap-filling DNA repair synthesis and ligation in TC-NER"                                                          
## [187] "FCGR3A+ Monocytes Formation of TC-NER Pre-Incision Complex"                                                                         
## [188] "FCGR3A+ Monocytes mRNA Splicing - Minor Pathway"                                                                                    
## [189] "FCGR3A+ Monocytes Nucleotide Excision Repair"                                                                                       
## [190] "FCGR3A+ Monocytes Formation of a pool of free 40S subunits"                                                                         
## [191] "FCGR3A+ Monocytes Formation of the ternary complex, and subsequently, the 43S complex"                                              
## [192] "FCGR3A+ Monocytes L13a-mediated translational silencing of Ceruloplasmin expression"                                                
## [193] "FCGR3A+ Monocytes Activation of the mRNA upon binding of the cap-binding complex and eIFs, and subsequent binding to 43S"           
## [194] "FCGR3A+ Monocytes Translation initiation complex formation"                                                                         
## [195] "FCGR3A+ Monocytes Cap-dependent Translation Initiation"                                                                             
## [196] "FCGR3A+ Monocytes Eukaryotic Translation Initiation"                                                                                
## [197] "FCGR3A+ Monocytes GTP hydrolysis and joining of the 60S ribosomal subunit"                                                          
## [198] "FCGR3A+ Monocytes Eukaryotic Translation Elongation"                                                                                
## [199] "FCGR3A+ Monocytes Influenza Viral RNA Transcription and Replication"                                                                
## [200] "FCGR3A+ Monocytes DNA Repair"                                                                                                       
## [201] "FCGR3A+ Monocytes Peptide chain elongation"                                                                                         
## [202] "FCGR3A+ Monocytes Translation"                                                                                                      
## [203] "FCGR3A+ Monocytes Ribosomal scanning and start codon recognition"                                                                   
## [204] "FCGR3A+ Monocytes Nonsense Mediated Decay (NMD) independent of the Exon Junction Complex (EJC)"                                     
## [205] "FCGR3A+ Monocytes Selenocysteine synthesis"                                                                                         
## [206] "FCGR3A+ Monocytes Viral mRNA Translation"                                                                                           
## [207] "FCGR3A+ Monocytes Eukaryotic Translation Termination"                                                                               
## [208] "FCGR3A+ Monocytes Selenoamino acid metabolism"                                                                                      
## [209] "FCGR3A+ Monocytes Influenza Infection"                                                                                              
## [210] "FCGR3A+ Monocytes Response of EIF2AK4 (GCN2) to amino acid deficiency"                                                              
## [211] "FCGR3A+ Monocytes Major pathway of rRNA processing in the nucleolus and cytosol"                                                    
## [212] "FCGR3A+ Monocytes Nonsense Mediated Decay (NMD) enhanced by the Exon Junction Complex (EJC)"                                        
## [213] "FCGR3A+ Monocytes Nonsense-Mediated Decay (NMD)"                                                                                    
## [214] "FCGR3A+ Monocytes rRNA processing"                                                                                                  
## [215] "FCGR3A+ Monocytes rRNA processing in the nucleus and cytosol"                                                                       
## [216] "FCGR3A+ Monocytes SRP-dependent cotranslational protein targeting to membrane"                                                      
## [217] "FCGR3A+ Monocytes Cellular response to starvation"                                                                                  
## [218] "FCGR3A+ Monocytes The citric acid (TCA) cycle and respiratory electron transport"                                                   
## [219] "FCGR3A+ Monocytes Transcriptional Regulation by TP53"                                                                               
## [220] "FCGR3A+ Monocytes Regulation of expression of SLITs and ROBOs"                                                                      
## [221] "FCGR3A+ Monocytes Signaling by ROBO receptors"                                                                                      
## [222] "FCGR3A+ Monocytes Metabolism of amino acids and derivatives"                                                                        
## [223] "FCGR3A+ Monocytes Axon guidance"                                                                                                    
## [224] "FCGR3A+ Monocytes Nervous system development"                                                                                       
## [225] "FCGR3A+ Monocytes Developmental Biology"                                                                                            
## [226] "FCGR3A+ Monocytes Metabolism of RNA"                                                                                                
## [227] "FCGR3A+ Monocytes Metabolism"                                                                                                       
## [228] "FCGR3A+ Monocytes Infectious disease"                                                                                               
## [229] "FCGR3A+ Monocytes Cellular responses to stress"                                                                                     
## [230] "FCGR3A+ Monocytes Cellular responses to stimuli"                                                                                    
## [231] "FCGR3A+ Monocytes Metabolism of proteins"                                                                                           
## [232] "FCGR3A+ Monocytes Disease"                                                                                                          
## [233] "NK cells Detoxification of Reactive Oxygen Species"                                                                                 
## [234] "NK cells Eukaryotic Translation Elongation"                                                                                         
## [235] "NK cells Formation of a pool of free 40S subunits"                                                                                  
## [236] "NK cells Peptide chain elongation"                                                                                                  
## [237] "NK cells Cap-dependent Translation Initiation"                                                                                      
## [238] "NK cells Eukaryotic Translation Initiation"                                                                                         
## [239] "NK cells L13a-mediated translational silencing of Ceruloplasmin expression"                                                         
## [240] "NK cells GTP hydrolysis and joining of the 60S ribosomal subunit"                                                                   
## [241] "NK cells Translation"

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("scrna_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.8584337

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

setdiff(orafix,ora)
##  [1] "B cells DDX58/IFIH1-mediated induction of interferon-alpha/beta"                    
##  [2] "CD4 T cells Toll Like Receptor 4 (TLR4) Cascade"                                    
##  [3] "NK cells ISG15 antiviral mechanism"                                                 
##  [4] "NK cells Regulated Necrosis"                                                        
##  [5] "NK cells Signaling by Interleukins"                                                 
##  [6] "CD14+ Monocytes Abortive elongation of HIV-1 transcript in the absence of Tat"      
##  [7] "CD14+ Monocytes Formation of the Early Elongation Complex"                          
##  [8] "CD14+ Monocytes Formation of the HIV-1 Early Elongation Complex"                    
##  [9] "CD14+ Monocytes Pausing and recovery of Tat-mediated HIV elongation"                
## [10] "CD14+ Monocytes Tat-mediated HIV elongation arrest and recovery"                    
## [11] "CD14+ Monocytes RNA Polymerase I Promoter Clearance"                                
## [12] "CD14+ Monocytes RNA Polymerase I Transcription"                                     
## [13] "CD14+ Monocytes Formation of HIV elongation complex in the absence of HIV Tat"      
## [14] "CD14+ Monocytes HIV Transcription Initiation"                                       
## [15] "CD14+ Monocytes RNA Polymerase II HIV Promoter Escape"                              
## [16] "CD14+ Monocytes RNA Polymerase II Promoter Escape"                                  
## [17] "CD14+ Monocytes RNA Polymerase II Transcription Initiation"                         
## [18] "CD14+ Monocytes RNA Polymerase II Transcription Initiation And Promoter Clearance"  
## [19] "CD14+ Monocytes RNA Polymerase II Transcription Pre-Initiation And Promoter Opening"
## [20] "CD14+ Monocytes Positive epigenetic regulation of rRNA expression"                  
## [21] "CD14+ Monocytes TP53 Regulates Transcription of DNA Repair Genes"                   
## [22] "CD14+ Monocytes Formation of TC-NER Pre-Incision Complex"                           
## [23] "CD14+ Monocytes Complex I biogenesis"                                               
## [24] "CD14+ Monocytes Transcription-Coupled Nucleotide Excision Repair (TC-NER)"          
## [25] "CD14+ Monocytes RNA Polymerase II Transcription Termination"                        
## [26] "CD14+ Monocytes Protein localization"                                               
## [27] "CD14+ Monocytes HIV Life Cycle"                                                     
## [28] "CD14+ Monocytes Gene expression (Transcription)"                                    
## [29] "CD14+ Monocytes RNA Polymerase II Transcription"                                    
## [30] "CD14+ Monocytes Disease"                                                            
## [31] "FCGR3A+ Monocytes Formation of TC-NER Pre-Incision Complex"                         
## [32] "FCGR3A+ Monocytes mRNA Splicing - Minor Pathway"                                    
## [33] "FCGR3A+ Monocytes The citric acid (TCA) cycle and respiratory electron transport"   
## [34] "FCGR3A+ Monocytes Transcriptional Regulation by TP53"                               
## [35] "FCGR3A+ Monocytes Cellular responses to stress"                                     
## [36] "FCGR3A+ Monocytes Cellular responses to stimuli"

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.2      
##  [5] kableExtra_1.3.4            DESeq2_1.40.2              
##  [7] SummarizedExperiment_1.30.2 Biobase_2.60.0             
##  [9] MatrixGenerics_1.12.2       matrixStats_1.0.0          
## [11] GenomicRanges_1.52.0        GenomeInfoDb_1.36.1        
## [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] bitops_1.0-7                enrichplot_1.20.0          
##   [3] HDO.db_0.99.1               httr_1.4.6                 
##   [5] webshot_0.5.5               RColorBrewer_1.1-3         
##   [7] doParallel_1.0.17           numDeriv_2016.8-1.1        
##   [9] tools_4.3.1                 sctransform_0.3.5          
##  [11] backports_1.4.1             utf8_1.2.3                 
##  [13] R6_2.5.1                    lazyeval_0.2.2             
##  [15] GetoptLong_1.0.5            htm2txt_2.2.2              
##  [17] withr_2.5.0                 prettyunits_1.1.1          
##  [19] gridExtra_2.3               cli_3.6.1                  
##  [21] scatterpie_0.2.1            sandwich_3.0-2             
##  [23] sass_0.4.7                  mvtnorm_1.2-2              
##  [25] blme_1.0-5                  systemfonts_1.0.4          
##  [27] yulab.utils_0.0.6           gson_0.1.0                 
##  [29] DOSE_3.26.1                 svglite_2.1.1              
##  [31] scater_1.28.0               parallelly_1.36.0          
##  [33] limma_3.56.2                rstudioapi_0.15.0          
##  [35] RSQLite_2.3.1               generics_0.1.3             
##  [37] gridGraphics_0.5-1          shape_1.4.6                
##  [39] gtools_3.9.4                dplyr_1.1.2                
##  [41] GO.db_3.17.0                Matrix_1.6-0               
##  [43] ggbeeswarm_0.7.2            fansi_1.0.4                
##  [45] abind_1.4-5                 lifecycle_1.0.3            
##  [47] multcomp_1.4-25             yaml_2.3.7                 
##  [49] edgeR_3.42.4                qvalue_2.32.0              
##  [51] grid_4.3.1                  blob_1.2.4                 
##  [53] crayon_1.5.2                lattice_0.21-8             
##  [55] beachmat_2.16.0             cowplot_1.1.1              
##  [57] KEGGREST_1.40.0             pillar_1.9.0               
##  [59] knitr_1.43                  ComplexHeatmap_2.16.0      
##  [61] rjson_0.2.21                boot_1.3-28.1              
##  [63] estimability_1.4.1          future.apply_1.11.0        
##  [65] codetools_0.2-19            fastmatch_1.1-3            
##  [67] glue_1.6.2                  downloader_0.4             
##  [69] ggfun_0.1.1                 data.table_1.14.8          
##  [71] vctrs_0.6.3                 png_0.1-8                  
##  [73] treeio_1.24.3               Rdpack_2.4                 
##  [75] gtable_0.3.3                cachem_1.0.8               
##  [77] xfun_0.39                   rbibutils_2.2.13           
##  [79] S4Arrays_1.0.5              tidygraph_1.2.3            
##  [81] coda_0.19-4                 survival_3.5-5             
##  [83] SingleCellExperiment_1.22.0 iterators_1.0.14           
##  [85] TH.data_1.1-2               nlme_3.1-162               
##  [87] pbkrtest_0.5.2              ggtree_3.8.2               
##  [89] bit64_4.0.5                 progress_1.2.2             
##  [91] EnvStats_2.8.0              bslib_0.5.0                
##  [93] TMB_1.9.5                   irlba_2.3.5.1              
##  [95] vipor_0.4.5                 KernSmooth_2.23-22         
##  [97] colorspace_2.1-0            DBI_1.1.3                  
##  [99] tidyselect_1.2.0            emmeans_1.8.7              
## [101] bit_4.0.5                   compiler_4.3.1             
## [103] rvest_1.0.3                 BiocNeighbors_1.18.0       
## [105] xml2_1.3.5                  DelayedArray_0.26.6        
## [107] shadowtext_0.1.2            scales_1.2.1               
## [109] caTools_1.18.2              remaCor_0.0.16             
## [111] stringr_1.5.0               digest_0.6.33              
## [113] minqa_1.2.5                 variancePartition_1.30.2   
## [115] rmarkdown_2.23              aod_1.3.2                  
## [117] XVector_0.40.0              RhpcBLASctl_0.23-42        
## [119] htmltools_0.5.5             pkgconfig_2.0.3            
## [121] lme4_1.1-34                 sparseMatrixStats_1.12.2   
## [123] highr_0.10                  fastmap_1.1.1              
## [125] rlang_1.1.1                 GlobalOptions_0.1.2        
## [127] DelayedMatrixStats_1.22.1   farver_2.1.1               
## [129] jquerylib_0.1.4             zoo_1.8-12                 
## [131] jsonlite_1.8.7              BiocParallel_1.34.2        
## [133] GOSemSim_2.26.1             BiocSingular_1.16.0        
## [135] RCurl_1.98-1.12             magrittr_2.0.3             
## [137] scuttle_1.10.1              GenomeInfoDbData_1.2.10    
## [139] ggplotify_0.1.1             patchwork_1.1.2            
## [141] munsell_0.5.0               Rcpp_1.0.11                
## [143] ape_5.7-1                   viridis_0.6.4              
## [145] stringi_1.7.12              ggraph_2.1.0               
## [147] zlibbioc_1.46.0             MASS_7.3-60                
## [149] plyr_1.8.8                  parallel_4.3.1             
## [151] listenv_0.9.0               ggrepel_0.9.3              
## [153] Biostrings_2.68.1           graphlayouts_1.0.0         
## [155] splines_4.3.1               hms_1.1.3                  
## [157] circlize_0.4.15             polylabelr_0.2.0           
## [159] locfit_1.5-9.8              igraph_1.5.0.1             
## [161] reshape2_1.4.4              ScaledMatrix_1.8.1         
## [163] evaluate_0.21               nloptr_2.0.3               
## [165] foreach_1.5.2               tweenr_2.0.2               
## [167] tidyr_1.3.0                 purrr_1.0.1                
## [169] polyclip_1.10-4             future_1.33.0              
## [171] clue_0.3-64                 ggplot2_3.4.2              
## [173] ggforce_0.4.1               rsvd_1.0.5                 
## [175] broom_1.0.5                 xtable_1.8-4               
## [177] muscat_1.14.0               tidytree_0.4.4             
## [179] viridisLite_0.4.2           tibble_3.2.1               
## [181] lmerTest_3.1-3              aplot_0.1.10               
## [183] glmmTMB_1.1.7               memoise_2.0.1              
## [185] beeswarm_0.4.0              AnnotationDbi_1.62.2       
## [187] cluster_2.1.4               globals_0.16.2