Question: topGO GO enrichment analysis for common DEGs from multiple pairwise comparisons
gravatar for anikng
6 months ago by
anikng0 wrote:

I was trying to apply GO enrichment analysis using topGO to rice dataset with the help of Reference 1 and Reference 2. As per the manual and these references, it is a good idea to provide to p-value for ranking the genes.

  1. However, I am working on a DEG list that was commonly identified in different conditions (not a specific comparison). In that case, how can I rank the genes based on p-val or FDR? I am not sure how to input the DEGs and make a ranking vector

  2. Fisher test and KM test produce different GO enrichment result. Which one to select?

I use following code,

 mart <- biomaRt::useMart(biomart = "plants_mart",
                     dataset = "osativa_eg_gene",
                     host = '')

get_go <- biomaRt::getBM(attributes = c( "ensembl_gene_id",
                                     "go_id"), mart = mart)
get_go <- get_go[get_go$go_id != '',]

geneID2GO <- by(get_go$go_id,
            function(x) as.character(x))

all.genes <- sort(unique(as.character(get_go$ensembl_gene_id)))

#Input list


go.obj <- new("topGOdata", ontology='BP'
          , allGenes = int.genes
          , annot = annFUN.gene2GO
          , gene2GO = geneID2GO
          ,  nodeSize = 10

#Fisher test
 results <- runTest(go.obj, algorithm = "elim", statistic = "fisher") <- GenTable(object = go.obj, elimFisher = results)

#Kolmogorov-Smirnov (K-S) test 
results.ks <- runTest(go.obj, algorithm="classic", statistic="ks")
goEnrichment <- GenTable(go.obj, KS=results.ks, orderBy="KS", topNodes=20)
goEnrichment <- goEnrichment[goEnrichment$KS<0.05,]
goEnrichment <- goEnrichment[,c("GO.ID","Term","KS")]
goEnrichment$Term <- gsub(" [a-z]*\\.\\.\\.$", "", goEnrichment$Term)
goEnrichment$Term <- gsub("\\.\\.\\.$", "", goEnrichment$Term)
goEnrichment$Term <- paste(goEnrichment$GO.ID, goEnrichment$Term, sep=", ")
goEnrichment$Term <- factor(goEnrichment$Term, levels=rev(goEnrichment$Term))
goEnrichment$KS <- as.numeric(goEnrichment$KS)
ADD COMMENTlink modified 6 months ago by antonioggsousa2.0k • written 6 months ago by anikng0
gravatar for antonioggsousa
6 months ago by
antonioggsousa2.0k wrote:


Regarding your questions:

  1. So, if you have a, let's call it, consensus DEG list that was obtained by comparing multiple DEG lists across a specific condition of interest, and retrieving only the DEG genes that were identified as being differentially expressed across all the multiple DEG list comparison, you cannot do GO enrichment based on ranks, because the same DEG gene can (will) have different ranks in the different multiple DEG list compared. Although there is the possibility of doing GO enrichment without using rank-based methods, giving a list of interesting genes, as it is your case. See the topGO vignette about that on the section 4.4Predefined list of interesting genes. There a factor gene list assuming 2 possible levels - 0 or 1 - where 1 is the interesting genes and 0 non-interesting genes.

  2. See this Biostars post: topGO which statistical test (fisher or KS) to use ?

I hope this helps,


ADD COMMENTlink written 6 months ago by antonioggsousa2.0k

Thanks for the explanation and reference @antonioggsousa.

ADD REPLYlink written 6 months ago by anikng0
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2068 users visited in the last hour