Question: GO analysis using topGO Arabidopsis
0
gravatar for Sreeraj Thamban
2.4 years ago by
Indian Institute of Science Education and Research
Sreeraj Thamban140 wrote:

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)
ADD COMMENTlink modified 5 months ago by Kevin Blighe48k • written 2.4 years ago by Sreeraj Thamban140
7
gravatar for e.rempel
2.4 years ago by
e.rempel770
Germany, Heidelberg, COS
e.rempel770 wrote:

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 COMMENTlink written 2.4 years ago by e.rempel770
1

Thank you so much, it worked.

ADD REPLYlink written 2.4 years ago by Sreeraj Thamban140
Please log in to add an answer.

Help
Access

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