GO analysis using topGO Arabidopsis
1
0
Entering edit mode
7.6 years ago

Hi, I have a list differentially expressed genes and I wanted to do GO enrichment analysis using topGO. I am having trouble making a geneID2GO annotation file, I extracted GO terms corresponding to each gene ID using the following script. How to make the 'geneID2GO' object from the following script compatible with topGO? Thanks.

library("biomaRt")
#collect gene names from biomart
mart <- biomaRt::useMart(biomart = "plants_mart",
                         dataset = "athaliana_eg_gene",
                         host = 'plants.ensembl.org')
# Get ensembl gene ids and GO terms
GTOGO <- biomaRt::getBM(attributes = c( "ensembl_gene_id",
                                     "go_id"), mart = mart)
#examine result
head (GTOGO)
#Remove blank entries
GTOGO <- GTOGO[GTOGO$go_id != '',]
# convert from table format to list format
geneID2GO <- by(GTOGO$go_id,
                GTOGO$ensembl_gene_id,
                function(x) as.character(x))
#examine result
head (geneID2GO)
RNA-Seq geneontology GOenrichment topGO • 8.0k views
ADD COMMENT
10
Entering edit mode
7.6 years ago
e.rempel ★ 1.1k

Hi Sreeraj,

you can create 'topGOdata' object by calling

go.obj = new("topGOdata", ontology='BP'
, allGenes = int.genes
, annot = annFUN.gene2GO
, gene2GO = geneID2GO)

where int.genes is a factor containing the information which genes are interesting (in your case, differentially expressed).

Here a small working example (run after your lines):

all.genes <- sort(unique(as.character(GTOGO$ensembl_gene_id)))
int.genes <- sample(x = all.genes, size = 200) # some random genes 
int.genes <- factor(as.integer(all.genes %in% int.genes))
names(int.genes) = all.genes

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

results <- runTest(go.obj, algorithm = "elim", statistic = "fisher")

results.tab <- GenTable(object = go.obj, elimFisher = results)

The results.tab contains the table of enriched GO terms.

HTH

ADD COMMENT
2
Entering edit mode

Thank you so much, it worked.

ADD REPLY

Login before adding your answer.

Traffic: 1613 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6