Error in BioMartVersion
1
0
Entering edit mode
6.2 years ago
hodayabeer ▴ 10

Hi,

I am trying to convert between EntrezID to gene symbol using 'bioMart' package and the following function:

source("https://bioconductor.org/biocLite.R")
library('EnrichmentBrowser')
library('biomaRt')

convert_to_genes_symbol<-function(ptwy_genes){
  library('EnrichmentBrowser')
  library('biomaRt')
  #ptwy_name<-get_official_name(names(ptwy_genes))
  ensembl = useEnsembl(biomart="ensembl",dataset="hsapiens_gene_ensembl",GRCh=37)

  entrezIDs2Genes <- getBM(attributes=c('hgnc_symbol','entrezgene'),
                         filters = 'entrezgene',
                         values = ptwy_genes, # a vector containing the EntrezIds to convert
                         mart = ensembl)

  entrezIDs2Genes.ordered <- entrezIDs2Genes
  entrezIDs2Genes.ordered <- entrezIDs2Genes.ordered[order(entrezIDs2Genes.ordered$hgnc_symbol),]
  gene_symbol_list<-entrezIDs2Genes.ordered$hgnc_symbol
  gene_symbol_list<-unique(gene_symbol_list[gene_symbol_list != ""])#remove redundancy and empty elements

  return(gene_symbol_list)#check if returns the appropriate value

}

I have a for loop that calls this function, each time for a different gene list, It worked perfect for about 100 different list of genes, but at some point it outputs the following error:

Request to BioMart web service failed. Verify if you are still connected to the internet.  Alternatively the BioMart web service is temporarily down.  Check http://www.biomart.org and verify if this website is available.
Error in if (BioMartVersion == "\n" | BioMartVersion == "") { : 
  argument is of length zero

(the link works for me)
this is very strange, especially because I checked the specific gene list were it stops, and tried to apply to it the function manually (out of the for loop), and it worked!

I would very appritiate any idea for a solution to that...

thank you in advance!

R bioMart entrezID gene symbol gene • 1.5k views
ADD COMMENT
0
Entering edit mode

When calling web services via a loop one should build a sleep/wait time to prevent going over maximum connections allowed by the site over unit time (e.g. https://github.com/Ensembl/ensembl-rest/wiki/Rate-Limits ).

ADD REPLY
0
Entering edit mode

Can you update your post to include the output of sessionInfo() so we can see which versions of R and biomaRt you're using? I suspect your package is a little out of data, www.biomart.org hasn't been the relevant website to check for quite a while & that error message is no longer in the current version of the package.

ADD REPLY
0
Entering edit mode
6.2 years ago
James Ashmore ★ 3.4k

A slightly easier and faster method would be to use the annotation packages Bioconductor provides:

library("org.Hs.eg.db")
entrez <- c("100422954", "100422957", "100422959", "100422962")
symbol <- mapIds(org.Hs.eg.db, keys = entrez, keytype = "ENTREZID", column = "SYMBOL")
ADD COMMENT

Login before adding your answer.

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