Question: Get gene symbols from gene ids for mouse using BioMart
1
gravatar for nikitavlassenko
21 months ago by
nikitavlassenko40 wrote:

I am trying to get gene symbols for gene ids that I got for mouse datasets. Gene ids look like that: 0610009B22Rik. The code that I am trying to utilize is the following one:

ensembl <- useMart("ensembl", dataset="mmusculus_gene_ensembl")
mouse_gene_ids <- dataset[, 1]
foo <- getBM(attributes=c('ensembl_gene_id',
                      'external_gene_name'),
         filters = 'genedb',
         values = mouse_gene_ids,
         mart = ensembl)

I am getting zero results as an output after the query runs. I guess filters parameter is wrong. Any suggestions would be greatly appreciated.

ADD COMMENTlink modified 21 months ago • written 21 months ago by nikitavlassenko40
7
gravatar for Mike Smith
21 months ago by
Mike Smith1.4k
EMBL Heidelberg / de.NBI
Mike Smith1.4k wrote:

The filter you need is mgi_symbol e.g.

library(biomaRt)

ensembl <- useMart("ensembl", dataset="mmusculus_gene_ensembl")
mouse_gene_ids  <- "0610009B22Rik"

foo <- getBM(attributes=c('ensembl_gene_id',
                          'external_gene_name'),
             filters = 'mgi_symbol',
             values = mouse_gene_ids,
             mart = ensembl)

Here's the result:

> foo
     ensembl_gene_id external_gene_name
1 ENSMUSG00000007777      0610009B22Rik

I find the best way to choose the correct filter is to start with the Ensembl BioMart web interface, use the examples in the Filters -> external references ID list dropdown list to find the format I'm using, and then hit the XML button near the top. This will let you see the filter name required by biomaRt

ADD COMMENTlink written 21 months ago by Mike Smith1.4k
library(biomaRt)
listMarts()
ensembl=useMart("ensembl")
datasets <- listDatasets(ensembl)
head(datasets)
ensembl = useDataset("mmusculus_gene_ensembl", mart = ensembl)
entrzID=c("14455", "80904", "94275")
filters = listFilters(ensembl)
filters[1:50,]
getBM(attributes = c("ensembl_gene_id", "external_gene_name"), filters = "mgi_symbol", values = entrzID, mart = ensembl)

output:

[1] ensembl_gene_id    external_gene_name
<0 rows> (or 0-length row.names)

Why can't I get any gene symbol

ADD REPLYlink modified 3 months ago • written 3 months ago by qicaibiology40
1

Perhaps you want to try the entrezgene_id filter instead?

getBM(attributes = c("ensembl_gene_id", "external_gene_name"), 
       filters = "entrezgene_id", 
       values = entrzID, 
       mart = ensembl)

     ensembl_gene_id external_gene_name
1 ENSMUSG00000040415               Dtx3
2 ENSMUSG00000025151             Maged1
ADD REPLYlink written 3 months ago by Mike Smith1.4k

Yes. I tried it and it works.

Thank you so much for the help!

ADD REPLYlink written 3 months ago by qicaibiology40
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1844 users visited in the last hour