SYMBOL命名转换为ENSEMBL命名
##
library(stringr)#基因ID转换
BiocManager::install("org.Hs.eg.db")
library("org.Hs.eg.db")#人类注释
library(clusterProfiler)
DS <- read.table("KeyGenes/Counts_SYMBOL.txt", header=TRUE)
rows <- rownames(unique(DS['Geneid']))
DS <- DS[rows,]
##注释文件
GO_database <- 'org.Hs.eg.db'
#gene ID转换
gene <- bitr(DS$Geneid, fromType = 'SYMBOL',toType = 'ENSEMBL',OrgDb = GO_database)
#合并
colnames(gene)[1]<-'Geneid'
head(gene)
mycounts <- merge(gene, DS, by="Geneid", all=F)
mycounts<-mycounts[,-1]
write.table(mycounts, "counts_ENSEMBL.txt",row.names=FALSE,quote=FALSE)
可以得到gene文件
image.png
网友评论