简体   繁体   English

如何将大列表中的Entrez ids转换为基因符号并替换R中列表中的entrez ids?

[英]How to convert Entrez ids in a large list into gene symbols and replace entrez ids in list in R?

I have a large list data with 300 names.我有一个包含 300 个名称的大型列表data For eg:例如:

dput(data$name1)
c("55024", "29126", "3732", "1960", "79368", "115352", "10875", 
"2530", "348654", "3070", "29969", "9124", "10125", "143686", 
"6504", "25992", "26137")

dput(data$name2)
c("323", "836", "9976", "1407", "1840", "2289", "2317", "2739", 
"8337", "10964", "3572", "3693", "4023", "4058", "124540", "4638", 
"5214", "6238", "8115", "7049", "8459", "10791", "55884", "7494", 
"7535")

df <- as.data.frame(data$name1)
colnames(df)[1] <- "ENTREZ_IDs"

library(clusterProfiler)
library(org.Hs.eg.db)
### Convert Entrez to Ensembl ids and Gene names
Ensembl_GeneNames <- bitr(df$ENTREZ_IDs, fromType = "ENTREZID",
                          toType = c("SYMBOL"),
                          OrgDb = org.Hs.eg.db)

This is the output I got:这是我得到的 output:

在此处输入图像描述

Now, I want to replace the ENTREZID of name1 in the large list data with SYMBOL from the above output.现在,我想用上面 output 中的 SYMBOL 替换大列表dataname1的 ENTREZID。

Would like to do this for all names in the large list data想对大列表data中的所有名称执行此操作

We may loop over the list and apply the bitr我们可以遍历list并应用bitr

out <- lapply(data, \(x) bitr(x, fromType = "ENTREZID",
                          toType = c("SYMBOL"),
                          OrgDb = org.Hs.eg.db)[['SYMBOL']])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM