Error with using getBM function in biomaRt
1
0
Entering edit mode
@mortezaaslanzadeh-23584
Last seen 3.8 years ago

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

class(bg_genes) ----> character
table(sapply(bg_genes, class)) ----> character 22287
go r software error R biomaRt • 1.1k views
ADD COMMENT
0
Entering edit mode

Cross-posted: https://www.biostars.org/p/440156/ In the future, be sure to mention [in your question], the other web-sites where you have posted your question. This helps to prevent people duplicating efforts.

ADD REPLY
0
Entering edit mode
@mortezaaslanzadeh-23584
Last seen 3.8 years ago

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

ADD COMMENT
0
Entering edit mode

You will often get better results by using useEnsembl rather than useMart, and choosing the closest mirror (see the 'mirror' argument).

ADD REPLY
0
Entering edit mode

Thank you for your response. So you mean with using useEnsembl the getBM function will perform faster?

The command line should be like db <- useEnsembl('ENSEMBL_MART_ENSEMBL',dataset='mmusculus_gene_ensembl', host="www.ensembl.org") ??

ADD REPLY
0
Entering edit mode

If you use useEnsembl() I would ignore the host argument e.g.

useEnsembl('ENSEMBL_MART_ENSEMBL', dataset='mmusculus_gene_ensembl')

If you use it like that it will try to connect to the closest Ensembl mirror to your location - this should be the fastest responding version.

Sometimes there will be a problem with the mirror it chooses automatically, so you can override that with the mirror argument. Valid options for that are www, useast, uswest or asia and will force biomaRt to connect to the mirror you as for.

This is equivalent to specifying a mirror URL in the host argument, but I think it's easier to remember and understand.

ADD REPLY

Login before adding your answer.

Traffic: 735 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