grimbough / biomaRt

R package providing query functionality to BioMart instances like Ensembl
https://bioconductor.org/packages/biomaRt/
32 stars 13 forks source link

Error getLDS() - Error in attributes(.Data) #66

Open saphir746 opened 2 years ago

saphir746 commented 2 years ago

trying to do the following and it's not working,

please send suggestions

`myList<-c("ATP5F1A" "ATP5F1B" "ATP5F1C" ) require("biomaRt") human <- useMart("ensembl", dataset = "hsapiens_gene_ensembl") mouse <- useMart("ensembl", dataset = "mmusculus_gene_ensembl") genesV2 = getLDS(attributes = c("hgnc_symbol"), filters = "hgnc_symbol", values = myList , mart = human, attributesL = c("mgi_symbol"), martL = mouse, uniqueRows=T)

Error in attributes(.Data) <- c(attributes(.Data), attrib) : 'names' attribute [2] must be the same length as the vector [1] `

grimbough commented 2 years ago

Thanks for reporting this and providing the code. I currently get a slightly different error:

myList<-c("ATP5F1A", "ATP5F1B", "ATP5F1C" )
library("biomaRt")
human <- useEnsembl("ensembl", dataset = "hsapiens_gene_ensembl", mirror = "uswest")
mouse <- useEnsembl("ensembl", dataset = "mmusculus_gene_ensembl", mirror = "uswest")
genesV2 = getLDS(attributes = c("hgnc_symbol"), 
                 filters = "hgnc_symbol", 
                 values = myList , 
                 mart = human, 
                 attributesL = c("mgi_symbol"), 
                 martL = mouse, uniqueRows=T)
#> Error: biomaRt has encountered an unknown server error. HTTP error code: 502
#> Please report this on the Bioconductor support site at https://support.bioconductor.org/
#> Consider trying one of the Ensembl mirrors (for more details look at ?useEnsembl)

I think is a continuation of the problems Ensembl BioMart is having with the linked dataset queries, which people have been reporting ever since the release of Ensembl 106 (#61, #63, #59) and unfortunately doesn't seem to be fixed yet.

One option is to use the version 105 archive e.g.

human <- useEnsembl("ensembl", dataset = "hsapiens_gene_ensembl", version = 105)
mouse <- useEnsembl("ensembl", dataset = "mmusculus_gene_ensembl", version = 105)
genesV2 = getLDS(attributes = c("hgnc_symbol"), 
                 filters = "hgnc_symbol", 
                 values = myList , 
                 mart = human, 
                 attributesL = c("mgi_symbol"), 
                 martL = mouse, uniqueRows=T)
genesV2
#>   HGNC.symbol MGI.symbol
#> 1     ATP5F1A     Atp5a1
#> 2     ATP5F1B      Atp5b
#> 3     ATP5F1C     Atp5c1
Shicheng-Guo commented 1 year ago

Same issue. any solution comes out?

pratarora commented 1 year ago

Same issue. any solution yet?

JohnGenome commented 1 year ago

It seems that useMart() can only use Ensembl 109, while useEnsembl() can use previous versions. I tried many versions and find only Ensembl 105 works well. So this problem can be solved by adding Ensembl version 105 to the useEnsembl() as grimbough suggested.

rbutleriii commented 11 months ago

Still occurring, for fixed version specification. If I use:

  mouse = useEnsembl("ensembl", dataset="mmusculus_gene_ensembl", version="105")
  human = useEnsembl("ensembl", dataset="hsapiens_gene_ensembl", version="105")
  # match with ensembl_gene_id across both
  x = data.table(getLDS(mart=mouse, attributes=c('ensembl_gene_id'), martL=human,
                        attributesL=c('ensembl_gene_id', 'chromosome_name', 
                                      'gene_biotype'), 
                        filters='ensembl_gene_id', values=unique(dt[[colname]]),
                        bmHeader=F))

It will work, but version=110, 109, etc same error. If I specify no version or mirror, I get:

Ensembl site unresponsive, trying asia mirror
Ensembl site unresponsive, trying useast mirror
Ensembl site unresponsive, trying uswest mirror
Error in .chooseEnsemblMirror(mirror = mirror, httr_config = httr_config) :
  Unable to query any Ensembl site