Having trouble converting gene names to Ensemble ID using biomaRt
1
1
Entering edit mode
3.0 years ago
Abdullah ▴ 10

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.5k views
ADD COMMENT
3
Entering edit mode
3.0 years ago

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.

ADD COMMENT
0
Entering edit mode

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

ADD REPLY
1
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

Also known as rubber duck debugging :-)

ADD REPLY

Login before adding your answer.

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