biomaRt error unable to fix: need help troubleshooting
1
4
Entering edit mode
Dina ▴ 50
@c2bd1bf1
Last seen 22 months ago
United States

I am converting murine gene lists to human genes using the code below from https://www.r-bloggers.com/2016/10/converting-mouse-to-human-gene-names-with-biomart-package/

convertMouseGeneList <- function(x){ 
  require("biomaRt")
  human = useMart("ensembl", dataset = "hsapiens_gene_ensembl")
  mouse = useMart("ensembl", dataset = "mmusculus_gene_ensembl")
  genesV2 = getLDS(attributes = c("mgi_symbol"), filters = "mgi_symbol", values = x , mart = mouse, attributesL = c("hgnc_symbol"), martL = human, uniqueRows=T)
  humanx <- unique(genesV2[, 2])
  # Print the first 6 genes found to the screen
  print(head(humanx))
  return(humanx)
}

I have used this function to great success in the very recent past! as recently as early March 2022!

Today I wanted to clean up my code, and regenerate some lists. So I copied and pasted the code exactly as i used it before. The only thing I changed was the list names, but the contents of the lists are the same but now upon using it I get the following error:

Error: biomaRt has encountered an unexpected server error.
Consider trying one of the Ensembl mirrors (for more details look at ?useEnsembl)

I have tried using mirrors however it has failed as well! Those errors usually just say things like it didnt understand the arguments anymore... but other times it says err_msg with no explanation. i could really use some help.

I have uninstalled and reinstalled R and R studio and updated all my packages.

biomaRt RNASeqData R • 7.2k views
ADD COMMENT
2
Entering edit mode

Sometimes the main Ensembl BioMart server can break, which leads to this error. It's not a problem with your code, and hopefully the Ensembl team will fix the issue shortly.

However, this is why the mirrors exists. If you're having problems using them, perhaps you can share the code you're trying to use and the output message you receive so we can see what the issue is.

ADD REPLY
0
Entering edit mode

Thanks for such a quick response!!!

Yeah, I am aware of the issues that biomart and ensembl can have. It is frustrating.

I ran the code again this morning, this time it automatically tried to use mirrors (yesterday it did not attempt this), each time failing.

The messages were as follows:

Ensembl site unresponsive, trying uswest mirror
Ensembl site unresponsive, trying asia mirror
Ensembl site unresponsive, trying useast mirror
Error: biomaRt has encountered an unexpected server error.
Consider trying one of the Ensembl mirrors (for more details look at ?useEnsembl)

Trying to use a mirror on my own i adapted the code as follows:

convertMouseGeneList <- function(x){
  require("biomaRt")
  human = useMart("ensembl", dataset = "hsapiens_gene_ensembl",host="useast.ensembl.org")
  mouse = useMart("ensembl", dataset = "mmusculus_gene_ensembl",host="useast.ensembl.org")
  genesV2 = getLDS(attributes = c("mgi_symbol"), filters = "mgi_symbol", values = x , mart = mouse, attributesL = c("hgnc_symbol"), martL = human, uniqueRows=T)
  humanx <- unique(genesV2[, 2])
  # Print the first 6 genes found to the screen
  print(head(humanx))
  return(humanx)
}

The error message i received was:

Error in .createErrorMessage(error_code = status_code(res), host = host) : 
  object 'err_msg' not found

i dont understand what this error is at all unfortunately (I am not great at programming languages in general)

I tried using useEnsembl instead

  require("biomaRt")
  human = useEnsembl(biomart="ensembl", dataset = "hsapiens_gene_ensembl",host="useast.ensembl.org",mirror="useast")
  mouse = useEnsembl(biomart="ensembl", dataset = "mmusculus_gene_ensembl",host="useast.ensembl.org",mirror="useast")
  genesV2 = getLDS(attributes = c("mgi_symbol"), filters = "mgi_symbol", values = x , mart = mouse, attributesL = c("hgnc_symbol"), martL = human, uniqueRows=T)
  humanx <- unique(genesV2[, 2])
  # Print the first 6 genes found to the screen
  print(head(humanx))
  return(humanx)
}

same result

ADD REPLY
3
Entering edit mode

Thanks for sharing the code. At a quick glance I can see that at least one of these issues is a bug in biomaRt. The part with:

Error in .createErrorMessage(error_code = status_code(res), host = host) : 
  object 'err_msg' not found

is a mistake in the package. The .createErrorMessage() function is suppose to give you (or me) some hints as to what's gone wrong. However the server seems to be generating a error code I've never seen before, and rather than handling that nicely biomaRt is crashing. That's not good for anyone and I will try to fix this ASAP.

I'll take a longer long to try and understand what's actually going wrong. However the new Ensembl release happened today, so it may be that the server issues are related to that and will be better soon.

