Closed yuewangpanda closed 3 years ago
I'm afraid I can't reproduce this issue with the latest version of biomaRt:
You original code works fine for me.
library(biomaRt)
packageVersion('biomaRt')
#> [1] ‘2.45.9’
human <- useMart("ensembl", dataset = "hsapiens_gene_ensembl")
rat <- useMart("ensembl", dataset = "rnorvegicus_gene_ensembl")
map_1 <- biomaRt::getLDS(attributes = c("ensembl_gene_id", "rgd_symbol"),
mart = rat,
attributesL = c("ensembl_gene_id", "hgnc_symbol"),
martL = human,
uniqueRows = TRUE)
head(map_1)
#> Gene.stable.ID RGD.symbol Gene.stable.ID.1 HGNC.symbol
#> 1 ENSRNOG00000018338 Vwa1 ENSG00000179403 VWA1
#> 2 ENSRNOG00000023627 Cfap74 ENSG00000142609 CFAP74
#> 3 ENSRNOG00000036869 Tmem88b ENSG00000205116 TMEM88B
#> 4 ENSRNOG00000031766 Mt-cyb ENSG00000198727 MT-CYB
#> 5 ENSRNOG00000021802 Isg15 ENSG00000187608 ISG15
#> 6 ENSRNOG00000035650 Mir3548 ENSG00000207607 MIR200A
The version using useEnsembl()
also seems to work.
human <- useEnsembl("ensembl", dataset = "hsapiens_gene_ensembl")
rat <- useEnsembl("ensembl", dataset = "rnorvegicus_gene_ensembl")
map_2 <- getLDS(attributes = c("ensembl_gene_id", "rgd_symbol"),
mart = rat,
attributesL = c("ensembl_gene_id", "hgnc_symbol"),
martL = human,
uniqueRows = TRUE)
We can't use identical()
to compare the results directly, as BioMart doesn't return things in a predictable order, but the returned objects are the same dimensions and all gene IDs from one are present in the other.
dim(map_1)
#> [1] 25677 4
dim(map_2)
#> [1] 25677 4
all(map_1$Gene.stable.ID %in% map_2$Gene.stable.ID)
#> [1] TRUE
Did you get messages like "Ensembl site unresponsive, trying uswest mirror" when creating the marts? It's possible that the automatic selection of a mirror would have picked two different mirrors for your human and rat marts, which would lead to the "both datasets must be located on the same host" error. If that's the case, I would try creating one of the mart opjects again, and paying attention to which mirror it finally ends up on. You can check by looking in the host
slot for your two mart objects, where the URL will need to be the same.
human@host
#> [1] "https://www.ensembl.org:443/biomart/martservice"
rat@host
#> [1] "https://www.ensembl.org:443/biomart/martservice"
The version using host = "www.ensembl.org"
will fail, as Ensembl seem to have switched to requiring https
to access their server. Currently you have to explicitly set this if you provide the host
argument to useMart()
. If you aren't using that you query gets redirected and returns the Ensembl homepage, which biomaRt doesn't understand and throws the error you're seeing.
Thank you for your response. Very helpful. I tried my code today and it worked. So I guess it was a connection issue.
Hi there,
So I am trying to build a mapping table between rat and human. My origin code is:
This chunk suddenly can not work today. Found a similar issue here. Following the suggestion in the issue here, I first updated the biomaRt package to 2.45.9 and then revised my code to:
This time, the error is "both datasets must be located on the same host". Then, I tried to change my code to
The scan error came out again. "Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : line 1 did not have 3 elements".
My working environment:
Not sure how to fix this problem. Any help will be appreciated.
Thanks, Frank