001、
genes <- read.table("genes.txt") ## 读取基因symbol head(genes) tail(genes) genes <- genes[genes != "NA_NA" & genes != "unknow",, drop = FALSE] ## 去除无效信息(可选) genes_list <- unique(genes$V1) ## 去重 genes_list library(org.Hs.eg.db) keytypes(org.Hs.eg.db) library(clusterProfiler) #ID转换,把gene_symbol转换成ENTREZID。 SYMBOL2ENTREZID <- bitr(genes_list, fromType = "SYMBOL",toType = "ENTREZID",OrgDb = "org.Hs.eg.db",drop = T) ## 由symbol转换为ENTRZID class(SYMBOL2ENTREZID) dim(SYMBOL2ENTREZID) enrich_result <- enrichGO(gene = SYMBOL2ENTREZID$ENTREZID, ## 富集分析 org.Hs.eg.db, keyType = "ENTREZID", ont = "ALL", pAdjustMethod = "BH", minGSSize = 10, maxGSSize = 500, pvalueCutoff = 1, qvalueCutoff = 1, readable = TRUE) enrich_result write.csv(enrich_result,"enrich_result.csv",row.names = T) ## 保存富集分析结果
。
标签:富集,转换,symbol,clusterprofile,ENTREZID,gene From: https://www.cnblogs.com/liujiaxin2018/p/18446467