I understand, here is an example with topGO where you need a differential expression table (DESeq2 for example) and a table of GO terms:
library(topGO)
library(ALL)
#DEGs table.
DE<-read.csv("C:/DE.csv")
#Go terms and ID
genes2GO<-readMappings(file = "C:/Genes2GO.txt",sep = "\t", IDsep = ";")
#Column with ID and p-value
GeneList <-DE[,6]
names(GeneList) <-DE[,1]
#Object GO
GOdata <-new("topGOdata",
description = "Simple session", ontology = "BP", #BP, MF o CC
allGenes = GeneList ,geneSel = topDiffGenes,
nodeSize = 10,
annot=annFUN.gene2GO,gene2GO = genes2GO )
#Test Fisher o KS
Fisher <- runTest(GOdata , algorithm = "classic", statistic = "fisher")
KS <- runTest(GOdata , algorithm = "classic", statistic = "ks")
KS_elim <- runTest(GOdata , algorithm = "elim", statistic = "ks")
#Results
Genetable<-GenTable(GOdata, classicFisher = Fisher,classicKS = KS, elimKS = KS_elim,orderBy = "elimKS", ranksOf = "classicFisher", topNodes =20)
Review the Bioconductor manual.
Hello,
To perform functional enrichment analysis there are packages such as topGO or clusterProfiler that can work very well. Lately I've been using clusterProfiler for the graphs it comes from, maybe you should take a look at the clusterProfiler manual:
https://yulab-smu.top/biomedical-knowledge-mining-book/clusterprofiler-go.html
If your organism does not have support you may need to use AnnotationHub to retrieve GO terms:
https://guangchuangyu.github.io/cn/2017/07/clusterprofiler-maize/#disqus_thread
Thank u for your reply. The problem is that I used the genome and gene annotation from that webpage, not ensemble or ncbi, so I have to use the Goterm.txt file from that webpage