This is a test version of Biostars. For the public version, visit https://www.biostars.org.
converting mouse emsembl gene IDs to Gene names by bioMart and gconvert with no luck

I have roughly mouse 200 DEGs with Ensembl IDs and would like to convert them to gene symbols/names. I've tried gconvert from gproflier2 as follows;

t<-gconvert(gene, organism = "mmusculus", target = "ENSG", filter_na = T)

and bioMart

ensembl <- useMart("ensembl", dataset="mmusculus_gene_ensembl")
gene <- getBM(attributes=c('ensembl_gene_id','external_gene_name'), filters = 'ensembl_gene_id', values = mouse_gene_ids, mart = ensembl)

with no luck. I checked some of these DEGs (e.g. ENSMUSE00000199608) in Ensembl browser and did see the gene but not in gProfiler web site. Am I missing something here or are there any ways to convert Ensembl gene ID of these DEGs to gene names/symbols in R ?

rna-seq r gene

Tried the script on the post but did not work. I get NA. Ensembl transcript ID's heading is ENSUMST, whereas my geens have ENSMUSE.

Can you post what error you are getting ? also head(mouse_gene_ids) output.

I am not getting any error but zero contents. Output of is as follows;

[1] "ENSMUSE00000199608" "ENSMUSE00000452812" "ENSMUSE00000464581" "ENSMUSE00000815723"
[5] "ENSMUSE00001175099" "ENSMUSE00000603281"

The id you have posted is an exon id, not a gene id.

Ok got it but I can't figure out why I got a transcript ID instead of gene ID ? I used featureCounts with GTFattrType ="gene_id" script;

 featureCounts(x.bam, isPairedEnd = T, isGTFAnnotationFile=T, annot.ext="Mus_musculus.GRCm38.96.gtf", GTF.attrType = "gene_id")

This will be an new question.

2 answers

Using the info @i.sudbery's good eye caught. You should change your filter. To find out which filter to use

library(biomaRt)
    mart <- useMart(biomart = "ENSEMBL_MART_ENSEMBL")
    m_ensembl = useDataset(dataset = "mmusculus_gene_ensembl", mart = mart)
    h_ensembl = useMart("ensembl",dataset="hsapiens_gene_ensembl")

    lF <- listFilters(m_ensembl)
    lF[grep("exon", lF$name),]

This is the filter you should use.

              name                          description
55 ensembl_exon_id Exon ID(s) [e.g. ENSMUSE00000097910]

So now, if you run again but use ensembl_exon_id as filter, you should get the gene names.

Just want to add that you can use the searchFilters() function to find the appropriate filters in one step e.g.

> searchFilters(m_ensembl, "exon")
              name                          description
55 ensembl_exon_id Exon ID(s) [e.g. ENSMUSE00000097910]
 foo <- getBM(attributes=c('ensembl_gene_id','external_gene_name'), filters = 'ensembl_exon_id', values = mouse_gene_ids, mart = ensembl)

ensembl_gene_id external_gene_name

1 ENSMUSG00000011632 Pinlyp

Worked beautifully !! Thanks for all the help !!

This should also get you the gene symbols [edit] provided you had valid keys e.g. ensembl gene ID here.

library(org.Mm.eg.db)
mapIds(org.Mm.eg.db, data, keytype="ENSEMBL", column="SYMBOL", multiVals = "first")

Log in to answer this question.