##read.delim()函數(shù)讀取tsv數(shù)據(jù)
stringsAsFactors=FALSE
exp <- read.csv("ID.csv",header = TRUE, sep = ",")
data=data.frame(exp)
library(stringi)##加載包
data$Ensembl_ID=stri_sub(data$Ensembl_ID,1,23)##保留前15位
# 加載相關(guān)包
library(clusterProfiler)
library(org.Hs.eg.db)
# 查看org.Hs.eg.db 包提供的轉(zhuǎn)換類型
keytypes(org.Hs.eg.db)
# 需要轉(zhuǎn)換的Ensembl_ID
Ensembl_ID <- data$Ensembl_ID
# 采用bitr()函數(shù)進(jìn)行轉(zhuǎn)換
gene_symbol <- bitr(Ensembl_ID, fromType="ENSEMBL", toType=c("SYMBOL", "ENTREZID"), OrgDb="org.Hs.eg.db")
# 查看轉(zhuǎn)換的結(jié)果
head(gene_symbol)
聯(lián)系客服