This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Getting ENTREZ GENE IDs for data frame, any help?

Hello everyone, I need to make a gene enrichment analysis with clusterProfiler tool implemented in R. I have a gene list with only gene names in it. So far, I used these codes that I write right down below and I get a data frame with my gene names:

>View(Gaye_30mins)
> mydata=na.omit(Gaye_30mins)
> mydata2=t(mydata)
> mydata3=as.data.frame(mydata2)
> mydata4=gather(mydata3)
> mydata4=mydata3[-1]
> is.data.frame(mydata4)
[1] TRUE
> mydata5=gather(mydata4)
> mydata6=mydata5[-1]
> mydata7=unique(mydata6$value)
> mydata8=as.data.frame(mydata7)

I want to extract Entrez IDs for my genes from org.Hs.eg.db database. For that I used select function and had some problems. The kode I used for extracting ENTREZ GENE IDs was:

>mydata9=select(org.Hs.eg.db, keys = rownames(mydata8), columns = c("ENTREZID", "SYMBOL"), keytype = "ENTREZID")

But after I ran this kode, the values from my data got lost some of them was replaced with NAs and although the number of observations was the same the data frame I got after this kode was completely different from the data frame I started with. How can I extract Entrez IDs with select function from org.Hs.eg.db? Sorry for inconvenience, and thank you very much for the help, Mervenur

r gene assembly

1 answer

Hi, I would better use mapIds

mapIds(org.Hs.eg.db, rownames(mydata8), 'ENTREZID', 'SYMBOL')

Log in to answer this question.