Errors when extracting significant genes per from topgo data
Entering edit mode
5.6 years ago
tiago211287 ★ 1.4k

I'm using topGO to get enriched GO terms from my data. I was able to succesful get the enriched GO terms, but, at the end of the pipeline, there are two commands throwing errors which I could not solve.

>    tgd <- new( "topGOdata", ontology="BP", allGenes = alg, nodeSize=5,
    , mapping="", ID = "ensembl" )

First error, when I try to plot the distribution of the genes annotated to a GO term

> print(showGroupDensity(object = tgd, whichGO = "GO:0015980", ranks = TRUE))
Error in factor(group, labels = paste(c("complementary", whichGO), "  (",  : 
  invalid 'labels'; length 2 should be 1 or 0

Second error, when I try to get the genes in any GO id, I receive a error.

In the topGO manual, the chip argument is set to affyLib, but how can I use the mouse annotation instead? When I try it fails.

> gt <- printGenes(tgd, whichTerms = "GO:0015980", chip =, numChar = 10)
Error in as.vector(x, "character") : 
  cannot coerce type 'environment' to vector of type 'character'

Anyone with experience in using the topGO can help me out?

RNA-Seq Bioconductor topGO R • 3.6k views
Entering edit mode

I discovered that, in the first error, using = F, the error stop and the plot is shown. I dont know why is this though. Still would like to get an explanation. The manual does not use this after all.

Entering edit mode

Ok, in the second error, instead of, I should sign a variable of type character pointing to the database like:


but now, another error is shown:

Error in get(paste(chip, "ENTREZ", sep = "")) : 
  object 'org.Mm.egENTREZ' not found

This second error has to the fact that, topGO search for entrezID in the mouse.db, but I used Ensembl ID's, the question now is, I use ENTREZ_ID or change the R script for do the job?

Entering edit mode

Sorry that I am not able to help you in direct way. But I have an alternate suggestion. Since you are struggling just to perform enrichment analysis, try GeneSCF with your obtained gene list.

Entering edit mode
5.6 years ago
tiago211287 ★ 1.4k

Answering my own question...

The first error can be solved by simple adding = F to the command,still not sure why.

The second problem was more confusing. And then I realize that I just want the gene ID for each GO, and not that fancy table from topGO. We can get that information by using:

#####get genes/GO######

  allGO = genesInTerm(tgd) ##get all GOs and their genes from the topgo result.
  ANOTATION = lapply(allGO,function(x) x[x %in% deseq_result_DEGS_only$ensembl_gene_id] ) ##get only my Differentially expressed genes in allGO

  tableGO.genes <- ANOTATION[tab$GO.ID] ## get only the GO's located in the result of topGO
  LS.df =, tableGO.genes)) ## Transform it to a data frame.

Login before adding your answer.

Traffic: 1484 users visited in the last hour
Help About
Access RSS

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

Powered by the version 2.3.6