This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error using BioMart. No encoding supplied.

Does anyone know how to solve this error? I have never seen this error before and my current script has been working fine up until this point.

 > t2g <- biomaRt::getBM(
 +   attributes = c("ensembl_transcript_id", "transcript_version",
 +                  "ensembl_gene_id", "external_gene_name", "description",
 +                  "transcript_biotype"), mart = mart)
 No encoding supplied: defaulting to UTF-8.
 Error in biomaRt::getBM(attributes = c("ensembl_transcript_id", "transcript_version",  : 
 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.
rna-seq r bio genome biomart

2 answers

For me the Ensembl mirror sites are down. It looks like you're US based, so by default you'll get redirected to uswest.ensembl.org or useast.ensembl.org, neither of which are working for me at the moment.

The main site is working so you want to use www.ensembl.org as your host. However you also have to supply the argument ensemblRedirect = FALSE, otherwise their internal redirection will simply send you back to your local site. This works for me, even if I'm using a server based in Texas:

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

After some discussion with the Ensembl BioMart team the plan going forward is to remove the redirection entirely when using biomaRt, so this should no longer be an issue, and you'll go to whatever address you've provided. I'll try to update here when that's been done.


The 'No Encoding Supplied' message is a red herring relating to the content being returned by the server - you see it whether there's a problem or not. I've already addressed this in the developmental version of biomaRt, and will update the release version too. It's not very helpful to end users!

Your query works fine for me. There is a similar query on Ensembl helpdesk with the same error at about the same time, so maybe there was a short-term problem with biomaRt connectivity.

If you're still having the problem, can you send us details of your connection to the mart. Are you using the main mart or one of the mirrors (eg uswest.ensembl.org)?

Thank you! It seems it was a small connection error. It is working fine now!

Log in to answer this question.