This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to get gene symbol from Entrez id

hi

I got a list of Entrez IDs after converting probe IDs. Now, I want Gene symbols and name from those Entrez IDs.

Can anyone suggest some function in R, which can help this?

r

yes, I read all these posts, but nothing seems to be working.

"nothing seems to be working" is not helpful, please provide the codes you have tried together with errors/warnings.

1 answer

library(biomaRt)

## change your dataset if necessary below
mart <- useDataset("hsapiens_gene_ensembl", useMart("ensembl"))

## return data.frame of all genes with both their entrez ids and gene symbols (some genes have no entrez id)
dataframe.genes <- getBM(attributes=c("entrezgene_id","external_gene_name"), values=my.genes, mart=mart)

I have a long list of genes, so individual ID will take time. And I want Gene names or Gene symbols, not Ensembl IDs.

I fixed it already now you get everything

Thank you, I used given code with small changes: gene<-getBM(attributes = c("entrezgene_id","external_gene_name"), values = rownames(Ra_mod), mart=mart)

and i got results: entrezgene_id external_gene_name

1            NA              MT-TF
2            NA            MT-RNR1
3            NA              MT-TV
4            NA            MT-RNR2
5            NA             MT-TL1
6          4535             MT-ND1

how do I check if its correct?

That is still the unfiltered data.frame.

You would need to include: filters="entrez_gene_id" in your getBM() call for it to only use your ids.

  • thank you for your suggestion.

  • But after adding this filter, the sequence of the IDs changed. I want them in the original sequence (list). Can you suggest how to do it? -And also the number of IDs decreased compared to the original list. What can be the reason for that?

Log in to answer this question.