Source: https://github.com/markziemann/bioinformatics_intro_workshop
The bioconductor packages we need this week are DESeq2 and fgsea. The CRAN packages required are kableExtra, eulerr, RhpcBLASctl and parallel.
#knitr::opts_chunk$set(dev = 'svg') # set output device to svg
suppressPackageStartupMessages({
library("getDEE2")
library("DESeq2")
library("kableExtra")
library("eulerr")
library("fgsea")
library("RhpcBLASctl")
library("parallel")
})
RhpcBLASctl::blas_set_num_threads(1)
Here we demonstrate how to do over-representation analysis (ORA) and functional class scoring (FCS).
There are many possible pitfalls in pathway enrichment analysis which we summarised in a previous paper Bora et al, 2026.
For information on the dataset we are using, see the script called “dataprep.Rmd” in another repository https://github.com/markziemann/pathway-workshop
For this guide I will be using bulk RNA-seq data from a previous study, which is deposited at NCBI GEO and SRA under accession numbers: GSE55123 and SRP038101 (Lund et al, 2014). The experiment is designed to investigate the effect of Azacitidine treatment on AML3 cells.
The raw data have been processed by the DEE2 project, and the summary gene expression counts are available at the dee2.io website, and programmatically with the getDEE2 bioconductor package (Ziemann et al, 2019).
if ( ! file.exists("data/de.Rds") ) {
download.file("https://ziemann-lab.net/public/bioinfo_workshop/2026/de.Rds",destfile="data/de.Rds")
}
de <- readRDS("data/de.Rds")
head(de) %>%
kbl(caption="To DEGs for Aza treatment in AML3 cells") %>%
kable_paper("hover", full_width = F)
| baseMean | log2FoldChange | lfcSE | stat | pvalue | padj | SRR1171523 | SRR1171524 | SRR1171525 | SRR1171526 | SRR1171527 | SRR1171528 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ENSG00000165949 IFI27 | 1960.1970 | -3.384492 | 0.0938869 | -36.04861 | 0 | 0 | 4689 | 3583 | 2758 | 309 | 384 | 334 |
| ENSG00000090382 LYZ | 7596.0299 | -1.650342 | 0.0561143 | -29.41036 | 0 | 0 | 14212 | 10237 | 10789 | 3476 | 3764 | 3738 |
| ENSG00000115461 IGFBP5 | 531.2217 | -5.071157 | 0.1795239 | -28.24781 | 0 | 0 | 1320 | 823 | 1025 | 23 | 26 | 43 |
| ENSG00000157601 MX1 | 827.1511 | -2.877795 | 0.1047823 | -27.46450 | 0 | 0 | 1732 | 1501 | 1206 | 184 | 223 | 186 |
| ENSG00000111331 OAS3 | 2127.2010 | -2.661214 | 0.0972124 | -27.37525 | 0 | 0 | 4204 | 3977 | 2972 | 562 | 614 | 560 |
| ENSG00000070915 SLC12A3 | 424.5509 | -3.374852 | 0.1298671 | -25.98697 | 0 | 0 | 1012 | 721 | 653 | 63 | 85 | 76 |
Gene sets were obtained from Reactome. Reactome is a good source for pathways. It is more comprehensive and frequently updated as compared to KEGG.
if ( ! file.exists("data/ReactomePathways_2025-09-02.gmt") ) {
download.file("https://ziemann-lab.net/public/bioinfo_workshop/2026/ReactomePathways_2025-09-02.gmt",
destfile="data/ReactomePathways_2025-09-02.gmt")
}
gs <- gmtPathways("data/ReactomePathways_2025-09-02.gmt")
head(gs,3)
## $`2-LTR circle formation`
## [1] "BANF1" "HMGA1" "LIG4" "PSIP1" "XRCC4" "XRCC5" "XRCC6"
## [8] "gag" "gag-pol" "rev" "vif" "vpr" "vpu"
##
## $`3-Methylcrotonyl-CoA carboxylase deficiency`
## [1] "MCCC1" "MCCC2"
##
## $`3-hydroxyisobutyryl-CoA hydrolase deficiency`
## [1] "HIBCH"
summary(unlist(lapply(gs,length)))
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.00 5.00 15.00 48.61 43.00 2617.00
Here we select up and down-regulated genes as well as the background. The background was previously selected based on the presence of an average of 10 reads per sample.
up <- rownames(subset(de, padj < 0.01 & log2FoldChange > 0))
up <- unique(sapply(strsplit(up," "),"[[",2))
length(up)
## [1] 1066
dn <- rownames(subset(de, padj < 0.01 & log2FoldChange < 0))
dn <- unique(sapply(strsplit(dn," "),"[[",2))
length(dn)
## [1] 1432
# background selection was done earlier
#mxf <- mx[which(rowMeans(mx)>=10),]
dim(de)
## [1] 13168 12
bg <- rownames(de)
bg <- unique(sapply(strsplit(bg," "),"[[",2))
length(bg)
## [1] 13164
Now we write the gene lists to text files that we can use for ORA with web tools like iDEP.
writeLines(up,"data/up.txt")
writeLines(dn,"data/down.txt")
writeLines(bg,"data/background.txt")
The goal is to understand whether certain gene pathways are enriched at a higher level in the DE list as compared to the background list of detected genes.
We are running separate tests for up and down DEGs.
First, up.
ora_up <- fora(pathways=gs, genes=up, universe=bg, minSize = 5, maxSize = Inf)
nrow(ora_up)
## [1] 1838
message("number of up-regulated gene sets with FDR<0.01")
## number of up-regulated gene sets with FDR<0.01
nrow(subset(ora_up,padj<0.01))
## [1] 145
head(ora_up,10) %>%
kbl(caption="Top upregulated pathways with ORA (significance)") %>%
kable_paper("hover", full_width = F)
| pathway | pval | padj | foldEnrichment | overlap | size | overlapGenes |
|---|---|---|---|---|---|---|
| Cell Cycle | 0 | 0 | 2.964605 | 139 | 579 | AHCTF1, …. |
| Cell Cycle, Mitotic | 0 | 0 | 3.113629 | 118 | 468 | AHCTF1, …. |
| Metabolism of RNA | 0 | 0 | 2.207637 | 128 | 716 | ADAT1, A…. |
| M Phase | 0 | 0 | 2.916781 | 77 | 326 | AHCTF1, …. |
| Cell Cycle Checkpoints | 0 | 0 | 3.188463 | 63 | 244 | AHCTF1, …. |
| Mitotic Metaphase and Anaphase | 0 | 0 | 3.205982 | 54 | 208 | AHCTF1, …. |
| Mitotic Anaphase | 0 | 0 | 3.161813 | 53 | 207 | AHCTF1, …. |
| Mitotic Prometaphase | 0 | 0 | 3.218614 | 49 | 188 | AHCTF1, …. |
| DNA Repair | 0 | 0 | 2.744215 | 60 | 270 | ACTL6A, …. |
| Mitotic G1 phase and G1/S transition | 0 | 0 | 3.450447 | 38 | 136 | AKT3, CC…. |
ora_up <- ora_up[order(-ora_up$foldEnrichment),]
head(ora_up,10) %>%
kbl(caption="Top upregulated pathways with ORA (fold enrichment)") %>%
kable_paper("hover", full_width = F)
| pathway | pval | padj | foldEnrichment | overlap | size | overlapGenes |
|---|---|---|---|---|---|---|
| Condensation of Prometaphase Chromosomes | 0.0000002 | 0.0000125 | 8.981068 | 8 | 11 | CCNB1, C…. |
| Phosphorylation of Emi1 | 0.0005616 | 0.0075672 | 8.232645 | 4 | 6 | CCNB1, C…. |
| Activation of NOXA and translocation to mitochondria | 0.0046755 | 0.0434519 | 7.409381 | 3 | 5 | PMAIP1, …. |
| Aspartate and asparagine metabolism | 0.0046755 | 0.0434519 | 7.409381 | 3 | 5 | GOT2, NA…. |
| TFAP2A acts as a transcriptional repressor during retinoic acid induced cell differentiation | 0.0046755 | 0.0434519 | 7.409381 | 3 | 5 | HSPD1, M…. |
| G2/M DNA replication checkpoint | 0.0012263 | 0.0145416 | 7.056553 | 4 | 7 | CCNA2, C…. |
| G1/S-Specific Transcription | 0.0000000 | 0.0000001 | 6.387397 | 15 | 29 | CCNE1, C…. |
| Condensation of Prophase Chromosomes | 0.0000462 | 0.0008499 | 6.174484 | 7 | 14 | CCNB1, C…. |
| DNA replication initiation | 0.0022956 | 0.0245312 | 6.174484 | 4 | 8 | POLA1, P…. |
| CREB3 factors activate genes | 0.0087893 | 0.0730986 | 6.174484 | 3 | 6 | CREB3L2,…. |
Next, down.
ora_dn <- fora(pathways=gs, genes=dn, universe=bg, minSize = 5, maxSize = Inf)
nrow(ora_dn)
## [1] 1838
message("number of down-regulated gene sets with FDR<0.01")
## number of down-regulated gene sets with FDR<0.01
nrow(subset(ora_dn,padj<0.01))
## [1] 68
head(ora_dn,10) %>%
kbl(caption="Top downregulated pathways with ORA (significance)") %>%
kable_paper("hover", full_width = F)
| pathway | pval | padj | foldEnrichment | overlap | size | overlapGenes |
|---|---|---|---|---|---|---|
| Immune System | 0 | 0 | 2.103040 | 326 | 1425 | ACAA1, A…. |
| Cytokine Signaling in Immune system | 0 | 0 | 2.517446 | 155 | 566 | ADAR, AI…. |
| Neutrophil degranulation | 0 | 0 | 2.852918 | 117 | 377 | ACAA1, A…. |
| Innate Immune System | 0 | 0 | 2.242131 | 180 | 738 | ACAA1, A…. |
| Interferon alpha/beta signaling | 0 | 0 | 6.128492 | 40 | 60 | ADAR, BS…. |
| Interferon Signaling | 0 | 0 | 3.206769 | 75 | 215 | ADAR, B2…. |
| Interferon gamma signaling | 0 | 0 | 5.213791 | 38 | 67 | B2M, GBP…. |
| Extracellular matrix organization | 0 | 0 | 3.104041 | 52 | 154 | ACTA2, A…. |
| Signal Transduction | 0 | 0 | 1.485193 | 269 | 1665 | ACTA2, A…. |
| Signaling by Interleukins | 0 | 0 | 2.214104 | 79 | 328 | AIP, ALO…. |
ora_dn <- ora_dn[order(-ora_dn$foldEnrichment),]
head(ora_dn,10) %>%
kbl(caption="Top dnregulated pathways with ORA (fold enrichment)") %>%
kable_paper("hover", full_width = F)
| pathway | pval | padj | foldEnrichment | overlap | size | overlapGenes |
|---|---|---|---|---|---|---|
| Interleukin-20 family signaling | 0.0000000 | 0.0000015 | 7.660615 | 10 | 12 | IL10RB, …. |
| Interleukin-9 signaling | 0.0000826 | 0.0033746 | 7.660615 | 5 | 6 | JAK3, ST…. |
| Prostanoid ligand receptors | 0.0006370 | 0.0143829 | 7.354190 | 4 | 5 | PTGER2, …. |
| Endosomal/Vacuolar pathway | 0.0000003 | 0.0000327 | 6.894553 | 9 | 12 | B2M, CTS…. |
| Interleukin-21 signaling | 0.0000378 | 0.0018298 | 6.894553 | 6 | 8 | JAK3, ST…. |
| Interleukin-2 signaling | 0.0002631 | 0.0084842 | 6.566241 | 5 | 7 | JAK3, PT…. |
| Interferon alpha/beta signaling | 0.0000000 | 0.0000000 | 6.128492 | 40 | 60 | ADAR, BS…. |
| STAT5 Activation | 0.0017457 | 0.0320862 | 6.128492 | 4 | 6 | FLT3, GA…. |
| Specification of primordial germ cells | 0.0017457 | 0.0320862 | 6.128492 | 4 | 6 | CXCR4, E…. |
| Signaling by Leptin | 0.0001030 | 0.0040935 | 6.128492 | 6 | 9 | IRS1, JA…. |
Barplot
npw=15
ora_up_vals <- head(ora_up$foldEnrichment,15)
names(ora_up_vals) <- head(ora_up$pathway,15)
ora_dn_vals <- head(ora_dn$foldEnrichment,15)
names(ora_dn_vals) <- head(ora_dn$pathway,15)
myvals <- c(ora_dn_vals,rev(ora_up_vals))
names(myvals) <- ifelse(nchar(names(myvals)) > 53, paste0(strtrim(names(myvals), 50), '...'), names(myvals))
par(mar=c(5.1,25.1,4.1,2.1))
mycols <- c( rep("blue",length(ora_dn_vals)) , rep("red",length(ora_up_vals)) )
barplot(myvals, col=mycols,
horiz=TRUE,las=2,xlab="Fold enrichment",main="Effect of Aza treatment")
mtext("Red=up, Blue=down")
par(mar=c(5.1,4.1,4.1,2.1))
We will rank the genes based on the “stat” value from DESeq2, which is the Wald test statistic.
First step is to remove redundant gene symbols (there are 4).
de2 <- de
de2$gene <- sapply(strsplit(rownames(de)," "),"[[",2)
which(duplicated(de2$gene))
## [1] 6651 9733 9985 10372
de2ag <- aggregate(de2, stat ~ gene, FUN=sum)
destat <- de2ag$stat
names(destat) <- de2ag$gene
head(destat)
## A1BG-AS1 A2M AAAS AACS AAED1 AAGAB
## -0.7815770 -2.9964032 0.1881224 1.8320025 -0.0862575 -0.2837587
fcs_res <- fgsea(pathways = gs,
stats = destat,
minSize = 5,
maxSize = 50000,
nPermSimple = 10000,
nproc = 4)
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize =
## minSize, : There were 1 pathways for which P-values were not calculated
## properly due to unbalanced (positive and negative) gene-level statistic values.
## For such pathways pval, padj, NES, log2err are set to NA. You can try to
## increase the value of the argument nPermSimple (for example set it nPermSimple
## = 100000)
## | | | 0% | | | 1% | |= | 1% | |= | 2% | |== | 3% | |=== | 4% | |=== | 5% | |==== | 5% | |==== | 6% | |===== | 7% | |====== | 8% | |====== | 9% | |======= | 10% | |======= | 11% | |======== | 11% | |======== | 12% | |========= | 12% | |========= | 13% | |========== | 14% | |=========== | 15% | |=========== | 16% | |============ | 16% | |============ | 17% | |============ | 18% | |============= | 18% | |============= | 19% | |============== | 20% | |=============== | 21% | |=============== | 22% | |================ | 22% | |================ | 23% | |================= | 24% | |================== | 25% | |================== | 26% | |=================== | 27% | |=================== | 28% | |==================== | 28% | |==================== | 29% | |===================== | 30% | |====================== | 31% | |====================== | 32% | |======================= | 32% | |======================= | 33% | |======================= | 34% | |======================== | 34% | |======================== | 35% | |========================= | 36% | |========================== | 37% | |========================== | 38% | |=========================== | 38% | |=========================== | 39% | |============================ | 39% | |============================ | 40% | |============================= | 41% | |============================= | 42% | |============================== | 43% | |=============================== | 44% | |=============================== | 45% | |================================ | 45% | |================================ | 46% | |================================= | 47% | |================================== | 48% | |================================== | 49% | |=================================== | 49% | |=================================== | 50% | |=================================== | 51% | |==================================== | 51% | |==================================== | 52% | |===================================== | 53% | |====================================== | 54% | |====================================== | 55% | |======================================= | 55% | |======================================= | 56% | |======================================== | 57% | |========================================= | 58% | |========================================= | 59% | |========================================== | 60% | |========================================== | 61% | |=========================================== | 61% | |=========================================== | 62% | |============================================ | 62% | |============================================ | 63% | |============================================= | 64% | |============================================== | 65% | |============================================== | 66% | |=============================================== | 66% | |=============================================== | 67% | |=============================================== | 68% | |================================================ | 68% | |================================================ | 69% | |================================================= | 70% | |================================================== | 71% | |================================================== | 72% | |=================================================== | 72% | |=================================================== | 73% | |==================================================== | 74% | |==================================================== | 75% | |===================================================== | 76% | |====================================================== | 77% | |====================================================== | 78% | |======================================================= | 78% | |======================================================= | 79% | |======================================================== | 80% | |========================================================= | 81% | |========================================================= | 82% | |========================================================== | 82% | |========================================================== | 83% | |========================================================== | 84% | |=========================================================== | 84% | |=========================================================== | 85% | |============================================================ | 86% | |============================================================= | 87% | |============================================================= | 88% | |============================================================== | 88% | |============================================================== | 89% | |=============================================================== | 89% | |=============================================================== | 90% | |================================================================ | 91% | |================================================================ | 92% | |================================================================= | 93% | |================================================================== | 94% | |================================================================== | 95% | |=================================================================== | 95% | |=================================================================== | 96% | |==================================================================== | 97% | |===================================================================== | 98% | |===================================================================== | 99% | |======================================================================| 99% | |======================================================================| 100%
fcs_res <- fcs_res[order(fcs_res$padj),]
Now let’s take a look at the top results based on statistical significance.
head( subset(fcs_res,ES>0) , 10) %>%
kbl(caption="Top upregulated pathways with FCS (significance)") %>%
kable_paper("hover", full_width = F)
| pathway | pval | padj | log2err | ES | NES | size | leadingEdge |
|---|---|---|---|---|---|---|---|
| Metabolism of RNA | 0 | 0 | 1.665793 | 0.4717290 | 2.506117 | 716 | GEMIN5, …. |
| Cell Cycle | 0 | 0 | 1.621700 | 0.4937691 | 2.581677 | 579 | CCNA2, C…. |
| Cell Cycle, Mitotic | 0 | 0 | 1.495479 | 0.4972344 | 2.562852 | 468 | CCNA2, C…. |
| M Phase | 0 | 0 | 1.295123 | 0.5100265 | 2.556432 | 326 | CENPF, B…. |
| Cell Cycle Checkpoints | 0 | 0 | 1.229504 | 0.5424190 | 2.636315 | 244 | CCNA2, C…. |
| Processing of Capped Intron-Containing Pre-mRNA | 0 | 0 | 1.186651 | 0.5106675 | 2.510548 | 272 | DDX46, N…. |
| Mitotic Anaphase | 0 | 0 | 1.142191 | 0.5456177 | 2.587632 | 207 | CENPF, B…. |
| Mitotic Metaphase and Anaphase | 0 | 0 | 1.133090 | 0.5490496 | 2.602475 | 208 | CENPF, B…. |
| Mitotic Prometaphase | 0 | 0 | 1.123915 | 0.5591510 | 2.625599 | 188 | CENPF, B…. |
| DNA Repair | 0 | 0 | 1.057464 | 0.4731123 | 2.327984 | 270 | CCNA2, P…. |
head( subset(fcs_res,ES<0) , 10) %>%
kbl(caption="Top downregulated pathways with FCS (significance)") %>%
kable_paper("hover", full_width = F)
| pathway | pval | padj | log2err | ES | NES | size | leadingEdge |
|---|---|---|---|---|---|---|---|
| Immune System | 0 | 0 | 1.6657926 | -0.4854837 | -2.032470 | 1425 | IFI27, L…. |
| Cytokine Signaling in Immune system | 0 | 0 | 1.3267161 | -0.5420388 | -2.224798 | 566 | IFI27, M…. |
| Innate Immune System | 0 | 0 | 1.2709130 | -0.4971244 | -2.055485 | 738 | LYZ, HLA…. |
| Interferon alpha/beta signaling | 0 | 0 | 1.1778933 | -0.8501595 | -2.799742 | 60 | IFI27, M…. |
| Interferon Signaling | 0 | 0 | 1.0959293 | -0.6221241 | -2.408615 | 215 | IFI27, M…. |
| Neutrophil degranulation | 0 | 0 | 1.0768682 | -0.5429527 | -2.187383 | 377 | LYZ, HLA…. |
| Interferon gamma signaling | 0 | 0 | 0.9969862 | -0.7821332 | -2.618160 | 67 | OAS3, HL…. |
| Extracellular matrix organization | 0 | 0 | 0.9653278 | -0.6342691 | -2.370254 | 154 | COL1A2, …. |
| Immunoregulatory interactions between a Lymphoid and a non-Lymphoid cell | 0 | 0 | 0.8634154 | -0.7453242 | -2.454499 | 60 | HLA-B, H…. |
| Signaling by Interleukins | 0 | 0 | 0.8140358 | -0.4865990 | -1.944266 | 328 | CD86, CO…. |
Now let’s take a look at the results based on ES after removal of nonsignificant sets.
sig <- subset(fcs_res,padj<0.01)
fcs_up <- tail(sig[order(sig$ES),],15)
fcs_up %>%
kbl(caption="Top upregulated pathways with FCS (ES prioritisation)") %>%
kable_paper("hover", full_width = F)
| pathway | pval | padj | log2err | ES | NES | size | leadingEdge |
|---|---|---|---|---|---|---|---|
| Regulation of Glucokinase by Glucokinase Regulatory Protein | 0.0000000 | 0.0000001 | 0.7614608 | 0.7718388 | 2.557758 | 29 | NDC1, NU…. |
| Export of Viral Ribonucleoproteins from Nucleus | 0.0000000 | 0.0000000 | 0.8266573 | 0.7760567 | 2.615436 | 31 | NDC1, NU…. |
| NEP/NS2 Interacts with the Cellular Export Machinery | 0.0000000 | 0.0000000 | 0.8266573 | 0.7760567 | 2.615436 | 31 | NDC1, NU…. |
| Impaired BRCA2 binding to PALB2 | 0.0000001 | 0.0000013 | 0.7195128 | 0.7767852 | 2.437255 | 24 | XRCC2, B…. |
| Transport of Ribonucleoproteins into the Host Nucleus | 0.0000000 | 0.0000000 | 0.8266573 | 0.7776909 | 2.620944 | 31 | KPNB1, N…. |
| mRNA decay by 3’ to 5’ exoribonuclease | 0.0000797 | 0.0008559 | 0.5384341 | 0.7787076 | 2.069583 | 13 | DIS3, HB…. |
| SLBP independent Processing of Histone Pre-mRNAs | 0.0007188 | 0.0054793 | 0.4772708 | 0.7801965 | 1.923623 | 10 | NCBP1, L…. |
| SLBP Dependent Processing of Replication-Dependent Histone Pre-mRNAs | 0.0003852 | 0.0032461 | 0.4984931 | 0.7809510 | 1.980847 | 11 | NCBP1, L…. |
| Rev-mediated nuclear export of HIV RNA | 0.0000000 | 0.0000000 | 0.8513391 | 0.7821970 | 2.697376 | 34 | NDC1, NU…. |
| Nuclear import of Rev protein | 0.0000000 | 0.0000000 | 0.8390889 | 0.7824651 | 2.673175 | 33 | KPNB1, N…. |
| Interactions of Rev with host cellular proteins | 0.0000000 | 0.0000000 | 0.8986712 | 0.7869544 | 2.751054 | 36 | KPNB1, N…. |
| Postmitotic nuclear pore complex (NPC) reformation | 0.0000000 | 0.0000000 | 0.8012156 | 0.7968887 | 2.591921 | 27 | KPNB1, N…. |
| Condensation of Prometaphase Chromosomes | 0.0000164 | 0.0002136 | 0.5756103 | 0.8415269 | 2.134495 | 11 | SMC4, NC…. |
| Phosphorylation of Emi1 | 0.0003907 | 0.0032773 | 0.4984931 | 0.8925999 | 1.868847 | 6 | FBXO5, C…. |
| TFAP2A acts as a transcriptional repressor during retinoic acid induced cell differentiation | 0.0000609 | 0.0006615 | 0.5573322 | 0.9442481 | 1.866120 | 5 | HSPD1, M…. |
fcs_dn <- head(sig[order(sig$ES),],15)
fcs_dn %>%
kbl(caption="Top downregulated pathways with FCS (ES prioritisation)") %>%
kable_paper("hover", full_width = F)
| pathway | pval | padj | log2err | ES | NES | size | leadingEdge |
|---|---|---|---|---|---|---|---|
| Modulation of host responses by IFN-stimulated genes | 0.0000000 | 0.0000000 | 0.8012156 | -0.9166259 | -2.377347 | 18 | IFI27, I…. |
| Endosomal/Vacuolar pathway | 0.0000013 | 0.0000220 | 0.6435518 | -0.8981315 | -2.120088 | 12 | HLA-B, H…. |
| Constitutive Signaling by NOTCH1 t(7;9)(NOTCH1:M1580_K2555) Translocation Mutant | 0.0004751 | 0.0038621 | 0.4984931 | -0.8967868 | -1.838515 | 7 | NOTCH1, …. |
| Signaling by NOTCH1 t(7;9)(NOTCH1:M1580_K2555) Translocation Mutant | 0.0004751 | 0.0038621 | 0.4984931 | -0.8967868 | -1.838515 | 7 | NOTCH1, …. |
| OAS antiviral response | 0.0006325 | 0.0048823 | 0.4772708 | -0.8621347 | -1.827253 | 8 | OAS3, OA…. |
| Interferon alpha/beta signaling | 0.0000000 | 0.0000000 | 1.1778933 | -0.8501595 | -2.799742 | 60 | IFI27, M…. |
| Interleukin-21 signaling | 0.0010871 | 0.0080150 | 0.4550599 | -0.8487641 | -1.798915 | 8 | STAT1, S…. |
| Interleukin-20 family signaling | 0.0004249 | 0.0035164 | 0.4984931 | -0.8141391 | -1.921820 | 12 | STAT1, S…. |
| MyD88 deficiency (TLR2/4) | 0.0005716 | 0.0045653 | 0.4772708 | -0.7914248 | -1.898753 | 13 | MYD88, S…. |
| Interferon gamma signaling | 0.0000000 | 0.0000000 | 0.9969862 | -0.7821332 | -2.618160 | 67 | OAS3, HL…. |
| IRAK4 deficiency (TLR2/4) | 0.0013634 | 0.0095593 | 0.4550599 | -0.7578909 | -1.848420 | 14 | MYD88, S…. |
| Immunoregulatory interactions between a Lymphoid and a non-Lymphoid cell | 0.0000000 | 0.0000000 | 0.8634154 | -0.7453242 | -2.454499 | 60 | HLA-B, H…. |
| Collagen degradation | 0.0000325 | 0.0003830 | 0.5573322 | -0.7328442 | -2.078889 | 27 | COL1A2, …. |
| Amyloid fiber formation | 0.0000137 | 0.0001812 | 0.5933255 | -0.7306512 | -2.132878 | 31 | LYZ, TGF…. |
| Antigen Presentation: Folding, assembly and peptide loading of class I MHC | 0.0000275 | 0.0003320 | 0.5756103 | -0.7306173 | -2.118634 | 30 | HLA-B, H…. |
Now make a barplot.
fcs_vals <- c(fcs_dn$ES, fcs_up$ES)
names(fcs_vals) <- c(fcs_dn$pathway, fcs_up$pathway)
names(fcs_vals) <- ifelse(nchar(names(fcs_vals)) > 53, paste0(strtrim(names(fcs_vals), 50), '...'), names(fcs_vals))
par(mar=c(5.1,24.1,4.1,2.1))
barplot(fcs_vals, horiz=TRUE,las=2,xlab="ES",main="Effect of Aza treatment")
par(mar=c(5.1,4.1,4.1,2.1))
ora_sig_up <- subset(ora_up,padj<0.01)$pathway
ora_sig_dn <- subset(ora_dn,padj<0.01)$pathway
fcs_sig_up <- subset(fcs_res,ES>0 & padj<0.01)$pathway
fcs_sig_dn <- subset(fcs_res,ES<0 & padj<0.01)$pathway
v1 <- list("ORA up"=ora_sig_up, "ORA down"=ora_sig_dn,
"FCS up"=fcs_sig_up, "FCS down"=fcs_sig_dn)
plot(euler(v1),quantities = list(cex = 2), labels = list(cex = 2))
Set analysis.
message("Common upregulated")
## Common upregulated
intersect(ora_sig_up, fcs_sig_up)
## [1] "Condensation of Prometaphase Chromosomes"
## [2] "Phosphorylation of Emi1"
## [3] "G1/S-Specific Transcription"
## [4] "Condensation of Prophase Chromosomes"
## [5] "Interactions of Rev with host cellular proteins"
## [6] "Nuclear import of Rev protein"
## [7] "G0 and Early G1"
## [8] "Postmitotic nuclear pore complex (NPC) reformation"
## [9] "Rev-mediated nuclear export of HIV RNA"
## [10] "Polo-like kinase mediated events"
## [11] "Nuclear Pore Complex (NPC) Disassembly"
## [12] "Transcription of E2F targets under negative control by DREAM complex"
## [13] "Export of Viral Ribonucleoproteins from Nucleus"
## [14] "NEP/NS2 Interacts with the Cellular Export Machinery"
## [15] "Transport of Ribonucleoproteins into the Host Nucleus"
## [16] "Impaired BRCA2 binding to PALB2"
## [17] "Defective TPR may confer susceptibility towards thyroid papillary carcinoma (TPC)"
## [18] "Regulation of Glucokinase by Glucokinase Regulatory Protein"
## [19] "NS1 Mediated Effects on Host Pathways"
## [20] "Defective HDR through Homologous Recombination Repair (HRR) due to PALB2 loss of BRCA1 binding function"
## [21] "Defective HDR through Homologous Recombination Repair (HRR) due to PALB2 loss of BRCA2/RAD51/RAD51C binding function"
## [22] "Defective homologous recombination repair (HRR) due to BRCA1 loss of function"
## [23] "Defective homologous recombination repair (HRR) due to PALB2 loss of function"
## [24] "Vpr-mediated nuclear import of PICs"
## [25] "Transport of the SLBP independent Mature mRNA"
## [26] "SUMOylation of DNA replication proteins"
## [27] "Transport of the SLBP Dependant Mature mRNA"
## [28] "Resolution of D-loop Structures through Synthesis-Dependent Strand Annealing (SDSA)"
## [29] "Amino acid transport across the plasma membrane"
## [30] "Interactions of Vpr with host cellular proteins"
## [31] "SUMOylation of SUMOylation proteins"
## [32] "Defective homologous recombination repair (HRR) due to BRCA2 loss of function"
## [33] "Diseases of DNA Double-Strand Break Repair"
## [34] "Activation of the pre-replicative complex"
## [35] "Transport of Mature mRNA Derived from an Intronless Transcript"
## [36] "Diseases of DNA repair"
## [37] "Recognition of DNA damage by PCNA-containing replication complex"
## [38] "Homologous DNA Pairing and Strand Exchange"
## [39] "Transport of Mature mRNAs Derived from Intronless Transcripts"
## [40] "Nuclear Envelope Breakdown"
## [41] "Cyclin A/B1/B2 associated events during G2/M transition"
## [42] "SUMOylation of ubiquitinylation proteins"
## [43] "Viral Messenger RNA Synthesis"
## [44] "tRNA processing in the nucleus"
## [45] "Metabolism of non-coding RNA"
## [46] "snRNP Assembly"
## [47] "Presynaptic phase of homologous DNA pairing and strand exchange"
## [48] "Activation of ATR in response to replication stress"
## [49] "Amplification of signal from unattached kinetochores via a MAD2 inhibitory signal"
## [50] "Amplification of signal from the kinetochores"
## [51] "SUMOylation of RNA binding proteins"
## [52] "Transcriptional regulation by small RNAs"
## [53] "Resolution of D-loop Structures through Holliday Junction Intermediates"
## [54] "Resolution of Sister Chromatid Cohesion"
## [55] "Impaired BRCA2 binding to RAD51"
## [56] "Resolution of D-Loop Structures"
## [57] "Transport of Mature mRNA derived from an Intron-Containing Transcript"
## [58] "G2/M DNA damage checkpoint"
## [59] "Gene Silencing by RNA"
## [60] "HDR through Homologous Recombination (HRR)"
## [61] "Nuclear Envelope (NE) Reassembly"
## [62] "SUMOylation of chromatin organization proteins"
## [63] "G1/S Transition"
## [64] "DNA strand elongation"
## [65] "Mitotic G1 phase and G1/S transition"
## [66] "EML4 and NUDC in mitotic spindle formation"
## [67] "Mitotic Spindle Checkpoint"
## [68] "Dual Incision in GG-NER"
## [69] "TP53 Regulates Transcription of DNA Repair Genes"
## [70] "Transport of Mature Transcript to Cytoplasm"
## [71] "G2/M Checkpoints"
## [72] "Mitotic Prophase"
## [73] "Gap-filling DNA repair synthesis and ligation in TC-NER"
## [74] "rRNA modification in the nucleus and cytosol"
## [75] "Mitotic Prometaphase"
## [76] "DNA Double-Strand Break Repair"
## [77] "Mitotic Metaphase and Anaphase"
## [78] "Cell Cycle Checkpoints"
## [79] "Mitotic Anaphase"
## [80] "Cell Cycle, Mitotic"
## [81] "RHO GTPases Activate Formins"
## [82] "Homology Directed Repair"
## [83] "HCMV Early Events"
## [84] "Dual incision in TC-NER"
## [85] "HDR through Homologous Recombination (HRR) or Single Strand Annealing (SSA)"
## [86] "Cell Cycle"
## [87] "SUMOylation of DNA damage response and repair proteins"
## [88] "M Phase"
## [89] "DNA Replication"
## [90] "Synthesis of DNA"
## [91] "HCMV Late Events"
## [92] "Separation of Sister Chromatids"
## [93] "Transcription-Coupled Nucleotide Excision Repair (TC-NER)"
## [94] "SUMOylation"
## [95] "S Phase"
## [96] "APC/C:Cdc20 mediated degradation of mitotic proteins"
## [97] "DNA Repair"
## [98] "tRNA processing"
## [99] "Cellular response to heat stress"
## [100] "Regulation of APC/C activators between G1/S and early anaphase"
## [101] "Activation of APC/C and APC/C:Cdc20 mediated degradation of mitotic proteins"
## [102] "SUMO E3 ligases SUMOylate target proteins"
## [103] "Host Interactions of HIV factors"
## [104] "APC/C-mediated degradation of cell cycle proteins"
## [105] "Regulation of mitotic cell cycle"
## [106] "DNA Replication Pre-Initiation"
## [107] "Global Genome Nucleotide Excision Repair (GG-NER)"
## [108] "Chromosome Maintenance"
## [109] "Late Phase of HIV Life Cycle"
## [110] "G2/M Transition"
## [111] "HIV Life Cycle"
## [112] "Mitotic G2-G2/M phases"
## [113] "Nucleotide Excision Repair"
## [114] "Processing of Capped Intron-Containing Pre-mRNA"
## [115] "Metabolism of RNA"
## [116] "mRNA Splicing - Major Pathway"
## [117] "RHO GTPase Effectors"
## [118] "mRNA Splicing"
## [119] "HIV Infection"
## [120] "Regulation of TP53 Activity"
## [121] "Transcriptional Regulation by TP53"
## [122] "Cilium Assembly"
## [123] "rRNA processing in the nucleus and cytosol"
## [124] "rRNA processing"
## [125] "RNA Polymerase II Transcription"
message("Common downregulated")
## Common downregulated
intersect(ora_sig_dn, fcs_sig_dn)
## [1] "Interleukin-20 family signaling"
## [2] "Endosomal/Vacuolar pathway"
## [3] "Interleukin-21 signaling"
## [4] "Interferon alpha/beta signaling"
## [5] "Interferon gamma signaling"
## [6] "Modulation of host responses by IFN-stimulated genes"
## [7] "MyD88 deficiency (TLR2/4)"
## [8] "Interleukin-10 signaling"
## [9] "IRAK4 deficiency (TLR2/4)"
## [10] "Interleukin-2 family signaling"
## [11] "Immunoregulatory interactions between a Lymphoid and a non-Lymphoid cell"
## [12] "Collagen degradation"
## [13] "Interleukin-4 and Interleukin-13 signaling"
## [14] "Antigen Presentation: Folding, assembly and peptide loading of class I MHC"
## [15] "Integrin cell surface interactions"
## [16] "Regulation of Insulin-like Growth Factor (IGF) transport and uptake by Insulin-like Growth Factor Binding Proteins (IGFBPs)"
## [17] "Post-translational protein phosphorylation"
## [18] "Amyloid fiber formation"
## [19] "Interferon Signaling"
## [20] "Extracellular matrix organization"
## [21] "Class A/1 (Rhodopsin-like receptors)"
## [22] "Neutrophil degranulation"
## [23] "Degradation of the extracellular matrix"
## [24] "Cell surface interactions at the vascular wall"
## [25] "Antigen processing-Cross presentation"
## [26] "Platelet degranulation"
## [27] "ER-Phagosome pathway"
## [28] "Cytokine Signaling in Immune system"
## [29] "GPCR ligand binding"
## [30] "Response to elevated platelet cytosolic Ca2+"
## [31] "RSV-host interactions"
## [32] "Innate Immune System"
## [33] "Sensory Perception"
## [34] "Signaling by Interleukins"
## [35] "GPCR downstream signalling"
## [36] "Immune System"
## [37] "Signaling by GPCR"
## [38] "Platelet activation, signaling and aggregation"
## [39] "Hemostasis"
## [40] "Signaling by Receptor Tyrosine Kinases"
## [41] "Signal Transduction"
## [42] "Developmental Biology"
## [43] "Adaptive Immune System"
## [44] "Disease"
Enrichment plot.
mypw <- gs[which(names(gs) %in% fcs_dn$pathway)]
plotGseaTable(mypw, destat, fcs_res, gseaParam = 0.5)
Preferably, prioritise results based on the enrichment score after excluding gene sets with FDR>0.05. Prioritisation based on p-value can lead to over-emphasis on large and generic gene sets like “translation”, “mitochondria fuinction”, or “immune system”.
sessionInfo()
## R version 4.6.1 (2026-06-24)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.5 LTS
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## time zone: Australia/Melbourne
## tzcode source: system (glibc)
##
## attached base packages:
## [1] parallel stats4 stats graphics grDevices utils datasets
## [8] methods base
##
## other attached packages:
## [1] RhpcBLASctl_0.23-42 fgsea_1.38.0
## [3] eulerr_7.1.0 kableExtra_1.4.1
## [5] DESeq2_1.52.0 SummarizedExperiment_1.42.0
## [7] Biobase_2.72.0 MatrixGenerics_1.24.0
## [9] matrixStats_1.5.0 GenomicRanges_1.64.0
## [11] Seqinfo_1.2.0 IRanges_2.46.0
## [13] S4Vectors_0.50.1 BiocGenerics_0.58.1
## [15] generics_0.1.4 getDEE2_1.22.0
##
## loaded via a namespace (and not attached):
## [1] fastmatch_1.1-8 gtable_0.3.6 xfun_0.61
## [4] bslib_0.12.0 ggplot2_4.0.3 lattice_0.23-1
## [7] vctrs_0.7.3 tools_4.6.1 tibble_3.3.1
## [10] pkgconfig_2.0.3 Matrix_1.7-6 data.table_1.18.6.1
## [13] polylabelr_1.0.0 RColorBrewer_1.1-3 S7_0.2.2
## [16] lifecycle_1.0.5 compiler_4.6.1 farver_2.1.2
## [19] stringr_1.6.0 textshaping_1.0.5 htm2txt_2.2.2
## [22] codetools_0.2-20 htmltools_0.5.9 sass_0.4.10
## [25] yaml_2.3.12 pillar_1.11.1 jquerylib_0.1.4
## [28] BiocParallel_1.46.0 DelayedArray_0.38.1 cachem_1.1.0
## [31] abind_1.4-8 tidyselect_1.2.1 locfit_1.5-9.12
## [34] digest_0.6.39 stringi_1.8.9 dplyr_1.2.1
## [37] labeling_0.4.3 polyclip_1.10-7 cowplot_1.2.0
## [40] fastmap_1.2.0 grid_4.6.1 cli_3.6.6
## [43] SparseArray_1.12.2 magrittr_2.0.5 S4Arrays_1.12.0
## [46] dichromat_2.0-1 withr_3.0.3 scales_1.4.0
## [49] rmarkdown_2.32 XVector_0.52.0 otel_0.2.0
## [52] evaluate_1.0.5 knitr_1.52 viridisLite_0.4.3
## [55] rlang_1.3.0 Rcpp_1.1.2 glue_1.8.1
## [58] xml2_1.6.0 svglite_2.2.2 rstudioapi_0.19.0
## [61] jsonlite_2.0.0 R6_2.6.1 systemfonts_1.3.2
save.image("data/session2.Rdata")