This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Can'T Run Properly The Getlds Function In Biomart Package.

Hello, every body I want to do a mapping from uniportIDs to Ensemble gene IDs using biomaRt package in R I have used the followed instruction

library(biomaRt)
ensemble<-useMart("ensembl",dataset="scerevisiae_gene_ensembl")
mart2 <-useMart("ensembl",dataset="protein")
proteins<-c("P53736","P53737","P53738","P53739","P53740","P53741","P53742","P53743","P53744","P53745")
getLDS(attributes="ensembl_gene_id",mart=ensemble,attributesL="protein_accession",filtersL="protein_accession",valuesL=proteins,martL=mart2)

I get the following error:

Error in get(filtersL, env = martFilters(martL)) : invalid 'envir' argument

Do someone have an idea about it? Thank you.

biomart r

1 answer

I have not used the getLDS() function, but I think the problem is that protein_accession is not a valid attribute. You can get all of the attributes into a data frame using the listAttributes() function:

library(biomaRt)
attrs <- listAttributes(ensemble)

It looks like you have UniProt protein IDs, so you can look for attributes named "uniprot" using grep:

attrs[grep("uniprot", attrs$name),]
                      name                 description
44            uniprot_sptrembl    UniProt/TrEMBL Accession
45           uniprot_swissprot        UniProt/SwissProt ID
46 uniprot_swissprot_accession UniProt/SwissProt Accession

Then, I would use getBM() to retrieve the gene IDs:

results <- getBM(attributes = c("ensembl_gene_id", "uniprot_swissprot_accession"),
           filters = "uniprot_swissprot_accession", values = proteins, mart = ensemble)

results
ensembl_gene_id    uniprot_swissprot_accession
1          YNR040W                      P53736
2          YNR042W                      P53737
3          YNR046W                      P53738
4          YNR047W                      P53739
5          YNR048W                      P53740
6          YNR051C                      P53741
7          YNR053C                      P53742
8          YNR054C                      P53743
9          YNR056C                      P53744
10         YNR059W                      P53745

Thank you very much it worked perfectly, in fact in the second mart I am using the attribute "accession" exists.

Log in to answer this question.