vignettes/topic2_03_clusterProfiler_ora.Rmd
topic2_03_clusterProfiler_ora.Rmd
Let’s start with a vector of DE genes:
lt = readRDS(system.file("extdata", "ora.rds", package = "GSEAtraining"))
diff_gene = lt$diff_gene
bg_gene = lt$bg_gene
head(diff_gene)
## [1] "FGR" "NIPAL3" "LAP3" "CASP10" "CAMKK1" "PRSS22"
Load the clusterProfiler package.
clusterProfiler supports several major gene ID types in the input, but it is suggested to use Entrez IDs as the input because it is the “central gene ID type” in many databases/datasets.
We convert diff_gene
to Entrez IDs. Note some genes may be lost due to the conversion.
library(GSEAtraining)
diff_gene = convert_to_entrez_id(diff_gene)
##
## gene id might be SYMBOL (p = 0.990 )
## 'select()' returned 1:many mapping between keys and columns
head(diff_gene)
## FGR NIPAL3 LAP3 CASP10 CAMKK1 PRSS22
## "2268" "57185" "51056" "843" "84254" "64063"
length(diff_gene)
## [1] 837
Next we perform ORA on different gene set sources.
library(org.Hs.eg.db)
## Warning: package 'S4Vectors' was built under R version 4.3.2
## ID Description GeneRatio
## GO:0001819 GO:0001819 positive regulation of cytokine production 79/777
## GO:0031349 GO:0031349 positive regulation of defense response 68/777
## GO:0002237 GO:0002237 response to molecule of bacterial origin 61/777
## GO:0002274 GO:0002274 myeloid leukocyte activation 49/777
## GO:0032496 GO:0032496 response to lipopolysaccharide 59/777
## GO:0019221 GO:0019221 cytokine-mediated signaling pathway 71/777
## BgRatio pvalue p.adjust qvalue
## GO:0001819 489/18614 1.285130e-25 6.579865e-22 5.102642e-22
## GO:0031349 441/18614 5.345810e-21 1.368527e-17 1.061284e-17
## GO:0002237 366/18614 1.127385e-20 1.375774e-17 1.066904e-17
## GO:0002274 240/18614 1.151399e-20 1.375774e-17 1.066904e-17
## GO:0032496 345/18614 1.343530e-20 1.375774e-17 1.066904e-17
## GO:0019221 492/18614 3.280167e-20 2.799076e-17 2.170665e-17
## geneID
## GO:0001819 2268/4843/7305/6556/3082/11119/50943/8692/5743/3595/2219/58484/54209/5008/50487/51311/4210/80381/5054/59341/55801/3458/942/7474/3552/6772/9173/8809/22954/8013/29126/1958/729230/3659/3553/2867/10288/3620/1116/948/3569/7097/6653/834/116/5795/115362/26060/2207/10417/4332/5196/6850/26253/64127/3965/5724/136/929/1051/64581/10855/6288/4023/8877/247/353514/1604/246778/728/2214/3133/3134/93978/150372/11027/4321/338382/6348
## GO:0031349 7305/8692/3430/5743/2219/58484/54209/5008/50487/3055/51311/730249/4210/5054/59341/3458/7474/57142/9173/8807/729230/81030/3659/3553/2867/5819/3620/84034/8638/948/3569/7097/834/83666/84166/8547/6279/64332/7941/2209/115362/26060/1520/6280/6283/4332/6850/26253/64127/11314/136/929/2358/1051/64581/4023/353514/5320/5359/145741/3133/3134/388125/93978/11027/4321/338382/6348
## GO:0002237 4843/6401/6556/50943/22904/5743/2920/3595/54209/3055/54/730249/5054/1440/6347/1594/57379/6648/942/7474/3552/29126/6590/6372/3553/10288/3620/948/3569/7097/10068/834/4283/6279/64332/133/10417/249/6280/9076/2921/6374/5196/2919/80149/717/64127/3965/3627/6373/5724/3576/2353/929/1051/9516/1604/728/6891/11027/6348
## GO:0002274 2268/7305/6556/22904/8692/3430/54209/50487/3696/3458/7474/9173/8807/8013/729230/3598/55509/6372/30817/5819/8291/3569/7097/2207/6283/80149/81501/6850/338339/11314/116071/6338/3965/5724/3576/136/712/8877/2624/3579/2242/5320/5359/728/2214/57126/10537/11027/6348
## GO:0032496 4843/6401/6556/50943/22904/5743/2920/3595/54209/3055/54/730249/5054/1440/6347/1594/57379/6648/942/7474/3552/29126/6590/6372/3553/10288/3620/948/3569/7097/10068/834/4283/6279/64332/133/10417/249/6280/9076/2921/6374/5196/2919/80149/717/64127/3965/3627/6373/5724/3576/2353/929/1051/9516/1604/11027/6348
## GO:0019221 608/51208/2920/3595/54209/5008/3055/11024/1440/6354/6347/3458/7474/3552/6772/7850/9173/8809/8807/22954/1441/1958/729230/3598/81030/6372/3659/3553/51554/10288/3601/8638/3569/3557/834/83666/4283/50506/84166/79092/10410/64332/5795/2180/26060/2207/8986/3577/2921/6374/5196/2919/6850/3429/3627/6373/3576/54625/8877/1237/3579/10581/8519/7293/8784/353514/11027/4321/6351/6349/6348
## Count
## GO:0001819 79
## GO:0031349 68
## GO:0002237 61
## GO:0002274 49
## GO:0032496 59
## GO:0019221 71
tb = enrichKEGG(gene = diff_gene, organism = "hsa")
head(tb)
## ID Description
## hsa04060 hsa04060 Cytokine-cytokine receptor interaction
## hsa04061 hsa04061 Viral protein interaction with cytokine and cytokine receptor
## hsa04657 hsa04657 IL-17 signaling pathway
## hsa04380 hsa04380 Osteoclast differentiation
## hsa05323 hsa05323 Rheumatoid arthritis
## hsa04668 hsa04668 TNF signaling pathway
## GeneRatio BgRatio pvalue p.adjust qvalue
## hsa04060 50/452 297/8662 7.690187e-14 2.399338e-11 2.072303e-11
## hsa04061 27/452 100/8662 6.100715e-13 9.517115e-11 8.219910e-11
## hsa04657 25/452 94/8662 6.469192e-12 6.727960e-10 5.810923e-10
## hsa04380 29/452 135/8662 4.113147e-11 3.208254e-09 2.770962e-09
## hsa05323 23/452 93/8662 2.278678e-10 1.421895e-08 1.228088e-08
## hsa04668 25/452 114/8662 5.910829e-10 3.073631e-08 2.654688e-08
## geneID
## hsa04060 53832/608/2920/3595/3589/5008/1440/6354/6347/55801/3458/3552/7850/9173/8809/8807/1441/729230/3624/3598/6372/3553/51554/9518/3601/3569/3557/4283/94/56477/58191/8741/3577/2921/6374/5196/2919/3627/6373/3576/8794/1237/3579/7293/8784/246778/6351/9560/6349/6348
## hsa04061 53832/2920/6354/6347/8809/8807/729230/6372/51554/3569/4283/56477/3577/2921/6374/5196/2919/3627/6373/3576/8794/1237/3579/6351/9560/6349/6348
## hsa04657 5743/2920/1440/6354/6347/3458/727897/6372/3553/2354/3569/4322/6279/3934/4314/6280/2921/6374/2919/3627/3576/2353/1051/8061/4312
## hsa04380 7305/54209/10326/54/11024/3458/3552/6772/2274/4688/8503/3553/2354/10288/7006/2212/2209/2215/6850/2353/126014/3726/8061/9021/353514/2214/11025/11027/79168
## hsa05323 2920/3383/3589/54/6347/10312/3458/942/3552/6372/3553/3569/7097/4314/8741/2921/6374/2919/3576/2353/4312/6349/6348
## hsa04668 843/6401/5743/2920/3383/6347/8809/8503/6372/3659/3553/3569/4314/4323/8986/2921/6374/2919/64127/197259/3627/2353/3726/1051/9021
## Count
## hsa04060 50
## hsa04061 27
## hsa04657 25
## hsa04380 29
## hsa05323 23
## hsa04668 25
## ReactomePA v1.44.0 For help: https://yulab-smu.top/biomedical-knowledge-mining-book/
##
## If you use ReactomePA in published research, please cite:
## Guangchuang Yu, Qing-Yu He. ReactomePA: an R/Bioconductor package for reactome pathway analysis and visualization. Molecular BioSystems 2016, 12(2):477-479
tb = enrichPathway(gene = diff_gene, organism = "human")
head(tb)
## ID
## R-HSA-6798695 R-HSA-6798695
## R-HSA-6783783 R-HSA-6783783
## R-HSA-380108 R-HSA-380108
## R-HSA-449147 R-HSA-449147
## R-HSA-198933 R-HSA-198933
## R-HSA-6785807 R-HSA-6785807
## Description
## R-HSA-6798695 Neutrophil degranulation
## R-HSA-6783783 Interleukin-10 signaling
## R-HSA-380108 Chemokine receptors bind chemokines
## R-HSA-449147 Signaling by Interleukins
## R-HSA-198933 Immunoregulatory interactions between a Lymphoid and a non-Lymphoid cell
## R-HSA-6785807 Interleukin-4 and Interleukin-13 signaling
## GeneRatio BgRatio pvalue p.adjust qvalue
## R-HSA-6798695 72/592 481/10955 1.196852e-15 1.345261e-12 1.277482e-12
## R-HSA-6783783 21/592 47/10955 5.765865e-15 3.240416e-12 3.077151e-12
## R-HSA-380108 22/592 59/10955 1.224584e-13 4.588108e-11 4.356940e-11
## R-HSA-449147 64/592 473/10955 5.748719e-12 1.615390e-09 1.534000e-09
## R-HSA-198933 28/592 134/10955 4.464142e-10 1.003539e-07 9.529767e-08
## R-HSA-6785807 23/592 108/10955 1.113243e-08 2.085475e-06 1.980401e-06
## geneID
## R-HSA-6798695 2268/64386/5329/7305/55/6556/2219/4680/4069/5836/10326/10562/3614/10493/10312/5768/5328/10549/7130/6590/27180/10288/1116/6947/948/10970/7097/6386/53831/2212/6279/3934/5795/2207/3101/2215/5284/1520/6282/6280/6283/3577/4332/2919/1508/338339/11314/6036/5724/929/126014/1084/2358/2357/116844/160364/10855/3310/4973/196527/3579/222487/199675/2204/1604/728/3107/11025/57126/3106/150372/81567
## R-HSA-6783783 5743/2920/3383/7076/1440/6347/942/3552/7850/729230/3553/3569/3557/2919/3627/5724/3576/2357/6351/6349/6348
## R-HSA-380108 2920/6354/6347/729230/6372/51554/4283/56477/58191/3577/2921/6374/5196/2919/3627/6373/3576/1237/3579/6351/6349/6348
## R-HSA-449147 4843/53832/3082/6196/5743/2920/3595/3383/3589/5008/3055/7076/1440/6347/595/55801/3458/6648/942/3552/6772/7850/9173/8809/8807/8503/1441/729230/3598/3553/759/3601/948/7006/3569/3557/10068/834/1848/84166/3934/4314/6283/2919/6850/64127/3965/3627/5724/3576/2353/2357/3726/6288/9021/4582/4312/246778/5696/5699/5698/6351/6349/6348
## R-HSA-198933 7305/57823/1308/29992/3383/54209/11024/54210/27180/5819/10288/1280/2209/910/10871/11314/27036/126014/8519/342510/353514/2214/3107/11025/3133/3134/3106/11027
## R-HSA-6785807 4843/3082/5743/3383/5008/7076/6347/595/3552/6772/3598/3553/948/3569/3934/4314/3576/2353/3726/6288/9021/4582/4312
## Count
## R-HSA-6798695 72
## R-HSA-6783783 21
## R-HSA-380108 22
## R-HSA-449147 64
## R-HSA-198933 28
## R-HSA-6785807 23
## DOSE v3.26.2 For help: https://yulab-smu.top/biomedical-knowledge-mining-book/
##
## If you use DOSE in published research, please cite:
## Guangchuang Yu, Li-Gen Wang, Guang-Rong Yan, Qing-Yu He. DOSE: an R/Bioconductor package for Disease Ontology Semantic and Enrichment analysis. Bioinformatics 2015, 31(4):608-609
## ID Description GeneRatio BgRatio
## DOID:824 DOID:824 periodontitis 44/569 147/10312
## DOID:3388 DOID:3388 periodontal disease 47/569 169/10312
## DOID:403 DOID:403 mouth disease 58/569 266/10312
## DOID:104 DOID:104 bacterial infectious disease 68/569 359/10312
## DOID:974 DOID:974 upper respiratory tract disease 49/569 202/10312
## DOID:552 DOID:552 pneumonia 44/569 164/10312
## pvalue p.adjust qvalue
## DOID:824 2.827079e-21 2.025173e-18 1.005913e-18
## DOID:3388 3.675451e-21 2.025173e-18 1.005913e-18
## DOID:403 3.669020e-20 1.347753e-17 6.694352e-18
## DOID:104 6.427655e-20 1.770819e-17 8.795738e-18
## DOID:974 3.074551e-19 6.077593e-17 3.018768e-17
## DOID:552 3.309034e-19 6.077593e-17 3.018768e-17
## geneID
## DOID:824 4843/6401/50943/5743/2920/3595/4069/3589/5008/7076/10135/5054/9126/6354/6347/3458/3552/7850/29126/729230/54210/6372/3553/3569/3557/7097/4322/2212/6279/133/4314/10630/2215/9076/64127/3576/929/2357/1051/3579/4312/2214/3106/4321
## DOID:3388 4843/6401/3082/50943/5743/2920/3595/5243/4069/3589/5008/7076/10135/5054/9126/6354/6347/3458/3552/7850/29126/729230/5328/54210/6372/3553/3569/3557/7097/4322/2212/6279/133/4314/10630/2215/9076/64127/3576/929/2357/1051/3579/4312/2214/3106/4321
## DOID:403 4843/6401/3082/50943/5743/2920/3595/5243/4069/3589/5008/7076/4210/10135/5054/9126/6354/6347/54757/3458/7474/3552/7850/29126/729230/5328/6590/6615/54210/6372/3553/80326/10970/3569/3557/7097/4322/2212/6279/3934/133/4314/10630/249/2215/9076/6469/64127/3576/929/2357/1051/3579/4312/7052/2214/3106/4321
## DOID:104 4843/6401/5329/6556/50943/5743/5243/3383/54209/5008/7076/4210/5054/6347/7450/3458/1839/942/3552/6772/29126/729230/54210/3659/3553/3620/948/3569/3557/7097/4322/834/4283/50506/2212/3934/133/4314/2209/910/58191/2215/467/6469/64127/6890/3627/6373/5724/3576/929/2358/6288/9332/3579/338442/9021/4582/4312/246778/728/5696/6891/3106/5698/629/6351/6348
## DOID:974 4843/5329/50943/5243/3383/4210/5054/6354/3458/942/3552/9173/727897/729230/5328/3598/6372/3553/3569/3557/7097/834/3067/2212/4585/3486/133/2209/6374/2919/64127/6890/3627/3576/929/4023/627/2205/3579/729238/4582/7293/728/2214/6891/3107/3106/629/6351
## DOID:552 5743/2920/3383/3589/5054/1440/6354/6347/595/4891/3458/3552/9173/727897/29126/5328/3598/6590/54210/3553/3569/3557/7097/4316/4283/3486/10630/2921/6374/2919/6469/64127/6890/3965/3576/929/627/9332/729238/4582/4312/57016/2214/6351
## Count
## DOID:824 44
## DOID:3388 47
## DOID:403 58
## DOID:104 68
## DOID:974 49
## DOID:552 44
There is no built-in function specific for MSigDB gene sets, but there is a universal function enricher()
which accepts manually-specified gene sets. The gene sets object is simply a two-column data frame:
library(msigdbr)
gene_sets = msigdbr(category = "H")
map = gene_sets[, c("gs_name", "entrez_gene")]
head(map)
## # A tibble: 6 × 2
## gs_name entrez_gene
## <chr> <int>
## 1 HALLMARK_ADIPOGENESIS 19
## 2 HALLMARK_ADIPOGENESIS 11194
## 3 HALLMARK_ADIPOGENESIS 10449
## 4 HALLMARK_ADIPOGENESIS 33
## 5 HALLMARK_ADIPOGENESIS 34
## 6 HALLMARK_ADIPOGENESIS 35
## ID
## HALLMARK_INTERFERON_GAMMA_RESPONSE HALLMARK_INTERFERON_GAMMA_RESPONSE
## HALLMARK_INFLAMMATORY_RESPONSE HALLMARK_INFLAMMATORY_RESPONSE
## HALLMARK_INTERFERON_ALPHA_RESPONSE HALLMARK_INTERFERON_ALPHA_RESPONSE
## HALLMARK_TNFA_SIGNALING_VIA_NFKB HALLMARK_TNFA_SIGNALING_VIA_NFKB
## HALLMARK_COMPLEMENT HALLMARK_COMPLEMENT
## HALLMARK_IL6_JAK_STAT3_SIGNALING HALLMARK_IL6_JAK_STAT3_SIGNALING
## Description GeneRatio
## HALLMARK_INTERFERON_GAMMA_RESPONSE HALLMARK_INTERFERON_GAMMA_RESPONSE 55/347
## HALLMARK_INFLAMMATORY_RESPONSE HALLMARK_INFLAMMATORY_RESPONSE 54/347
## HALLMARK_INTERFERON_ALPHA_RESPONSE HALLMARK_INTERFERON_ALPHA_RESPONSE 33/347
## HALLMARK_TNFA_SIGNALING_VIA_NFKB HALLMARK_TNFA_SIGNALING_VIA_NFKB 49/347
## HALLMARK_COMPLEMENT HALLMARK_COMPLEMENT 39/347
## HALLMARK_IL6_JAK_STAT3_SIGNALING HALLMARK_IL6_JAK_STAT3_SIGNALING 22/347
## BgRatio pvalue p.adjust
## HALLMARK_INTERFERON_GAMMA_RESPONSE 200/4383 1.283631e-17 6.033064e-16
## HALLMARK_INFLAMMATORY_RESPONSE 200/4383 6.465947e-17 1.519498e-15
## HALLMARK_INTERFERON_ALPHA_RESPONSE 97/4383 8.600159e-14 1.347358e-12
## HALLMARK_TNFA_SIGNALING_VIA_NFKB 200/4383 1.359501e-13 1.597414e-12
## HALLMARK_COMPLEMENT 200/4383 6.053975e-08 5.690736e-07
## HALLMARK_IL6_JAK_STAT3_SIGNALING 87/4383 5.774922e-07 4.523689e-06
## qvalue
## HALLMARK_INTERFERON_GAMMA_RESPONSE 4.594047e-16
## HALLMARK_INFLAMMATORY_RESPONSE 1.157064e-15
## HALLMARK_INTERFERON_ALPHA_RESPONSE 1.025984e-12
## HALLMARK_TNFA_SIGNALING_VIA_NFKB 1.216396e-12
## HALLMARK_COMPLEMENT 4.333372e-07
## HALLMARK_IL6_JAK_STAT3_SIGNALING 3.444690e-06
## geneID
## HALLMARK_INTERFERON_GAMMA_RESPONSE 51056/57823/10797/3430/5743/3383/10135/6354/6347/6648/942/6772/29126/7130/81030/3659/3620/6737/94240/3601/8638/10906/3569/10068/834/10561/4283/7453/5371/84166/10410/2209/81894/9246/115361/3429/116071/6890/10791/3627/6373/2357/3669/54625/219285/9021/10581/7127/5359/5696/5699/10437/3106/5698/629
## HALLMARK_INFLAMMATORY_RESPONSE 6401/5329/2769/490/3383/5008/7076/4210/366/3249/6324/10135/3696/5054/1440/6354/6347/4891/1839/3552/8809/8807/1441/3624/7130/3759/6372/3659/3553/2867/3601/3569/7097/9153/4283/7162/133/4323/10630/60675/64127/3627/6373/5724/3576/136/929/2357/4973/8877/8519/1604/3269/728
## HALLMARK_INTERFERON_ALPHA_RESPONSE 51056/3430/135112/3659/6737/94240/8638/10906/2766/834/10561/83666/7453/10410/81894/9246/2634/115361/3429/116071/6890/3627/6373/3669/54625/219285/10581/8519/5359/5696/3107/10437/5698
## HALLMARK_TNFA_SIGNALING_VIA_NFKB 5329/490/5743/2920/3383/10135/5054/6347/374/595/6648/1839/3552/5341/8013/1958/3624/5328/7130/50486/6372/3659/3553/2354/3601/3569/8870/7097/3491/4929/467/2921/2919/80149/6890/3627/6373/2353/3726/1051/4973/8061/8877/7262/9021/23764/7127/9516/6351
## HALLMARK_COMPLEMENT 51056/843/5329/2219/5251/7076/760/7980/5054/5341/725/3659/948/3569/4322/834/838/1848/7941/4323/2207/714/1520/6280/6283/2919/308/1508/717/255738/1051/712/4973/23764/5359/1604/5698/629/4321
## HALLMARK_IL6_JAK_STAT3_SIGNALING 6354/5967/6772/7850/8809/1441/3659/3553/3601/948/3569/7097/4283/94/2921/5196/2919/3627/6373/929/9021/5320
## Count
## HALLMARK_INTERFERON_GAMMA_RESPONSE 55
## HALLMARK_INFLAMMATORY_RESPONSE 54
## HALLMARK_INTERFERON_ALPHA_RESPONSE 33
## HALLMARK_TNFA_SIGNALING_VIA_NFKB 49
## HALLMARK_COMPLEMENT 39
## HALLMARK_IL6_JAK_STAT3_SIGNALING 22
Note, in clusterProfiler, the background is intersect(all genes in the gene sets, user’s background genes).
bg_gene = convert_to_entrez_id(bg_gene)
## gene id might be SYMBOL (p = 0.990 )
## 'select()' returned 1:many mapping between keys and columns
bg_gene = sample(bg_gene, 10000)
tb = enrichGO(gene = diff_gene, ont = "BP", OrgDb = org.Hs.eg.db, universe = bg_gene)
head(tb)
## ID
## GO:0002237 GO:0002237
## GO:0030593 GO:0030593
## GO:0032496 GO:0032496
## GO:1990266 GO:1990266
## GO:0009617 GO:0009617
## GO:1903557 GO:1903557
## Description
## GO:0002237 response to molecule of bacterial origin
## GO:0030593 neutrophil chemotaxis
## GO:0032496 response to lipopolysaccharide
## GO:1990266 neutrophil migration
## GO:0009617 response to bacterium
## GO:1903557 positive regulation of tumor necrosis factor superfamily cytokine production
## GeneRatio BgRatio pvalue p.adjust qvalue
## GO:0002237 35/777 176/8844 3.073905e-06 0.008514811 0.008511081
## GO:0030593 18/777 63/8844 4.657375e-06 0.008514811 0.008511081
## GO:0032496 33/777 167/8844 6.768490e-06 0.008514811 0.008511081
## GO:1990266 19/777 72/8844 9.193310e-06 0.008514811 0.008511081
## GO:0009617 53/777 335/8844 1.524654e-05 0.008514811 0.008511081
## GO:1903557 16/777 56/8844 1.569064e-05 0.008514811 0.008511081
## geneID
## GO:0002237 4843/6401/6556/2920/3595/730249/5054/1440/1594/57379/942/7474/3552/29126/6590/6372/10288/3620/948/7097/6279/64332/249/6374/5196/2919/717/64127/3576/929/1051/1604/728/6891/11027
## GO:0030593 2920/7130/54210/6372/6279/2207/6283/6374/5196/2919/6850/64127/3576/6288/3579/728/6351/6349
## GO:0032496 4843/6401/6556/2920/3595/730249/5054/1440/1594/57379/942/7474/3552/29126/6590/6372/10288/3620/948/7097/6279/64332/249/6374/5196/2919/717/64127/3576/929/1051/1604/11027
## GO:1990266 2920/3552/7130/54210/6372/6279/2207/6283/6374/5196/2919/6850/64127/3576/6288/3579/728/6351/6349
## GO:0009617 4843/6401/6556/2920/3595/730249/5054/8029/1440/54757/1594/57379/942/7474/3552/29126/722/6590/54210/6372/10288/3620/948/7097/10561/84166/6279/64332/2209/2207/249/2634/6283/6374/5196/2919/6850/717/26253/338339/64127/6338/3576/929/2358/1051/5320/1604/728/6891/3133/3106/11027
## GO:1903557 7305/3458/942/7474/3552/948/7097/5795/5196/6850/64127/929/64581/353514/3133/11027
## Count
## GO:0002237 35
## GO:0030593 18
## GO:0032496 33
## GO:1990266 19
## GO:0009617 53
## GO:1903557 16
Warning: It seems when setting
universe
, the input gene listdiff_gene
is not intersected touniverse
in the analysis. You can check the values inGeneRatio
which is 777 for all DE genes, and this number is the same as whenuniverse
is not manually set. So be careful with this “improper” behaviour.
We can compare ORA with different backgrounds:
tb1 = enrichGO(gene = diff_gene, ont = "BP", OrgDb = org.Hs.eg.db)
tb2 = enrichGO(gene = diff_gene, ont = "BP", OrgDb = org.Hs.eg.db, universe = bg_gene)
tb1 = tb1@result
tb2 = tb2@result
cn = intersect(tb1$ID, tb2$ID)
plot(tb1[cn, "pvalue"], tb2[cn, "pvalue"], log = "xy",
xlim = c(1e-25, 1), ylim = c(1e-25, 1),
xlab = "default background", ylab = "self-defined background")
Or overlap between the significant GO terms:
enrichGO()
accepts an OrgDb
object as the source of the GO gene sets. We take pig as an example. random_genes()
is from GSEAtraining package.
library(org.Ss.eg.db)
##
diff_gene = random_genes(org.Ss.eg.db, 1000, "ENTREZID")
## 'select()' returned 1:many mapping between keys and columns
Here we set pvalueCutoff = 1, qvalueCutoff = 1
because genes are random genes and it is expected there won’t be too much significant terms left.
tb = enrichGO(gene = diff_gene, ont = "BP", OrgDb = org.Ss.eg.db,
pvalueCutoff = 1, qvalueCutoff = 1)
head(tb)
## ID
## GO:0034311 GO:0034311
## GO:0019439 GO:0019439
## GO:2000144 GO:2000144
## GO:0022900 GO:0022900
## GO:0006778 GO:0006778
## GO:1901361 GO:1901361
## Description
## GO:0034311 diol metabolic process
## GO:0019439 aromatic compound catabolic process
## GO:2000144 positive regulation of DNA-templated transcription initiation
## GO:0022900 electron transport chain
## GO:0006778 porphyrin-containing compound metabolic process
## GO:1901361 organic cyclic compound catabolic process
## GeneRatio BgRatio pvalue p.adjust qvalue
## GO:0034311 4/323 15/7101 0.003848599 0.9325015 0.9325015
## GO:0019439 15/323 155/7101 0.004479722 0.9325015 0.9325015
## GO:2000144 4/323 16/7101 0.004949998 0.9325015 0.9325015
## GO:0022900 8/323 60/7101 0.005445520 0.9325015 0.9325015
## GO:0006778 4/323 17/7101 0.006244531 0.9325015 0.9325015
## GO:1901361 15/323 161/7101 0.006364444 0.9325015 0.9325015
## geneID
## GO:0034311 100622165/100515451/100512419/100521367
## GO:0019439 414433/100515013/100623102/100155078/100622956/414425/100512966/445512/100624677/100154442/100513840/100621123/100511756/100517314/100526240
## GO:2000144 100525205/100515933/100515423/406188
## GO:0022900 100526209/100154130/100521478/808513/733605/100524239/100520959/100038000
## GO:0006778 396581/100152910/445512/100156375
## GO:1901361 414433/100515013/100152910/100623102/100155078/100622956/100512966/445512/100624677/100154442/100513840/100621123/100511756/100517314/100526240
## Count
## GO:0034311 4
## GO:0019439 15
## GO:2000144 4
## GO:0022900 8
## GO:0006778 4
## GO:1901361 15
The KEGG code of a specific organism can be found at https://rest.kegg.jp/list/organism
tb = enrichKEGG(gene = diff_gene, organism = "ssc", pvalueCutoff = 1, qvalueCutoff = 1)
head(tb)
## ID Description GeneRatio
## ssc04970 ssc04970 Salivary secretion 12/466
## ssc00860 ssc00860 Porphyrin metabolism 7/466
## ssc04270 ssc04270 Vascular smooth muscle contraction 15/466
## ssc04912 ssc04912 GnRH signaling pathway 11/466
## ssc04666 ssc04666 Fc gamma R-mediated phagocytosis 11/466
## ssc04750 ssc04750 Inflammatory mediator regulation of TRP channels 12/466
## BgRatio pvalue p.adjust qvalue
## ssc04970 90/9240 0.001784139 0.2877204 0.2736484
## ssc00860 36/9240 0.001850292 0.2877204 0.2736484
## ssc04270 137/9240 0.003725696 0.3862305 0.3673406
## ssc04912 90/9240 0.005396305 0.4195627 0.3990426
## ssc04666 94/9240 0.007481341 0.4382332 0.4167999
## ssc04750 109/9240 0.008628408 0.4382332 0.4167999
## geneID
## ssc04970 100522091/100516395/397184/100157641/100623628/100154056/396898/100620994/396888/100511702/397434/552898
## ssc00860 396581/110255665/100621486/445512/100625356/100152603/100156375
## ssc04270 100153927/100522091/100514711/100154587/100524227/397184/100157641/100623628/100154056/100620994/100514745/100514811/397434/100152637/552898
## ssc04912 100153927/414423/397184/100157641/100623628/100154056/100620994/574062/397516/100514745/100514811
## ssc04666 100153927/100514711/100626125/397184/100038328/100518663/100127478/613130/100515451/100514811/100512419
## ssc04750 100514711/397184/100157641/100623628/100626904/100154056/100620994/574062/100518663/100514811/110255240/100152637
## Count
## ssc04970 12
## ssc00860 7
## ssc04270 15
## ssc04912 11
## ssc04666 11
## ssc04750 12
Use msigdbr::msigdbr_species()
to see which organisms are supported.
gene_sets = msigdbr(species = "pig", category = "H")
map = gene_sets[, c("gs_name", "entrez_gene")]
map$entrez_gene = as.character(map$entrez_gene)
tb = enricher(gene = diff_gene, TERM2GENE = map, pvalueCutoff = 1, qvalueCutoff = 1)
head(tb)
## ID
## HALLMARK_CHOLESTEROL_HOMEOSTASIS HALLMARK_CHOLESTEROL_HOMEOSTASIS
## HALLMARK_MYOGENESIS HALLMARK_MYOGENESIS
## HALLMARK_IL6_JAK_STAT3_SIGNALING HALLMARK_IL6_JAK_STAT3_SIGNALING
## HALLMARK_PI3K_AKT_MTOR_SIGNALING HALLMARK_PI3K_AKT_MTOR_SIGNALING
## HALLMARK_ADIPOGENESIS HALLMARK_ADIPOGENESIS
## HALLMARK_UV_RESPONSE_DN HALLMARK_UV_RESPONSE_DN
## Description GeneRatio
## HALLMARK_CHOLESTEROL_HOMEOSTASIS HALLMARK_CHOLESTEROL_HOMEOSTASIS 7/198
## HALLMARK_MYOGENESIS HALLMARK_MYOGENESIS 14/198
## HALLMARK_IL6_JAK_STAT3_SIGNALING HALLMARK_IL6_JAK_STAT3_SIGNALING 7/198
## HALLMARK_PI3K_AKT_MTOR_SIGNALING HALLMARK_PI3K_AKT_MTOR_SIGNALING 8/198
## HALLMARK_ADIPOGENESIS HALLMARK_ADIPOGENESIS 13/198
## HALLMARK_UV_RESPONSE_DN HALLMARK_UV_RESPONSE_DN 10/198
## BgRatio pvalue p.adjust qvalue
## HALLMARK_CHOLESTEROL_HOMEOSTASIS 72/4191 0.05190873 0.7115993 0.7115993
## HALLMARK_MYOGENESIS 192/4191 0.06787965 0.7115993 0.7115993
## HALLMARK_IL6_JAK_STAT3_SIGNALING 82/4191 0.09085960 0.7115993 0.7115993
## HALLMARK_PI3K_AKT_MTOR_SIGNALING 103/4191 0.11197106 0.7115993 0.7115993
## HALLMARK_ADIPOGENESIS 193/4191 0.12247680 0.7115993 0.7115993
## HALLMARK_UV_RESPONSE_DN 140/4191 0.12372568 0.7115993 0.7115993
## geneID
## HALLMARK_CHOLESTEROL_HOMEOSTASIS 100113409/100514510/110256064/100152303/100152230/100153858/100520925
## HALLMARK_MYOGENESIS 100523293/780410/397630/100518681/100170845/110255887/100154420/574062/448812/100127478/100525465/110255240/100622921/100515564
## HALLMARK_IL6_JAK_STAT3_SIGNALING 396814/100626904/100524265/445512/100518854/397253/100511702
## HALLMARK_PI3K_AKT_MTOR_SIGNALING 100153927/100517077/100153160/780418/397324/100513840/100620726/100240743
## HALLMARK_ADIPOGENESIS 100511191/100737726/397604/100154990/100522734/414425/100524239/100511925/100627513/100579176/102160946/100125343/397583
## HALLMARK_UV_RESPONSE_DN 100620787/100515047/100522469/102162332/110262114/397184/100518559/100512419/397434/106508649
## Count
## HALLMARK_CHOLESTEROL_HOMEOSTASIS 7
## HALLMARK_MYOGENESIS 14
## HALLMARK_IL6_JAK_STAT3_SIGNALING 7
## HALLMARK_PI3K_AKT_MTOR_SIGNALING 8
## HALLMARK_ADIPOGENESIS 13
## HALLMARK_UV_RESPONSE_DN 10
OrgDb
object is avaiable
You can use enrichGO()
as long as you have an OrgDb
object:
Taking dolphin as an example.
library(AnnotationHub)
## Loading required package: BiocFileCache
## Loading required package: dbplyr
##
## Attaching package: 'AnnotationHub'
## The following object is masked from 'package:Biobase':
##
## cache
ah = AnnotationHub()
org_db = ah[["AH112418"]]
## loading from cache
diff_gene = random_genes(org_db, 1000, "ENTREZID")
tb = enrichGO(diff_gene, ont = "BP", OrgDb = org_db,
pvalueCutoff = 1, qvalueCutoff = 1)
head(tb)
## ID
## GO:0051346 GO:0051346
## GO:0050727 GO:0050727
## GO:0032501 GO:0032501
## GO:0043086 GO:0043086
## GO:2000142 GO:2000142
## GO:2000144 GO:2000144
## Description
## GO:0051346 negative regulation of hydrolase activity
## GO:0050727 regulation of inflammatory response
## GO:0032501 multicellular organismal process
## GO:0043086 negative regulation of catalytic activity
## GO:2000142 regulation of DNA-templated transcription initiation
## GO:2000144 positive regulation of DNA-templated transcription initiation
## GeneRatio BgRatio pvalue p.adjust qvalue
## GO:0051346 4/167 19/4458 0.004737161 0.7436095 0.7436095
## GO:0050727 4/167 20/4458 0.005751044 0.7436095 0.7436095
## GO:0032501 29/167 484/4458 0.006467817 0.7436095 0.7436095
## GO:0043086 6/167 46/4458 0.006820774 0.7436095 0.7436095
## GO:2000142 3/167 11/4458 0.006823258 0.7436095 0.7436095
## GO:2000144 3/167 11/4458 0.006823258 0.7436095 0.7436095
## geneID
## GO:0051346 101332097/101315793/101337749/101333718
## GO:0050727 101326011/101320522/101337436/101338049
## GO:0032501 101320545/101315588/101339773/101323188/101333312/101323047/101325153/101339561/101319663/101330468/101337145/101319299/101320522/101338710/101336375/101337436/101322448/101318072/101328812/101337563/101327555/101331351/101337921/101337923/101338049/101329403/101334628/101326070/101322077
## GO:0043086 101332097/101315793/101337749/101337436/101327555/101333718
## GO:2000142 101325153/101339522/101337671
## GO:2000144 101325153/101339522/101337671
## Count
## GO:0051346 4
## GO:0050727 4
## GO:0032501 29
## GO:0043086 6
## GO:2000142 3
## GO:2000144 3
enrichKEGG(gene = diff_gene, organism = ...)
We have introduced many ways to obtain gene sets for less well-studies organisms. The only thing to do here is to convert gene sets to a two-column data frame where gene sets are in the first column and genes are in the second column. Then use enricher()
.
enricher(diff_gene, TERM2GENE = ...)
tb
object
We used the same variable name tb
for the object returned by the various enrichment functions. They are all in the same format. It looks like a table, but be careful, it is actually not:
class(tb)
## [1] "enrichResult"
## attr(,"package")
## [1] "DOSE"
str(tb)
## Formal class 'enrichResult' [package "DOSE"] with 15 slots
## ..@ result :'data.frame': 1004 obs. of 9 variables:
## .. ..$ ID : chr [1:1004] "GO:0051346" "GO:0050727" "GO:0032501" "GO:0043086" ...
## .. ..$ Description: chr [1:1004] "negative regulation of hydrolase activity" "regulation of inflammatory response" "multicellular organismal process" "negative regulation of catalytic activity" ...
## .. ..$ GeneRatio : chr [1:1004] "4/167" "4/167" "29/167" "6/167" ...
## .. ..$ BgRatio : chr [1:1004] "19/4458" "20/4458" "484/4458" "46/4458" ...
## .. ..$ pvalue : num [1:1004] 0.00474 0.00575 0.00647 0.00682 0.00682 ...
## .. ..$ p.adjust : num [1:1004] 0.744 0.744 0.744 0.744 0.744 ...
## .. ..$ qvalue : num [1:1004] 0.744 0.744 0.744 0.744 0.744 ...
## .. ..$ geneID : chr [1:1004] "101332097/101315793/101337749/101333718" "101326011/101320522/101337436/101338049" "101320545/101315588/101339773/101323188/101333312/101323047/101325153/101339561/101319663/101330468/101337145/1"| __truncated__ "101332097/101315793/101337749/101337436/101327555/101333718" ...
## .. ..$ Count : int [1:1004] 4 4 29 6 3 3 8 3 3 25 ...
## ..@ pvalueCutoff : num 1
## ..@ pAdjustMethod: chr "BH"
## ..@ qvalueCutoff : num 1
## ..@ organism : chr "Tursiops truncatus"
## ..@ ontology : chr "BP"
## ..@ gene : chr [1:1000] "101318470" "109548850" "117311129" "117309957" ...
## ..@ keytype : chr "ENTREZID"
## ..@ universe : chr [1:4458] "101319146" "101322275" "101323809" "101330306" ...
## ..@ gene2Symbol : chr(0)
## ..@ geneSets :List of 1673
## .. ..$ GO:0000003: chr [1:87] "101335701" "101315473" "101315779" "101315844" ...
## .. ..$ GO:0000045: chr [1:9] "101316053" "101320545" "101322490" "101331278" ...
## .. ..$ GO:0000070: chr [1:26] "101315815" "101316537" "101316695" "101318454" ...
## .. ..$ GO:0000075: chr [1:23] "101316695" "101316733" "101318513" "101318624" ...
## .. ..$ GO:0000077: chr [1:14] "101316733" "101318513" "101319146" "101320252" ...
## .. ..$ GO:0000079: chr [1:11] "101324115" "101324169" "101326949" "101327555" ...
## .. ..$ GO:0000082: chr [1:15] "101317019" "101319146" "101321188" "101322275" ...
## .. ..$ GO:0000096: chr [1:7] "101318072" "101320414" "101320471" "101320949" ...
## .. ..$ GO:0000097: chr [1:6] "101320414" "101320471" "101320949" "101331056" ...
## .. ..$ GO:0000122: chr [1:35] "101316020" "101319446" "101320166" "101321309" ...
## .. ..$ GO:0000165: chr [1:48] "101315703" "101315844" "101316074" "101316105" ...
## .. ..$ GO:0000209: chr [1:33] "101315684" "101316554" "101319013" "101319502" ...
## .. ..$ GO:0000226: chr [1:61] "101315537" "101316394" "101316518" "101317000" ...
## .. ..$ GO:0000266: chr [1:9] "101319797" "101320522" "101322601" "101323172" ...
## .. ..$ GO:0000271: chr [1:9] "101323622" "101324350" "101329904" "101331306" ...
## .. ..$ GO:0000278: chr [1:95] "101315815" "101316323" "101316500" "101316537" ...
## .. ..$ GO:0000280: chr [1:45] "101315815" "101316537" "101316695" "101316904" ...
## .. ..$ GO:0000338: chr [1:3] "101320449" "101328620" "101337481"
## .. ..$ GO:0000375: chr [1:74] "101315667" "101316328" "101316554" "101317380" ...
## .. ..$ GO:0000377: chr [1:74] "101315667" "101316328" "101316554" "101317380" ...
## .. ..$ GO:0000398: chr [1:74] "101315667" "101316328" "101316554" "101317380" ...
## .. ..$ GO:0000463: chr [1:3] "101315781" "101320270" "101327032"
## .. ..$ GO:0000470: chr [1:3] "101315781" "101320270" "101327032"
## .. ..$ GO:0000819: chr [1:28] "101315815" "101316537" "101316695" "101318454" ...
## .. ..$ GO:0000902: chr [1:41] "101316391" "101316954" "101317123" "101317226" ...
## .. ..$ GO:0000904: chr [1:17] "101317123" "101317632" "101318355" "101319110" ...
## .. ..$ GO:0001525: chr [1:32] "101331207" "101317123" "101318052" "101319105" ...
## .. ..$ GO:0001539: chr [1:7] "101319299" "101324449" "101325022" "101326231" ...
## .. ..$ GO:0001568: chr [1:34] "101331207" "101315844" "101317123" "101318052" ...
## .. ..$ GO:0001578: chr [1:11] "101315537" "101319299" "101324140" "101326231" ...
## .. ..$ GO:0001666: chr [1:15] "101331207" "101317123" "101319146" "101319515" ...
## .. ..$ GO:0001667: chr [1:30] "101337436" "101321208" "101321450" "101322398" ...
## .. ..$ GO:0001701: chr [1:14] "101316053" "101319146" "101319991" "101322124" ...
## .. ..$ GO:0001704: chr [1:3] "101321450" "101325153" "101329251"
## .. ..$ GO:0001707: chr [1:3] "101321450" "101325153" "101329251"
## .. ..$ GO:0001756: chr [1:6] "101316583" "101319146" "101323188" "101323484" ...
## .. ..$ GO:0001774: chr [1:2] "101337436" "101329691"
## .. ..$ GO:0001775: chr [1:63] "101325136" "101336443" "101337436" "101338293" ...
## .. ..$ GO:0001816: chr [1:52] "101318178" "101325136" "101328418" "101331207" ...
## .. ..$ GO:0001817: chr [1:51] "101325136" "101328418" "101331207" "101335103" ...
## .. ..$ GO:0001818: chr [1:17] "101331207" "101335103" "101337436" "101318757" ...
## .. ..$ GO:0001819: chr [1:36] "101325136" "101328418" "101331207" "101335103" ...
## .. ..$ GO:0001838: chr [1:3] "101318072" "101335269" "101335912"
## .. ..$ GO:0001841: chr [1:2] "101318072" "101335912"
## .. ..$ GO:0001843: chr [1:2] "101318072" "101335912"
## .. ..$ GO:0001881: chr [1:3] "101323360" "101325741" "101334078"
## .. ..$ GO:0001889: chr [1:3] "101324101" "101325153" "101330304"
## .. ..$ GO:0001890: chr [1:8] "101315779" "101317123" "101319991" "101322124" ...
## .. ..$ GO:0001892: chr [1:4] "101319991" "101322124" "101325153" "101338909"
## .. ..$ GO:0001906: chr [1:9] "101337436" "101319508" "101319739" "101320115" ...
## .. ..$ GO:0001932: chr [1:81] "101315703" "101325136" "101337436" "101315844" ...
## .. ..$ GO:0001933: chr [1:24] "101337436" "101315844" "101317619" "101317925" ...
## .. ..$ GO:0001934: chr [1:51] "101315703" "101325136" "101337436" "101315844" ...
## .. ..$ GO:0001944: chr [1:36] "101331207" "101315844" "101317123" "101318052" ...
## .. ..$ GO:0002009: chr [1:16] "101316583" "101318072" "101319991" "101321450" ...
## .. ..$ GO:0002027: chr [1:7] "101335701" "101316752" "101319117" "101334074" ...
## .. ..$ GO:0002040: chr [1:10] "101320969" "101324963" "101326054" "101327652" ...
## .. ..$ GO:0002181: chr [1:23] "101317047" "101321536" "101323750" "101324454" ...
## .. ..$ GO:0002218: chr [1:31] "101325271" "101328418" "101316515" "101316747" ...
## .. ..$ GO:0002220: chr [1:5] "101328418" "101319301" "101333343" "101336375" ...
## .. ..$ GO:0002221: chr [1:26] "101325271" "101328418" "101316515" "101316747" ...
## .. ..$ GO:0002224: chr [1:13] "101325271" "101316747" "101318757" "101319483" ...
## .. ..$ GO:0002230: chr "101333312"
## .. ..$ GO:0002237: chr [1:13] "101335103" "101317804" "101318757" "101319301" ...
## .. ..$ GO:0002250: chr [1:43] "101325136" "101316872" "101318184" "101318466" ...
## .. ..$ GO:0002252: chr [1:31] "101325136" "101337436" "101315662" "101317324" ...
## .. ..$ GO:0002253: chr [1:45] "101325271" "101328418" "101315844" "101316515" ...
## .. ..$ GO:0002263: chr [1:17] "101325136" "101337436" "101315662" "101318088" ...
## .. ..$ GO:0002269: chr [1:2] "101337436" "101329691"
## .. ..$ GO:0002274: chr [1:16] "101337436" "101318080" "101318088" "101320899" ...
## .. ..$ GO:0002275: chr [1:4] "101337436" "101318088" "101325904" "101335932"
## .. ..$ GO:0002281: chr [1:2] "101337436" "101318088"
## .. ..$ GO:0002285: chr [1:13] "101325136" "101337436" "101315662" "101319146" ...
## .. ..$ GO:0002286: chr [1:7] "101337436" "101315662" "101319146" "101320053" ...
## .. ..$ GO:0002287: chr [1:5] "101337436" "101320053" "101325676" "101327291" ...
## .. ..$ GO:0002292: chr [1:5] "101337436" "101320053" "101325676" "101327291" ...
## .. ..$ GO:0002293: chr [1:5] "101337436" "101320053" "101325676" "101327291" ...
## .. ..$ GO:0002294: chr [1:5] "101337436" "101320053" "101325676" "101327291" ...
## .. ..$ GO:0002298: chr "101337436"
## .. ..$ GO:0002361: chr [1:2] "101337436" "101338957"
## .. ..$ GO:0002366: chr [1:16] "101325136" "101337436" "101315662" "101318088" ...
## .. ..$ GO:0002376: chr [1:262] "101317873" "101318178" "101325136" "101325271" ...
## .. ..$ GO:0002429: chr [1:15] "101328418" "101315844" "101318384" "101319301" ...
## .. ..$ GO:0002521: chr [1:25] "101325136" "101337436" "101316694" "101317123" ...
## .. ..$ GO:0002573: chr [1:8] "101337436" "101317123" "101322601" "101322970" ...
## .. ..$ GO:0002682: chr [1:116] "101325136" "101325271" "101328418" "101336443" ...
## .. ..$ GO:0002684: chr [1:81] "101325136" "101325271" "101328418" "101336443" ...
## .. ..$ GO:0002694: chr [1:37] "101325136" "101336443" "101337436" "101316111" ...
## .. ..$ GO:0002696: chr [1:24] "101325136" "101336443" "101337436" "101316111" ...
## .. ..$ GO:0002697: chr [1:16] "101325136" "101337436" "101319418" "101319446" ...
## .. ..$ GO:0002699: chr [1:13] "101325136" "101337436" "101319418" "101319446" ...
## .. ..$ GO:0002752: chr [1:5] "101328418" "101319301" "101333343" "101336375" ...
## .. ..$ GO:0002757: chr [1:35] "101325271" "101328418" "101315844" "101316515" ...
## .. ..$ GO:0002758: chr [1:26] "101325271" "101328418" "101316515" "101316747" ...
## .. ..$ GO:0002761: chr [1:4] "101337436" "101322970" "101336309" "101339719"
## .. ..$ GO:0002763: chr [1:4] "101337436" "101322970" "101336309" "101339719"
## .. ..$ GO:0002764: chr [1:36] "101325271" "101328418" "101315844" "101316515" ...
## .. ..$ GO:0002768: chr [1:16] "101328418" "101315844" "101318384" "101319301" ...
## .. ..$ GO:0002790: chr [1:11] "101337436" "101323295" "101329251" "101329901" ...
## .. .. [list output truncated]
## ..@ readable : logi FALSE
## ..@ termsim : num[0 , 0 ]
## ..@ method : chr(0)
## ..@ dr : list()
To convert it into a “real” table, DO NOT use as.data.frame()
which only returns the significant terms, use tb@result
.
Also some columns in tb@result
are not in the proper format, e.g. "GeneRatio"
and "BgRatio"
where numbers should be in numeric mode while not characters. In GSEAtraining, there is a add_more_columns()
which adds more columns to the tb@result
table.
tb2 = add_more_columns(tb)
head(tb2@result)
## ID
## GO:0051346 GO:0051346
## GO:0050727 GO:0050727
## GO:0032501 GO:0032501
## GO:0043086 GO:0043086
## GO:2000142 GO:2000142
## GO:2000144 GO:2000144
## Description
## GO:0051346 negative regulation of hydrolase activity
## GO:0050727 regulation of inflammatory response
## GO:0032501 multicellular organismal process
## GO:0043086 negative regulation of catalytic activity
## GO:2000142 regulation of DNA-templated transcription initiation
## GO:2000144 positive regulation of DNA-templated transcription initiation
## GeneRatio BgRatio pvalue p.adjust qvalue
## GO:0051346 4/167 19/4458 0.004737161 0.7436095 0.7436095
## GO:0050727 4/167 20/4458 0.005751044 0.7436095 0.7436095
## GO:0032501 29/167 484/4458 0.006467817 0.7436095 0.7436095
## GO:0043086 6/167 46/4458 0.006820774 0.7436095 0.7436095
## GO:2000142 3/167 11/4458 0.006823258 0.7436095 0.7436095
## GO:2000144 3/167 11/4458 0.006823258 0.7436095 0.7436095
## geneID
## GO:0051346 101332097/101315793/101337749/101333718
## GO:0050727 101326011/101320522/101337436/101338049
## GO:0032501 101320545/101315588/101339773/101323188/101333312/101323047/101325153/101339561/101319663/101330468/101337145/101319299/101320522/101338710/101336375/101337436/101322448/101318072/101328812/101337563/101327555/101331351/101337921/101337923/101338049/101329403/101334628/101326070/101322077
## GO:0043086 101332097/101315793/101337749/101337436/101327555/101333718
## GO:2000142 101325153/101339522/101337671
## GO:2000144 101325153/101339522/101337671
## Count n_hits n_genes gs_size n_totle log2_fold_enrichment z_score
## GO:0051346 4 4 167 19 4458 2.4905491 3.980786
## GO:0050727 4 4 167 20 4458 2.4165485 3.836220
## GO:0032501 29 29 167 484 4458 0.6775944 2.755350
## GO:0043086 6 6 167 46 4458 1.7998772 3.337696
## GO:2000142 3 3 167 11 4458 2.8640075 4.113834
## GO:2000144 3 3 167 11 4458 2.8640075 4.113834
Use the DE gene list in webgestalt_example_gene_list.rds
to perform ORA on GO/KEGG/MSigDB gene sets.
genes = readRDS(system.file("extdata", "webgestalt_example_gene_list.rds",
package = "GSEAtraining"))