enrichment-analysis
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "enrichment-analysis" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-246d02b076a9acebf4b4a261ea0cfad94a957e543d960c3505e3e7c666fda97c. Verify the upstream source and version against https://skillhub.cn/skills/user_aabd9d68/enrichment-analysis before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
GO/KEGG/Reactome/DO enrichment analysis. Perform GO (BP/CC/MF), KEGG, Reactome pathway enrichment and DO disease ontology enrichment on gene lists; output CSV result tables, journal‑style PDF figures (including GO bubble plots and KEGG/Reactome/DO bar charts), multi‑panel visualizations and KEGG pathway maps. Provides hub gene statistics. Supports two methods: R (clusterProfiler, full functionality, recommended default) and gseapy (Python, supports GO+KEGG only). Trigger this skill when users mention GO enrichment, KEGG enrichment, Reactome, DO, disease ontology, pathway enrichment, gene function enrichment, enrichment analysis, clusterProfiler, GSEApy, hub genes, or comprehensive enrichment plots.
Introduction source: third_party · user_aabd9d68 · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Audience
- python3 $SKILL_DIR/scripts/run_enrichment.py --analyses go,reactome,do
- Inputs and outputs
- Translation pending; see source documentation.
- Software, accounts and paid services
- Translation pending; see source documentation.
- Limits and differences
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: enrichment-analysis
description: GO/KEGG/Reactome/DO富集分析。对基因列表运行GO(BP/CC/MF)、KEGG、Reactome通路富集和DO疾病本体富集分析,产出CSV结果表、期刊风格PDF图(GO气泡图、KEGG/Reactome/DO柱状图)、综合多面板可视化图和KEGG通路图。提供Hub基因统计功能。两种方法:r(R clusterProfiler,全功能,默认推荐)和gseapy(Python,仅GO+KEGG)。当用户提到GO富集、KEGG富集、Reactome、DO、疾病本体、通路富集、基因功能富集、enrichment analysis、clusterProfiler、GSEApy、Hub基因、综合富集图 时应主动使用此技能。GO/KEGG/Reactome/DO 富集分析
本 skill 封装基因功能富集分析:对基因列表运行 GO(BP/CC/MF)、KEGG、Reactome 通路富集和 DO 疾病本体富集分析。提供两种方法:
- r(默认,推荐,全功能):R clusterProfiler 本地富集 + ReactomePA + DOSE + pathview 通路图 + Hub 基因统计 + 综合多面板可视化
- gseapy(备选,纯 Python):通过 Enrichr API 完成 GO+KEGG 富集,matplotlib 出图,无需 R 环境
两种方法产出等价的基础产物:CSV 结果表 + GO 气泡图 PDF + KEGG 柱状图 PDF + KEGG 通路图 PNG。R 路径额外支持 Reactome、DO、Hub 基因和综合可视化。
定位
Use when
- 需要对基因列表做 GO(BP/CC/MF)、KEGG、Reactome 通路富集分析
- 需要 DO(疾病本体)富集分析
- 需要 Hub 基因统计或综合多面板可视化
- 用户提到 GO 富集、KEGG 富集、Reactome、DO、疾病本体、通路富集、基因功能富集、enrichment analysis、clusterProfiler、GSEApy、Hub 基因
Do not use when
- 需要获取中药成分靶点 → 使用 Skill 1(tcmsp-ingredient-screening)
- 需要收集疾病靶点基因 → 使用 Skill 2(disease-target-collection)
- 需要做靶点交集韦恩图 → 使用 Skill 3(target-intersection)
- 需要做 PPI 网络分析 → 使用 Skill 4(string-ppi-network)
- 需要构建多层网络 → 使用 Skill 6(network-construction)
输入输出契约
| 项目 | 内容 |
|---|---|
| 任务输入 | 基因列表文件(每行一个基因符号) |
| 默认衔接输入 | ./np-output/intersection/intersection_genes.txt(Skill 3 产物) |
| 独立输入 | 用户通过 --gene-list 提供任意基因列表 |
| 默认输出目录 | ./np-output/enrichment/(prefix 由输入基因列表文件名推导,仅用于文件命名) |
| 最终产物 | {prefix}_enrichment.csv(组合结果表)+ {prefix}_go_bubble.pdf + {prefix}_kegg_bar.pdf |
| 可选产物 | Reactome/DO 图表 + Hub 基因统计 + 综合多面板图 + KEGG 通路图(R 路径) |
| 下游衔接 | Skill 6(network-construction)可整合富集结果构建网络 |
契约要求
- gseapy 路径仅产出 GO+KEGG(CSV + PDF)。
- R 路径全功能产出 GO+KEGG+Reactome+DO+Hub+Comprehensive。
- 两种路径的基础产物(GO CSV + GO PDF + KEGG CSV + KEGG PDF)等价。
运行模式
默认衔接模式
自动读取 Skill 3 产出的 intersection_genes.txt。
# R clusterProfiler 全功能管线(默认)
python3 $SKILL_DIR/scripts/run_enrichment.py
# gseapy 路径(纯 Python,仅 GO+KEGG)
python3 $SKILL_DIR/scripts/run_enrichment.py --method gseapy
独立运行模式
手动指定基因列表和输出目录。
python3 $SKILL_DIR/scripts/run_enrichment.py --gene-list ./my_genes.txt --output-dir ./my_output
python3 $SKILL_DIR/scripts/run_enrichment.py --gene-list ./my_genes.txt --palette npg --top-n 15
选择性运行特定分析模块
通过 --analyses 参数指定要运行的分析模块(逗号分隔,无空格)。
# 仅运行 GO 富集
python3 $SKILL_DIR/scripts/run_enrichment.py --analyses go
# 运行 GO + KEGG + Reactome(跳过 DO)
python3 $SKILL_DIR/scripts/run_enrichment.py --analyses go,kegg,reactome
# 运行 GO + Reactome + DO(跳过 KEGG,适用于 KEGG API 网络问题)
python3 $SKILL_DIR/scripts/run_enrichment.py --analyses go,reactome,do
# 运行全部分析(默认,等同于不指定 --analyses)
python3 $SKILL_DIR/scripts/run_enrichment.py --analyses all
可用的分析模块:
go— GO 富集(BP/CC/MF)kegg— KEGG 通路富集reactome— Reactome 通路富集do— DO 疾病本体富集hub— Hub 基因统计(需要先有 GO/KEGG/Reactome/DO 结果)comprehensive— 综合多面板可视化(需要先有多个分析结果)all— 全部分析(默认)
⚠️ 常见参数错误
❌ 错误:使用单数形式 --analysis
# 这样会报错!参数名是复数形式
python3 $SKILL_DIR/scripts/run_enrichment.py --analysis go
✅ 正确:使用复数形式 --analyses
# 必须使用 --analyses(复数)
python3 $SKILL_DIR/scripts/run_enrichment.py --analyses go
# 多个模块用逗号分隔,无空格
python3 $SKILL_DIR/scripts/run_enrichment.py --analyses go,reactome,do
❌ 错误:逗号后有空格
# 这样会被 shell 解析为多个参数!
python3 $SKILL_DIR/scripts/run_enrichment.py --analyses go, kegg, reactome
✅ 正确:逗号后无空格
python3 $SKILL_DIR/scripts/run_enrichment.py --analyses go,kegg,reactome
工作流
R 路径(默认): Python → Rscript → enrichment_go.R → GO CSV + GO气泡图
→ enrichment_kegg.R → KEGG CSV + KEGG柱状图 + pathview通路图
→ enrichment_reactome.R → Reactome CSV + Reactome柱状图
→ enrichment_do.R → DO CSV + DO柱状图
→ enrichment_hub.R → Hub基因统计
→ enrichment_comprehensive.R → 综合多面板图
或 Python → Rscript → enrichment.R(编排器)→ 组合CSV + 全部图表
gseapy 路径: Python → GSEApy/Enrichr → GO CSV + KEGG CSV + GO气泡图 + KEGG柱状图 + KEGG通路图
R 路径脚本拆分
| 文件 | 角色 | 可独立运行 |
|---|---|---|
enrichment_utils.R |
共享模块:主题、基因读取、ID 转换、FoldEnrichment、参数解析 | ❌ 仅 source() |
enrichment_go.R |
GO 富集 + 气泡图 | ✅ Rscript enrichment_go.R --gene-list ... |
enrichment_kegg.R |
KEGG 富集 + 柱状图 + 通路图 | ✅ Rscript enrichment_kegg.R --gene-list ... |
enrichment_reactome.R |
Reactome 富集 + 柱状图 | ✅ Rscript enrichment_reactome.R --gene-list ... |
enrichment_do.R |
DO 疾病本体富集 + 柱状图 | ✅ Rscript enrichment_do.R --gene-list ... |
enrichment_hub.R |
Hub 基因统计(后处理) | ✅ Rscript enrichment_hub.R --output-dir ... |
enrichment_comprehensive.R |
综合多面板可视化(后处理) | ✅ Rscript enrichment_comprehensive.R --output-dir ... |
enrichment.R |
编排器,依次调用全部模块 + 组合 CSV | ✅ 向后兼容 |
运行约定
始终从项目根目录运行脚本。 默认输出目录 ./np-output/enrichment/ 解析到项目根目录下。
Skill 可能通过不同方式安装,命令模板统一使用 $SKILL_DIR 表示实际 Skill 路径:
| 安装方式 | Skill 位置 | 脚本前缀 |
|---|---|---|
| 项目内置 | {项目根}/enrichment-analysis/ |
enrichment-analysis/scripts/ |
| 项目级 Skill | {项目根}/.claude/skills/enrichment-analysis/ |
.claude/skills/enrichment-analysis/scripts/ |
| 全局 Skill | ~/.claude/skills/enrichment-analysis/ |
~/.claude/skills/enrichment-analysis/scripts/ |
跨平台命令适配
命令模板中的 python3 和 $SKILL_DIR 需要根据平台调整:
| 平台 | Python 命令 | Skill 目录变量 | 示例 |
|---|---|---|---|
| macOS / Linux | python3 |
$SKILL_DIR (bash/zsh) |
python3 $SKILL_DIR/scripts/run_enrichment.py |
| Windows CMD | python |
%SKILL_DIR% |
python %SKILL_DIR%\scripts\run_enrichment.py |
| Windows PowerShell | python |
$env:SKILL_DIR |
python $env:SKILL_DIR/scripts/run_enrichment.py |
注意: Windows 通常只有
python命令(没有python3)。如果你的 Windows 环境安装了python3别名,也可以用python3。 Windows 上如果已安装 R 但命令行找不到Rscript,脚本会扫描C:\Program Files\R\R-*\bin\Rscript.exe等常见目录;若 R 安装在其他位置,请使用--rscript指定完整路径。
或者直接用绝对/相对路径替换 $SKILL_DIR:
# macOS/Linux 示例
python3 enrichment-analysis/scripts/run_enrichment.py
# Windows CMD 示例
python enrichment-analysis\scripts\run_enrichment.py
# Windows 指定 Rscript.exe 示例
python enrichment-analysis\scripts\run_enrichment.py --rscript "C:\Program Files\R\R-4.4.3\bin\Rscript.exe"
可视化约定
本 Skill 的所有图片输出使用本地医学期刊主题模块 scripts/theme_journal.R,确保统一的期刊级样式。所有图片输出为 PDF 矢量格式。
调色板
通过 --palette 参数切换配色方案:
| 调色板 | 适用场景 |
|---|---|
npg |
Nature 系列期刊柔和色调 |
viridis |
色盲友好,感知均匀 |
lancet |
The Lancet 系列临床医学期刊(默认) |
固定尺寸
| 图表类型 | 尺寸 | 说明 |
|---|---|---|
| GO 气泡图 | 10 × 12 in | 全页宽度 |
| KEGG 柱状图 | 9 × 8 in | 全页宽度 |
| Reactome 柱状图 | 9 × 8 in | 全页宽度 |
| DO 柱状图 | 9 × 8 in | 全页宽度 |
| 综合多面板图 | 14 × 14 in | 全页整合 |
执行前检查
在运行脚本之前,必须先检查输出目录是否已存在且有内容。
这是调用者/Agent 的操作规范,不是脚本内置交互保护;脚本本身可能直接覆盖同名输出文件。
首先确定本次使用的输出目录(用户指定了 --output-dir 就用自定义目录,否则用默认的 ./np-output/enrichment/)。
如果输出目录存在且包含上次执行的结果文件,说明上次执行有残留输出。此时应提示用户:
⚠️ 检测到
{输出目录}/中已有上次执行的结果文件:
- {列出文件}
是否删除这些文件重新开始?
- 删除并重新开始(推荐)
- 保留现有文件
- 若用户选择删除:删除该输出目录中的所有文件
- 若用户选择保留:跳过执行
- 若目录不存在或目录为空:直接开始执行
Python 依赖检查(gseapy 路径)
gseapy 路径需要以下 Python 包:
pip install gseapy matplotlib numpy pandas
缺包时脚本自动提示安装命令,不自动安装。
R 依赖检查(r 路径)
r 路径需要 R 环境和以下包:
R -e 'BiocManager::install(c("clusterProfiler", "org.Hs.eg.db", "enrichplot", "pathview"))'
R -e 'install.packages(c("ggplot2", "dplyr"))'
缺包时 R 脚本自动提示安装命令,不自动安装。
Windows 若已安装 R 但未配置 PATH,可让 Python 包装器使用指定的 Rscript.exe 检查并安装缺失 R 包:
python enrichment-analysis\scripts\run_enrichment.py --rscript "C:\Program Files\R\R-4.4.3\bin\Rscript.exe" --install-missing-r-packages
镜像配置(推荐,加速国内下载)
为避免从国外源下载 R 包速度慢或失败,建议配置国内镜像:
CRAN 镜像(清华大学):
在 R 中运行一次即可持久化到 ~/.Rprofile:
R -e 'local({r <- getOption("repos"); r["CRAN"] <- "https://mirrors.tuna.tsinghua.edu.cn/CRAN/"; options(repos = r)})'
或将下行写入 ~/.Rprofile:
options(repos = c(CRAN = "https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
Bioconductor 镜像(清华大学):
R -e 'BiocManager::install(version = "3.21", site_repository = "https://mirrors.tuna.tsinghua.edu.cn/bioconductor/")'
或写入 ~/.Rprofile:
options(BioC_mirror = "https://mirrors.tuna.tsinghua.edu.cn/bioconductor/")
按需安装或运行脚本时,
install.packages()和BiocManager::install()会自动使用已配置的镜像,无需每次指定。
分步详解
唯一步骤:富集分析 (scripts/run_enrichment.py)
用途: Python 包装器,验证基因列表、推导分析前缀、按方法分发
前置条件:
- 基因列表文件(推荐 Skill 3 产出的
intersection_genes.txt) - gseapy 路径:
pip install gseapy matplotlib numpy pandas - r 路径:R 环境 +
clusterProfiler/org.Hs.eg.db/enrichplot/pathview/ReactomePA/reactome.db/DOSE
命令模板:
| 场景 | 命令 |
|---|---|
| 默认(R 全功能) | python3 $SKILL_DIR/scripts/run_enrichment.py |
| 仅 GO + KEGG | python3 $SKILL_DIR/scripts/run_enrichment.py --analyses go,kegg |
| 仅 Reactome | python3 $SKILL_DIR/scripts/run_enrichment.py --analyses reactome |
| 自定义参数 | python3 $SKILL_DIR/scripts/run_enrichment.py --palette npg --pvalue-cutoff 0.01 --top-n 15 |
| Windows 指定 Rscript | python %SKILL_DIR%\scripts\run_enrichment.py --rscript "C:\Program Files\R\R-4.4.3\bin\Rscript.exe" |
| gseapy 路径 | python3 $SKILL_DIR/scripts/run_enrichment.py --method gseapy |
Python 包装器行为:
- 验证
--gene-list存在且非空 - 推导分析前缀(二级回退:文件名去后缀 → "analysis")
- 构建输出路径
{output_dir}/ - 创建输出目录
- R 路径(默认)依赖预检:解析并校验
Rscript(PATH;Windows 常见安装目录;或--rscript),再检测按--analyses推导出的最小 R 包集合 - R 路径缺包处理:交互终端询问是否安装;非交互环境默认只打印安装命令,显式
--install-missing-r-packages时自动安装 - R 路径镜像重试:默认源失败后重试清华 CRAN / Bioconductor 镜像
- R 路径运行:调用解析后的
Rscript执行enrichment.R --analyses ...→ 编排器按需运行各分析模块 - gseapy 路径(备选):懒导入
enrichment_gseapy.py→ GO+KEGG 富集+绘图+通路图 - 验证输出文件并打印大小
CLI 参数完整列表(run_enrichment.py):
| 标志 | 类型 | 默认值 | 说明 |
|---|---|---|---|
--gene-list |
str | ./np-output/intersection/intersection_genes.txt |
输入基因列表 |
-o/--output-dir |
str | ./np-output/enrichment/ |
输出基础目录 |
--method |
str | r |
r(R clusterProfiler,全功能,默认)或 gseapy(Python,仅 GO+KEGG) |
--rscript |
str | 空 | Rscript 可执行文件路径;Windows 已安装 R 但未加入 PATH 时可指定 Rscript.exe |
--analyses |
str | all |
分析列表,逗号分隔:go,kegg,reactome,do,hub,comprehensive |
--palette |
str | lancet |
npg / viridis / lancet |
--pvalue-cutoff |
float | 0.05 |
P 值阈值 |
--p-adjust-cutoff |
float | 0.05 |
校正后 P 值阈值,适用于 KEGG / Reactome / DO |
--qvalue-cutoff |
float | 0.05 |
qvalue 阈值,适用于 GO |
--install-missing-r-packages |
flag | off | 非交互环境中允许自动安装缺失 R 包 |
--top-n |
int | 30 |
图表 top terms 数 |
输出文件(位于 {output_dir}/):
| 文件 | 说明 |
|---|---|
{prefix}_enrichment.csv |
组合富集结果表(GO+KEGG+Reactome+DO,完整管线模式) |
{prefix}_go_enrichment.csv |
GO 富集结果表(含 FoldEnrichment) |
{prefix}_go_bubble.pdf |
GO 气泡图,8×6in PDF 矢量格式,期刊风格 |
{prefix}_kegg_enrichment.csv |
KEGG 富集结果表(含 FoldEnrichment) |
{prefix}_kegg_bar.pdf |
KEGG 柱状图,8×6in PDF 矢量格式,期刊风格 |
{prefix}_reactome_enrichment.csv |
Reactome 富集结果表(含 FoldEnrichment) |
{prefix}_reactome_bar.pdf |
Reactome 柱状图,8×6in PDF 矢量格式 |
{prefix}_do_enrichment.csv |
DO 富集结果表(含 FoldEnrichment + qvalue) |
{prefix}_do_bar.pdf |
DO 柱状图,8×6in PDF 矢量格式 |
{prefix}_hub_genes_statistics.txt |
Hub 基因统计表(排名、基因名、出现通路数) |
{prefix}_hub_gene_matrix.rds |
Hub 基因二元矩阵(R 内部格式,供综合图使用) |
{prefix}_Enrichment.pdf |
综合多面板可视化图,14×14in PDF(6 列:通路名、-log10(pvalue)、FoldEnrichment、Hub基因散点、GeneRatio、图例) |
pathways/{prefix}_kegg_pathway_{id}.png |
KEGG 通路图(top N 个通路),基因高亮 |
校验要点:
- 确认
{prefix}_enrichment.csv已生成且至少含表头行 - GO 气泡图和 KEGG 柱状图 PDF 可用(即使无显著结果也应生成带标注的空白图)
- 如使用 R 路径且运行了 Hub/Comprehensive,确认对应产物生成
- 检查显著富集 terms 数量,至少 GO BP 通常应有结果
完整运行示例
# 默认 R clusterProfiler 全功能管线
python3 enrichment-analysis/scripts/run_enrichment.py
# 仅 GO + KEGG
python3 enrichment-analysis/scripts/run_enrichment.py --analyses go,kegg
# 仅 Reactome
python3 enrichment-analysis/scripts/run_enrichment.py --analyses reactome
# 仅 GO(富集 + Hub + 综合图)
python3 enrichment-analysis/scripts/run_enrichment.py --analyses go,hub,comprehensive
# 自定义参数
python3 enrichment-analysis/scripts/run_enrichment.py \
--palette npg --pvalue-cutoff 0.01 --p-adjust-cutoff 0.05 --qvalue-cutoff 0.05 --top-n 15
# 非交互自动安装缺失 R 包
python3 enrichment-analysis/scripts/run_enrichment.py --install-missing-r-packages
# Windows 已安装 R 但未加入 PATH 时指定 Rscript.exe
python enrichment-analysis\scripts\run_enrichment.py --rscript "C:\Program Files\R\R-4.4.3\bin\Rscript.exe"
# gseapy 路径(纯 Python,仅 GO+KEGG)
python3 enrichment-analysis/scripts/run_enrichment.py --method gseapy
# 指定输出目录
python3 enrichment-analysis/scripts/run_enrichment.py -o ./results/enrichment/
错误处理与恢复指南
| 状况 | 严重级别 | 诊断信号 | 恢复操作 |
|---|---|---|---|
| 基因列表缺失 | ❌ 错误 | ❌ 基因列表文件不存在 |
先运行 Skill 3(target-intersection) |
| 基因列表为空 | ❌ 错误 | ❌ 基因列表为空 |
检查上游输出,确保交集不为空 |
| gseapy 缺失 | ❌ 错误 | ❌ 缺少 Python 依赖包 |
pip install gseapy matplotlib numpy pandas 或使用默认 R 路径 |
| Enrichr API 不可用 | ❌ 错误 | Enrichr API 调用失败 |
检查网络连接;或使用默认 R 路径(本地计算) |
| GO 无显著结果 | ⚠️ 警告 | GO 无显著富集结果 |
正常现象,CSV 仅含表头,PDF 标注 "No significant GO enrichment" |
| KEGG 无显著结果 | ⚠️ 警告 | KEGG 无显著富集结果 |
正常现象,CSV 仅含表头,PDF 标注 "No significant KEGG enrichment" |
| 通路图下载失败 | ⚠️ 警告 | 下载失败 (hsaXXXXX) |
单个通路失败不中断,检查网络连接 |
| 未找到 Rscript | 💀 致命 | 未找到 Rscript |
Windows 若已安装 R,可用 --rscript "C:\Program Files\R\R-x.x.x\bin\Rscript.exe";未安装则先安装 R;也可切换到 --method gseapy |
| Rscript 无法执行 | 💀 致命 | 找到了 Rscript,但无法执行 |
检查路径是否为 Rscript.exe、R 安装是否完整、权限或安全软件是否拦截 |
| R 包缺失 | 💀 致命 | 检测到缺失的 R 包 |
交互终端输入 Y 安装;非交互环境追加 --install-missing-r-packages |
| R 包安装失败 | 💀 致命 | 默认源和镜像源尝试后仍有缺失包 |
检查网络/镜像/R 版本兼容性;也可手动运行脚本打印的安装命令 |
| clusterProfiler 未安装 | 💀 致命 | clusterProfiler 出现在缺失包列表 |
--install-missing-r-packages 或手动 BiocManager::install("clusterProfiler") |
| org.Hs.eg.db 未安装 | 💀 致命 | org.Hs.eg.db 出现在缺失包列表 |
--install-missing-r-packages 或手动 BiocManager::install("org.Hs.eg.db") |
| pathview 缺失 | ⚠️ 警告 | pathview 出现在缺失包列表 |
--install-missing-r-packages 或从 --analyses 中移除 kegg |
| ReactomePA/reactome.db 未安装 | ⚠️ 警告 | ReactomePA / reactome.db 出现在缺失包列表 |
--install-missing-r-packages 或从 --analyses 中移除 reactome |
| DOSE 未安装 | ⚠️ 警告 | DOSE 出现在缺失包列表 |
--install-missing-r-packages 或从 --analyses 中移除 do |
| Reactome 无显著结果 | ⚠️ 警告 | Reactome: 无显著富集结果 |
正常现象,CSV 仅含表头,PDF 带标注 |
| DO 无显著结果 | ⚠️ 警告 | DO: 无显著富集结果 |
正常现象,CSV 仅含表头,PDF 带标注 |
| Hub 无可用的 CSV | ⚠️ 警告 | 没有找到任何可用的富集结果 CSV |
先运行至少一个富集分析 |
| 综合图无数据 | ⚠️ 警告 | 无可用富集数据 |
至少运行一个富集分析后再生成综合图 |
| 方法不兼容 | ❌ 错误 | ❌ --install-missing-r-packages 仅允许与 --method r 一起使用 / ❌ --rscript 仅允许与 --method r 一起使用 |
切换为 --method r 或去掉不兼容标志 |
| ID 转换失败(R 路径) | ⚠️ 警告 | ❌ ID 转换失败 |
检查基因符号是否标准 HGNC 符号 |
| 映射基因不足(R 路径) | ⚠️ 警告 | 仅 X 个基因成功映射 |
需要至少 3 个基因;检查基因符号 |
执行检查清单
- [ ] 检查残留文件 — 若输出目录存在且有旧文件,提示用户确认
- [ ] 确认输入数据 — 基因列表文件就绪(推荐 Skill 3 产物
intersection_genes.txt) - [ ] 确认环境(R 路径,默认) —
Rscript --version可用;Windows 未配置 PATH 时可用--rscript;Python 包装器会自动检查并提示安装缺失 R 包 - [ ] 确认环境(gseapy 路径,备选) —
pip install gseapy matplotlib numpy pandas - [ ] 运行富集分析 —
python3 $SKILL_DIR/scripts/run_enrichment.py [--method gseapy] - [ ] 验证输出 —
{prefix}_enrichment.csv+{prefix}_go_bubble.pdf+{prefix}_kegg_bar.pdf - [ ] 人工审核 — 检查富集结果中显著 terms 是否与疾病/药物机制相关
资源组织
scripts/— 确定性脚本和 R 包装器:run_enrichment.py(主入口,Python 包装器)enrichment_gseapy.py(gseapy 路径)enrichment.R(R 编排器)enrichment_go.R、enrichment_kegg.R、enrichment_reactome.R、enrichment_do.R(各分析模块,可独立运行)enrichment_hub.R、enrichment_comprehensive.R(后处理)enrichment_utils.R(共享工具模块)
references/— 暂无(参数表、输出字段保留在本 SKILL.md 中)assets/— 暂无(本 Skill 无静态资源)
注意事项
- 两种方法差异:r 路径(默认,clusterProfiler + ReactomePA + DOSE)支持 GO+KEGG+Reactome+DO+Hub 基因+综合可视化,是完整的论文级管道。gseapy(Python Enrichr,备选)仅支持 GO+KEGG,产出基础产物
- R 路径全模块:管线拆分为 8 个 R 脚本(4 富集 + 1 工具 + 1 编排 + 2 后处理)。通过
--analyses选择要运行的分析,各模块故障互不影响 - R 安装策略:先使用 PATH 中的
Rscript;Windows 找不到时仅扫描常见安装目录,不读取R_HOME或注册表;也可用--rscript显式指定。缺包时交互询问,非交互环境默认只打印安装命令,显式--install-missing-r-packages时自动安装;默认源失败后重试清华 CRAN / Bioconductor 镜像 - Reactome 通路:比 KEGG 更细粒度的通路数据库。通过
--analyses reactome,...启用 - DO 疾病本体:直接关联疾病表型的富集分析,默认使用
--pvalue-cutoff+--p-adjust-cutoff。通过--analyses do,...启用 - Hub 基因:统计基因在所有通路中出现的频次,输出 txt 统计表和 rds 矩阵。通过
--analyses hub,...启用 - 综合多面板图:将 6 类结果(GO_BP/CC/MF/KEGG/Reactome/DO)整合为 14x14in PDF,固定 6 色方案。通过
--analyses comprehensive,...启用 - 仅支持人类(hsa):上游 Skill 1-2 均查询人类基因,保持一致性
- 按需加载依赖:默认 R 路径自动调用 Rscript 并检查 R 包依赖;选
--method gseapy时才导入 gseapy/matplotlib。两者互不干扰——默认无需 pip - GO 子本体:固定为 ALL(BP+CC+MF),气泡图分面展示三个本体。网络药理学论文惯例是全展示
- KEGG 通路图:r 路径用 pathview 本地生成 top 5 个通路的基因高亮图;gseapy 路径通过 KEGG REST API 下载。
- 基因符号格式:应为标准 HGNC 官方符号(如 TP53, IL6, TNF),而非别名或旧称。Enrichr 会自动忽略无法识别的符号;clusterProfiler 通过
org.Hs.eg.db映射 - 网络要求:gseapy 路径需要访问 Enrichr API(maayanlab.cloud)和 KEGG 网站;r 路径的
enrichKEGG()需要访问 KEGG 官网 - 幂等性:可重复运行,每次覆盖输出
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供完整的基因功能富集分析管线,支持GO、KEGG、Reactome、DO等多种数据库
- 支持两种实现方式(R clusterProfiler全功能/gseapy轻量级),满足不同环境需求
- 产出科研级可视化图表和结构化数据,可直接用于论文发表
- 提供Hub基因统计和综合多面板可视化等高级功能
Highlights
- 触发词覆盖全面,包含GO富集、KEGG富集、Reactome、DO等核心关键词
- 边界清晰,明确区分了与其他相关skill的使用场景
- 提供了详细的定位说明和使用时机指导
Highlights
- 文档结构完整,包含定位、输入输出契约、运行模式、工作流等必要章节
- 提供了详细的参数说明和常见错误示例
- 包含完整的运行示例和错误处理指南
- frontmatter信息完整,符合规范要求
Areas to improve
-
缺少When to Use/示例章节 Reported severity: Minor
文档中虽然包含了使用场景说明,但没有独立的When to Use章节和具体的端到端示例
Recommendation: 建议增加独立的When to Use章节,并提供完整的端到端使用示例
Highlights
- 提供了详细的依赖检查和安装指南
- 包含完整的错误处理和恢复指南
- 支持多种运行模式和参数配置
- 提供了跨平台兼容性说明
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 245, 309, 417, 446
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- mirrors.tuna.tsinghua.edu.cn
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Translation pending; see source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.