Body: <p>I'm attempting to query from BioMart in R using the biomaRt package with a script I've used many times before. I connect to the service with this line of code:</p>
  
  <pre><code>mart &lt;- useMart(biomart = "ENSEMBL_MART_ENSEMBL", dataset = "mmusculus_gene_ensembl")
  </code></pre>
  
  <p>And I query from the service with this line of code:</p>
  
  <pre><code>getBM(attributes = c("ensembl_gene_id", "mgi_symbol", "gene_biotype", "description"), filters = "ensembl_gene_id", values = function.df[, 1], mart = mart)
  </code></pre>
  
  <p>However, when attempting to rerun the code this morning I was met with the following error message:</p>
  
  <pre><code>Error in getBM(attributes = c("ensembl_gene_id", "mgi_symbol", "gene_biotype",  : 
    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. 
  </code></pre>
  
  <p>When trying to troubleshoot the problem, I discovered that useast.ensembl.org is down, which I believe is the mirror I connect to in the script. From <a href="http://www.ensembl.org/info/data/biomart/biomart_r_package.html" rel="nofollow noreferrer">this page</a> I read that you can manually edit the mirror you connect to with the host option in useMart(), so I edited my connection line like so:</p>
  
  <pre><code>mart &lt;- useMart(biomart = "ENSEMBL_MART_ENSEMBL", dataset = "mmusculus_gene_ensembl", host = "uswest.ensembl.org")
  </code></pre>
  
  <p>Looking at uswest.ensembl.org, it appears to be up and running, so I expected this fix to work, however, I get the same error. Am I doing something wrong with this fix so that biomaRt still connects to the useast mirror? Is there a way to get the connection to work currently, or am I forced to wait until useast comes back online?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-03-04T22:19:59.027Z
Comments.Text: I'm not sure that mirror availability is the issue, because if you substitute `useast` in your last line of code, a different error is returned. But you could try adding `ensemblRedirect = FALSE`.
Comments.UserDisplayName: neilfws
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-03-05T20:55:44.147Z
Comments.Text: Which version of biomaRt are you using? Maybe it is fixed on the latest (if you're not already using it). Did you check if tha API has changed via the browser?
Comments.UserDisplayName: llrs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-03-05T23:29:33.960Z
Comments.Text: If you are using this in a script with few modifications, a workaround can be to save copies of the `useMart`, `getAnnotation`, `getBM`, etc., objects to files ahead of time. This way you dont have to load them from the internet every time.
Comments.UserDisplayName: user5359531
Tags: <r><biomart><ensembl>
Title: Cannot connect to BioMart webservice in R script, how to troubleshoot connection?
ThreadText: # Cannot connect to BioMart webservice in R script, how to troubleshoot connection?
  
  (Asked by: username_0 on 2018-03-04)
  
  I'm attempting to query from BioMart in R using the biomaRt package with a script I've used many times before. I connect to the service with this line of code:
  
  ```
  mart <- useMart(biomart = "ENSEMBL_MART_ENSEMBL", dataset = "mmusculus_gene_ensembl")
  
  ```
  
  And I query from the service with this line of code:
  
  ```
  getBM(attributes = c("ensembl_gene_id", "mgi_symbol", "gene_biotype", "description"), filters = "ensembl_gene_id", values = function.df[, 1], mart = mart)
  
  ```
  
  However, when attempting to rerun the code this morning I was met with the following error message:
  
  ```
  Error in getBM(attributes = c("ensembl_gene_id", "mgi_symbol", "gene_biotype",  : 
    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. 
  
  ```
  
  When trying to troubleshoot the problem, I discovered that useast.ensembl.org is down, which I believe is the mirror I connect to in the script. From [this page](http://www.ensembl.org/info/data/biomart/biomart_r_package.html) I read that you can manually edit the mirror you connect to with the host option in useMart(), so I edited my connection line like so:
  
  ```
  mart <- useMart(biomart = "ENSEMBL_MART_ENSEMBL", dataset = "mmusculus_gene_ensembl", host = "uswest.ensembl.org")
  
  ```
  
  Looking at uswest.ensembl.org, it appears to be up and running, so I expected this fix to work, however, I get the same error. Am I doing something wrong with this fix so that biomaRt still connects to the useast mirror? Is there a way to get the connection to work currently, or am I forced to wait until useast comes back online?
  
  **Tags:** r, biomart, ensembl
  
  > **Comments:**
  > **username_1**: I'm not sure that mirror availability is the issue, because if you substitute `useast` in your last line of code, a different error is returned. But you could try adding `ensemblRedirect = FALSE`.  
  > **username_2**: Which version of biomaRt are you using? Maybe it is fixed on the latest (if you're not already using it). Did you check if tha API has changed via the browser?  
  > **username_3**: If you are using this in a script with few modifications, a workaround can be to save copies of the `useMart`, `getAnnotation`, `getBM`, etc., objects to files ahead of time. This way you dont have to load them from the internet every time.  
  
  ---
  
  ## 0 answers
  
  