This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error with using getBM function in biomaRt

I have search a lot of online sources to solve this problem but couldn't. I'm using getBM() function of biomaRt but getting an error. I have used this code like 7 months ago without any error but now it's giving error and I think it should probably be because of the server ????

what I use:

db <- useMart('ENSEMBL_MART_ENSEMBL',dataset='mmusculus_gene_ensembl', host="www.ensembl.org")
go_ids <- getBM(attributes=c('go_id', 'ensembl_gene_id', 'namespace_1003'), filters='ensembl_gene_id', values=bg_genes, mart=db)

values=bg_genes is around ~20000 gene ids. I tried with less gene ids (10) then it worked.

The ERROR:

Error in getBM(attributes = c("go_id", "ensembl_gene_id", "namespace_1003"),  : 
  The query to the BioMart webservice returned an invalid result: biomaRt expected a character string of length 1. 
Please report this on the support site at http://support.bioconductor.org

It there any other way to solve this? I need all my ~20000 in values=bg_genes

rna-seq r software error biomart

There's probably an element in bg_genes that is not a character string.

What is the output to these commands:

class(bg_genes)
table(sapply(bg_genes, class))

bg_genes class is character and the output for the second command is character 22287

I'd recommend passing bg_genes in batches of 5000 and then picking the batch that errors out, then drilling down further to find examples of entries that cause this error.

I couldn't understand exactly what you just recommended. Since I need all the background genes for GO analyses how reliable it is to cut them in batches of 5000 genes?

When I tried to use this with fewer genes it worked. Isn't this because of the server error? I was also getting an unusual ensemble error when I was trying to download some data manually.

1 answer

It seems that there was a server error in ensembl. I ran my code again and again (without any change) and finally, it completed the downloading without any error

Log in to answer this question.