biomaRT getBM error
1
0
Entering edit mode
scanchi • 0
@scanchi-14313
Last seen 6.7 years ago

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

 

 

 

 

 

 

 

biomart getbm ensembl • 2.1k views
ADD COMMENT
0
Entering edit mode
Mike Smith ★ 6.6k
@mike-smith
Last seen 7 hours ago
EMBL Heidelberg

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 COMMENT
0
Entering edit mode

Thank you Mike! That fixed the issue. 

ADD REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY

Login before adding your answer.

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