1.Ensembl_to_Entrez:
library(AnnotationDbi)
library(org.Hs.eg.db)
library(clusterProfiler)
library(dplyr)
diff <- read.csv("C:/Users/Lamarck/Desktop/UP_genes_ENSEMBL.csv")
converted_genes <- bitr(
geneID = diff$gene,
fromType = "ENSEMBL",
toType = "ENTREZID",
OrgDb = org.Hs.eg.db
)
final_data <- left_join(diff, converted_genes, by = c("gene" = "ENSEMBL"))
write.csv(final_data, "C:/Users/Lamarck/Desktop/UP_genes_ENSEMBL_ENTREZID.csv", row.names = FALSE)
2.Ensembl_to_Symbol:
library(AnnotationDbi)
library(org.Hs.eg.db)
library(clusterProfiler)
library(dplyr)
diff <- read.csv("C:/Users/Lamarck/Desktop/UP_genes_Ensembl.csv")
converted_genes <- bitr(
geneID = diff$gene,
fromType = "ENSEMBL",
toType = "SYMBOL",
OrgDb = org.Hs.eg.db
)
final_data <- left_join(diff, converted_genes, by = c("gene" = "ENSEMBL"))
write.csv(final_data, "C:/Users/Lamarck/Desktop/UP_genes_Symbol.csv", row.names = FALSE)
本站原创,如若转载,请注明出处:https://www.ouq.net/3762.html