2

When executing R commands with the biomaRt package, I often get the error "Internal Server Error (HTTP 500)." with basic commands like

ensembl<-useMart("ensembl")
ensembl <- useMart("ensembl", dataset="hsapiens_gene_ensembl")

These commands occasionally work however. I'm not sure if this is an issue on the Biomart server's end, or if there's something that could be causing it on my end, like an old package (I tried reinstalling Biomart). Has anyone dealt with a similar issue?

AldehydeDeva
  • 158
  • 3
  • 10
  • 1
    I fixed a similar error on my machine by adding `ssl.verifypeer = FALSE` to `useMart()`. But I don't know if that's a great idea. – neilfws Feb 03 '20 at 02:02

2 Answers2

3

I circumvented this by setting mirror argument to "useast". Valid mirror options are 'www', 'uswest', 'useast', 'asia'. If no mirror is specified the primary site at www.ensembl.org will be used (it appears they are overloaded on the primary).

ensembl = useEnsembl(biomart = "ensembl", dataset = "hsapiens_gene_ensembl", mirror = "useast")
bovaird
  • 46
  • 2
0

I tried setting the mirror and still get the same error. I recommend the following function:

library(dplyr)

mouse_human_genes = read.csv("http://www.informatics.jax.org/downloads/reports/HOM_MouseHumanSequence.rpt",sep="\t")

convert_mouse_to_human <- function(gene_list){
  
  output = c()
  
  for(gene in gene_list){
    class_key = (mouse_human_genes %>% filter(Symbol == gene & Common.Organism.Name=="mouse, laboratory"))[['DB.Class.Key']]
    if(!identical(class_key, integer(0)) ){
      human_genes = (mouse_human_genes %>% filter(DB.Class.Key == class_key & Common.Organism.Name=="human"))[,"Symbol"]
      for(human_gene in human_genes){
        output = append(output,human_gene)
      }
    }
  }
  
  return (output)
}
Colin McGovern
  • 105
  • 1
  • 6