This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Having trouble converting gene names to Ensemble ID using biomaRt

Hello everyone,

I am having trouble converting gene names into Ensemble IDs using biomaRt and would appreciate any help.

I have a list of 2000 genes names that I need Ensemble IDs for. When I run the following commands it gives me an empty data frame.

require('biomaRt')

mart <- useMart('ENSEMBL_MART_ENSEMBL')
mart <- useDataset('hsapiens_gene_ensembl', mart)

ght = Markers$gene
# Gene names as vector of 'character'

head(ght)
[1] "EVI2A"    "CDC42EP3" "ITGB2"    "ARHGEF19" "PTH1R"    "EPB41L2"

annotLookup <- getBM(mart = mart,
                     values = 'ght',
                     filters = 'external_gene_name',
                     attributes = c('ensembl_gene_id_version',
                                    'ensembl_gene_id',
                                    'external_gene_name',
                                    'wikigene_name'),
                     uniqueRows = TRUE)

Can someone let me know where I am going wrong ? Thank You

biomart r rstudio

1 answer

There could be other things wrong too, but the first thing that I notice is that you quoted qht in the getBM() call. You have a variable ght - if you write it with quotes it becomes a string and no longer represents the vector.

That solved it. Thank You. I feel embarrassed but it is what it is ! Appreciate the help

My colleague uses a "coding bear" for this. A coding bear is basically a teddy bear (other toys work too) that sits on your desk. When your code doesn't work, you sit and talk your coding bear through your code, explaining everything it does. You normally spot these kinds of errors when explaining it to a coding bear. I do strongly recommend keeping a coding bear for a home-working environment though, unless you can get your colleagues on board and get an office-wide coding bear.

Log in to answer this question.