SuperAPI AI 工具集

tooluniverse-gene-enrichment

数据与分析

查看项目

更新于 10-15 14:51

技能介绍

用途

该技能用于执行基因集富集分析,包括 Gene Ontology(GO 的生物过程 BP、分子功能 MF、细胞组分 CC)、KEGG、Reactome、WikiPathways 和 MSigDB 富集,同时支持过表征分析(Over-Representation Analysis,ORA)和基因集富集分析(Gene Set Enrichment Analysis,GSEA)。它整合 gseapy 的本地计算与 ToolUniverse 通路数据库,用于交叉验证并生成可发表的结果。

主要能力

  • 支持 ORA(gseapy.enrichr)与 GSEA(gseapy.prerank)两种分析路径。
  • 覆盖 GO BP/MF/CC、KEGG、Reactome、WikiPathways、MSigDB 等数据库。
  • 支持人类、小鼠、大鼠、果蝇、线虫、酵母、斑马鱼等模式生物。
  • 提供三个确定性 CLI 脚本,处理并列排名、simplify 改变 p.adjust、多条件筛选等边界情况:
    1. scripts/gseapy_enrichment_runner.py:gseapy enrichr / prerank。
    2. scripts/enrichgo_runner.py:clusterProfiler::enrichGO + simplify。
    3. scripts/condition_enrichment_screen.py:按条件(condition/screen/timepoint/group)进行富集筛选。
  • 支持自定义背景基因集、基因 ID 类型自动检测(symbol、ensembl、entrez、uniprot)、多重检验校正(BH、bonferroni、fdr)。
  • 可结合 PANTHER_enrichment、STRING_functional_enrichment、ReactomeAnalysis_pathway_enrichment、gProfiler_enrichment 等工具进行交叉验证。

使用方式

技能强调“先计算,不描述”:当分析需要计算时,通过 Bash 编写并运行 Python 代码,使用 ToolUniverse 工具获取数据,再用 pandas、scipy、statsmodels、matplotlib 等分析。

规则零:先检查预计算结果。在数据文件夹中扫描 *_executed.ipynb、预计算富集文件(CSV/TSV 命名含 enrich、go、kegg、reactome、ego、simplified.csv)、规范分析脚本(analysis.R、run.py、find_.R、*.Rmd)。若存在,直接读取或执行并引用其输出作为权威答案;仅当以上都不存在时,才按技能中的再分析配方执行。

主要脚本使用示例:

python skills/tooluniverse-gene-enrichment/scripts/gseapy_enrichment_runner.py \
    --gene-list /tmp/sig_symbols.txt \
    --library GO_Biological_Process_2021,Reactome_2022 \
    --organism Human \
    --top 5 \
    --candidate "negative regulation of epithelial cell proliferation" \
    --workdir /tmp/gseapy_run
python skills/tooluniverse-gene-enrichment/scripts/enrichgo_runner.py \
    --gene-list /tmp/sig_ensembl.txt \
    --background /tmp/bg_ensembl.txt \
    --keytype ENSEMBL \
    --ontology BP \
    --simplify-cutoff 0.7 \
    --candidate "regulation of T cell activation" \
    --candidate "potassium ion transmembrane transport" \
    --workdir /tmp/enrichgo_run
python skills/tooluniverse-gene-enrichment/scripts/condition_enrichment_screen.py \
    --condition-genes acute=/tmp/acute_sig.txt \
    --condition-genes round1=/tmp/r1_sig.txt \
    --condition-genes round2=/tmp/r2_sig.txt \
    --condition-genes round3=/tmp/r3_sig.txt \
    --library /path/to/local_pathways.gmt \
    --background /tmp/expressed.txt \
    --keyword immune --keyword cytokine --keyword interferon \
    --workdir /tmp/cond_screen

输入参数包括:gene_list(必需)、organism、analysis_type(ORA 或 GSEA)、enrichment_databases、gene_id_type、p_value_cutoff、correction_method、background_genes、ranked_gene_list(GSEA 用)。

适用场景

  • 用户询问基因富集分析(GO、KEGG、Reactome 等)。
  • 拥有来自差异表达、聚类或任何实验的基因列表。
  • 想知道哪些生物过程、分子功能或细胞组分被富集。
  • 需要 KEGG 或 Reactome 通路富集分析。
  • 询问带排序基因列表的 GSEA。
  • 需要 Fisher 精确检验的 ORA。
  • 需要多重检验校正(Benjamini-Hochberg、Bonferroni)。
  • 询问 enrichGO、gseapy、clusterProfiler 风格分析。

不适用场景(应使用其他技能):网络药理学/药物重定位、疾病表征、单基因功能查询、空间组学分析、仅蛋白质-蛋白质相互作用分析。

限制与注意事项

  • 富集结果高度依赖上游 DEG 过滤条件、库快照版本和顶部并列排名处理。脚本会显式暴露这三种失败模式。
  • 当 # TIES_AT_TOP: n=N 较大(>5)时,可能意味着基因列表过小或错误,需检查过滤条件、基因 ID 空间、dropna 是否丢弃过多基因。
  • DEG 过滤默认仅使用问题中明确指定的阈值,不要静默添加 |LFC|、baseMean 或 LFC 收缩等额外过滤。
  • 背景选择很重要:默认全基因组背景会高估组织特异性基因列表的富集,应使用合适的背景(如脑 RNA-seq 用脑表达基因)。
  • 始终检索 enrichment 结果的 inputGenes 字段,不要假设哪些基因导致某条目显著。
  • 工具调用始终使用英文术语(基因名、通路名、生物名),即使用户使用其他语言;仅当英文无结果时才尝试原语言术语。
  • 需要 R 包 clusterProfiler、org.Hs.eg.db(或小鼠 org.Mm.eg.db),缺失时可通过 Rscript skills/evals/install_r_packages.R 安装。
  • 输出应写入 /tmp/...,不要写入数据文件夹。
  • 关于收费、价格、平台等具体信息暂未提供。