R_Code: KEGG analysis

library(clusterProfiler)
library(org.Hs.eg.db)

# 读取输入数据文件
file_path <- "C:/Users/Lamarck/Desktop/UP_genes_ENSEMBL_ENTREZID.csv"
data <- read.csv(file_path, header = TRUE)

# 提取基因列表(ENTREZID)
gene <- data$ENTREZID

# KEGG 富集分析
kegg_result <- enrichKEGG(
gene = gene,
organism = "hsa",
pvalueCutoff = 1,
qvalueCutoff = 1
)

# 结果转为数据框
kegg_frame <- as.data.frame(kegg_result)
rownames(kegg_frame) <- 1:nrow(kegg_frame)

# 添加排序变量(用于后续可视化)
kegg_frame$order <- factor(rev(seq_len(nrow(kegg_frame))), labels = rev(kegg_frame$Description))

# 保存结果
output_path <- "C:/Users/Lamarck/Desktop/kegg_frame.csv"
write.csv(kegg_frame, file = output_path, row.names = FALSE)

本站原创,如若转载,请注明出处:https://www.ouq.net/3772.html

(0)
打赏 微信打赏,为服务器增加50M流量 微信打赏,为服务器增加50M流量 支付宝打赏,为服务器增加50M流量 支付宝打赏,为服务器增加50M流量
上一篇 5天前
下一篇 3天前

相关推荐

  • Rstudio/Rstudio Server enable Copilot-Rstudio Server打开Copilot

    Rstudio Server 默认是关闭Copilot Copilot is turned off by default. Copilot is turned off with copilot-enabled=0 in /etc/rstud…

    R 3天前
    35
  • R_Code:GO and Functional GO

    GO analysis: library(AnnotationDbi) library(org.Hs.eg.db) #基因注释包 library(clusterProfiler) #富集包 # 读取CSV文件 file_path <-…

    R 5天前
    58
  • R_Code:WGCNA and WGCNA_Get_Gene_Length

    library(WGCNA) library(DESeq2) # enableWGCNAThreads(nThreads = 10) # 在处理数据框(data.frame)时,不会自动给将String类型转换成factor类型 optio…

    R 5天前
    56
  • R_Code:RNAseq_GSEA_analysis

    library(clusterProfiler) # GSEA 和富集分析主力包 library(org.Hs.eg.db) # 人类注释数据库(ENTREZID 与 SYMBOL 等 ID 转换) library(enrichplot) …

    R 5天前
    60
  • R_Code:RNAseq_Gene_Type_Convert_ENSEMBL_to_ENTREZ

    1.Ensembl_to_Entrez: library(AnnotationDbi) library(org.Hs.eg.db) library(clusterProfiler) library(dplyr) diff <- rea…

    R 5天前
    53