ADD REPLY
1
Entering edit mode

Again, thanks for the quick response!

I have a little more to share in case this helps.

I used biomaRt to do some different conversions today and it worked just fine so i was definitely a bit concerned what the problem with the mouse to human gene ID code might be

the code i ran successfully was this. to convert my lists of human gene IDs to ensembl IDs

convertHumanEnsemblGeneList <- function(x) {
  require("biomaRt")
  human = useMart("ensembl", dataset = "hsapiens_gene_ensembl")
  genes<-x$genes #  THIS IS SPECIFIC TO YOUR DATA SET! CHANGE IT IF YOUR COLUMN NAME IS DIFFERENT
  G_list <- getBM(attributes= c("ensembl_gene_id","hgnc_symbol"), filters= "hgnc_symbol",values=genes,mart= human)
}

df <- data.frame (num  = c(1:7),
                  genes= c("SPIB", "CD86","TNF","LFNG","PIM1","TLR1","BCL6")
)

df.ensembl<-as.data.frame(convertHumanEnsemblGeneList(df))

It worked every time, though it had to check different ensembl mirrors. (and it often spits out several ensemble IDs per gene ID. but for what I wanted, it worked)

The mouse to human conversion still does not work (i tried it again after my success with human to human gene IDs)

I dont know if this helps or not. But it demonstrates that biomaRt is working, and it is successfully communicating with ensembl .

ADD REPLY
1
Entering edit mode

I think there might be something wrong with the linked dataset functionality after the latest Ensembl release (that's getLDS() is accessing). You're not the only person experiencing problems with getLDS() e.g. Problems with biomaRt's getLDS and https://github.com/grimbough/biomaRt/issues/59 . I am also failing to run the queries using the web interface at https://www.ensembl.org/biomart/martview/

I've reported this to Ensembl, hopefully they're be able to diagnose the issue.

ADD REPLY
1
Entering edit mode

Hello, I am also having the same issue and have for a couple of days now...is there any update on when it might be fixed? or does anyone have an alternative way of translating? I need to get from ensembl mouse to human entrez - any ideas greatly received! thanks :)

ADD REPLY
8
Entering edit mode

Hey, I just solve this problem by adding : human <- useMart("ensembl", dataset = "hsapiens_gene_ensembl", host = "https://dec2021.archive.ensembl.org/") mouse <- useMart("ensembl", dataset = "mmusculus_gene_ensembl", host = "https://dec2021.archive.ensembl.org/")

Give this code a shot. It will amaze you.

ADD REPLY
0
Entering edit mode

This worked for me, thanks!

ADD REPLY
0
Entering edit mode

This was working for me briefly, but is now resulting in connection timeout errors. Is anybody else having this issue using the December 2021 archive?

ADD REPLY
0
Entering edit mode

Wow! this worked perfectly! thanks so much!

ADD REPLY
0
Entering edit mode

This worked for me, thanks!

ADD REPLY
0
Entering edit mode

This does not work for me :( It seems the problem is with the getLDS function. Has anyone else found a different solution?

ADD REPLY
0
Entering edit mode

Same here problem with getLDS(). Anyone has any idea that can run in a website or other R package?

ADD REPLY
0
Entering edit mode

Mike Smith I would like to mention that I received the same error

"object 'err_msg' not found"

while using the functions useMart() + getBM() inside a foreach function in the context of this task.

ADD REPLY
2
Entering edit mode
@james-w-macdonald-5106
Last seen 4 hours ago
United States

An alternative is to use the Orthology.eg.db package. It's meant to map NCBI Gene IDs (it's based on orthology mapping from NCBI), but it is simple enough to make a function to use HGNC symbols as well.

fun <- function(gns){
    egs <- mapIds(org.Hs.eg.db, gns, "ENTREZID","SYMBOL")
    mapped <- select(Orthology.eg.db, egs, "Mus.musculus","Homo.sapiens")
    mapped$MUS <- mapIds(org.Mm.eg.db, as.character(mapped$Mus.musculus), "SYMBOL", "ENTREZID")
    mapped
}

> genes <- c("SPIB", "CD86","TNF","LFNG","PIM1","TLR1","BCL6")
> fun(genes)
'select()' returned 1:1 mapping between keys and columns
'select()' returned 1:1 mapping between keys and columns
     Homo.sapiens Mus.musculus  MUS
SPIB         6689       272382 Spib
CD86          942        12524 Cd86
TNF          7124        21926  Tnf
LFNG         3955        16848 Lfng
PIM1         5292        18712 Pim1
TLR1         7096        21897 Tlr1
BCL6          604        12053 Bcl6
ADD COMMENT

Login before adding your answer.

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