Search
Question: biomaRT getBM error
0
gravatar for scanchi
6 months ago by
scanchi0
scanchi0 wrote:

Dear All,

I have used this code to query biomart database previously with no error. 

mart <- biomaRt::useMart(biomart = "ENSEMBL_MART_ENSEMBL",
                         dataset = "hsapiens_gene_ensembl",
                         host = 'ensembl.org')
mart
Object of class 'Mart':
  Using the ENSEMBL_MART_ENSEMBL BioMart database
  Using the hsapiens_gene_ensembl dataset

mapping <- getBM(attributes = c("ensembl_gene_id", "ensembl_transcript_id"), mart = mart)

But now, I get two different errors:

mapping <- getBM(attributes = c("ensembl_gene_id","ensembl_transcript_id"), mart = mart)
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : line 1 did not have 3 elements
mapping <- biomaRt::getBM(attributes = c("ensembl_gene_id","ensembl_transcript_id"), mart = mart)
No encoding supplied: defaulting to UTF-8.
Error in biomaRt::getBM(mart = mart, attributes = c("ensembl_transcript_id", : The query to the BioMart webservice returned an invalid result: biomaRt expected a character string of length 1. Please report this to the mailing list.

Is this related to the biomaRt connection issues that have been recently posted ?

 

sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS release 6.6 (Final)

Matrix products: default
BLAS: /projects/builder-group/jpg/R-bioconductor/lib64/R/lib/libRblas.so
LAPACK: /projects/builder-group/jpg/R-bioconductor/lib64/R/lib/libRlapack.so

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] dplyr_0.7.4    biomaRt_2.34.1

 

 

 

 

 

 

 

ADD COMMENTlink modified 6 months ago by Mike Smith2.9k • written 6 months ago by scanchi0
0
gravatar for Mike Smith
6 months ago by
Mike Smith2.9k
EMBL Heidelberg / de.NBI
Mike Smith2.9k wrote:

This is the same issue seen in biomaRt getBM error in scan

For the host argument you need to explicitly put the 'www ', since there are many possible subdomains for ensembl.org e.g.

mart <- useMart(biomart = "ENSEMBL_MART_ENSEMBL", 
                           dataset = "hsapiens_gene_ensembl", 
                           host = "www.ensembl.org")

This has been patched in the developmental version of biomaRt.

ADD COMMENTlink modified 6 months ago • written 6 months ago by Mike Smith2.9k

Thank you Mike! That fixed the issue. 

ADD REPLYlink written 6 months ago by scanchi0

Hi Mike,

I am having the same issue. I get the following error:

"Error in getBM(attributes = c("hgnc_symbol", "ensembl_gene_id"), filters = "ensembl_gene_id",  : 
  The query to the BioMart webservice returned an invalid result: biomaRt expected a character string of length 1. Please report this to the mailing list.".

My code is:

library(biomaRt)
listMarts()
ensembl <- useMart(biomart = "ENSEMBL_MART_ENSEMBL",
                  dataset="hsapiens_gene_ensembl",
                  host = "www.ensembl.org",
                  path="/biomart/martservice")
ids=HLD$ensembl_gene_id
symbols =  getBM(attributes = c("hgnc_symbol", "ensembl_gene_id"),
                 filters = "ensembl_gene_id", 
                 values = ids,
                 mart = ensembl)

 

I have tried the code even without path function in useMart but keeps getting the same error.

Thank you for your help.

ADD REPLYlink written 6 months ago by sonal.gahlawat0

On this site it's normally good practice to start a new question, rather than comment on an old one, they're much more likely to get noticed.

I can run your example without a problem, so can you post a new question and also include the output of the command `sessionInfo()`.  This lets us see the versions of R and biomaRt that you are using.

ADD REPLYlink written 6 months ago by Mike Smith2.9k
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.2.0
Traffic: 133 users visited in the last hour