Question: Error in BioMartVersion
0
gravatar for hodayabeer
21 months ago by
hodayabeer10
hodayabeer10 wrote:

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!

ADD COMMENTlink modified 21 months ago by James Ashmore2.7k • written 21 months ago by hodayabeer10

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 REPLYlink modified 21 months ago • written 21 months ago by genomax73k

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 REPLYlink written 21 months ago by Mike Smith1.4k
0
gravatar for James Ashmore
21 months ago by
James Ashmore2.7k
UK/Edinburgh/MRC Centre for Regenerative Medicine
James Ashmore2.7k wrote:

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 COMMENTlink modified 21 months ago • written 21 months ago by James Ashmore2.7k
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: 2343 users visited in the last hour