tooluniverse-rnaseq-deseq2 by mims-harvard/tooluniverse
npx skills add https://github.com/mims-harvard/tooluniverse --skill tooluniverse-rnaseq-deseq2使用 PyDESeq2 对 RNA-seq 计数数据进行差异表达分析,并通过 ToolUniverse 进行富集分析 (gseapy) 和基因注释。
BixBench 覆盖率 : 已在 15 个计算生物学项目的 53 个 BixBench 问题上验证。
import pandas as pd, numpy as np
from pydeseq2.dds import DeseqDataSet
from pydeseq2.ds import DeseqStats
import gseapy as gp # enrichment (optional)
from tooluniverse import ToolUniverse # annotation (optional)
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
提取:数据文件、阈值 (padj/log2FC/baseMean)、设计因素、对比、方向、富集类型、特定基因。参见 question_parsing.md。
加载计数数据和元数据,确保样本为行/基因为列,验证整数计数,对齐样本名称,移除零计数基因。参见 data_loading.md。
列出所有元数据列和水平。将其分类为生物学关注因素与批次/区组因素。构建设计公式时,协变量在前,关注因素在后。参见 design_formula_guide.md。
通过 pd.Categorical 设置参考水平,创建 DeseqDataSet,调用 dds.deseq2(),使用对比提取 DeseqStats,运行 Wald 检验,可选择应用 LFC 收缩。参见 pydeseq2_workflow.md。
工具边界 :
应用 padj、log2FC、baseMean 阈值。如果需要,按方向拆分。参见 result_filtering.md。
关键列:genewise_dispersions, fitted_dispersions, MAP_dispersions, dispersions。参见 dispersion_analysis.md。
使用 gseapy 的 enrich() 函数和适当的基因集库。参见 enrichment_analysis.md。
仅使用 ToolUniverse 进行 ID 转换和基因背景信息获取。参见 output_formatting.md。
| 模式 | 类型 | 关键操作 |
|---|---|---|
| 1 | 差异表达基因数量 | len(results[(padj<0.05) & (abs(lfc)>0.5)]) |
| 2 | 基因值 | results.loc['GENE', 'log2FoldChange'] |
| 3 | 方向 | 过滤 log2FoldChange > 0 或 < 0 |
| 4 | 集合操作 | degs_A - degs_B 用于查找独特的差异表达基因 |
| 5 | 离散度 | (dds.var['genewise_dispersions'] < thr).sum() |
查看 bixbench_examples.md 获取包含示例的全部 10 种模式。
| 错误 | 修复方法 |
|---|---|
| 无匹配样本 | 转置计数矩阵;去除空白字符 |
| 离散度趋势不收敛 | 使用 fit_type='mean' |
| 未找到对比 | 检查 metadata['factor'].unique() |
| 非整数计数 | 四舍五入为整数 或 使用 t 检验 |
| padj 中出现 NaN | 独立过滤移除了基因 |
查看 troubleshooting.md 获取完整的调试指南。
每周安装量
125
代码库
GitHub 星标数
1.2K
首次出现
2026年2月19日
安全审计
安装于
codex122
gemini-cli121
opencode121
github-copilot120
cursor118
kimi-cli117
Differential expression analysis of RNA-seq count data using PyDESeq2, with enrichment analysis (gseapy) and gene annotation via ToolUniverse.
BixBench Coverage : Validated on 53 BixBench questions across 15 computational biology projects.
import pandas as pd, numpy as np
from pydeseq2.dds import DeseqDataSet
from pydeseq2.ds import DeseqStats
import gseapy as gp # enrichment (optional)
from tooluniverse import ToolUniverse # annotation (optional)
Extract: data files, thresholds (padj/log2FC/baseMean), design factors, contrast, direction, enrichment type, specific genes. See question_parsing.md.
Load counts + metadata, ensure samples-as-rows/genes-as-columns, verify integer counts, align sample names, remove zero-count genes. See data_loading.md.
List ALL metadata columns and levels. Categorize as biological interest vs batch/block. Build design formula with covariates first, factor of interest last. See design_formula_guide.md.
Set reference level via pd.Categorical, create DeseqDataSet, call dds.deseq2(), extract DeseqStats with contrast, run Wald test, optionally apply LFC shrinkage. See pydeseq2_workflow.md.
Tool boundaries :
Apply padj, log2FC, baseMean thresholds. Split by direction if needed. See result_filtering.md.
Key columns: genewise_dispersions, fitted_dispersions, MAP_dispersions, dispersions. See dispersion_analysis.md.
Use gseapy enrich() with appropriate gene set library. See enrichment_analysis.md.
Use ToolUniverse for ID conversion and gene context only. See output_formatting.md.
| Pattern | Type | Key Operation |
|---|---|---|
| 1 | DEG count | len(results[(padj<0.05) & (abs(lfc)>0.5)]) |
| 2 | Gene value | results.loc['GENE', 'log2FoldChange'] |
| 3 | Direction | Filter log2FoldChange > 0 or < 0 |
| 4 | Set ops | degs_A - degs_B for unique DEGs |
| 5 | Dispersion |
See bixbench_examples.md for all 10 patterns with examples.
| Error | Fix |
|---|---|
| No matching samples | Transpose counts; strip whitespace |
| Dispersion trend no converge | fit_type='mean' |
| Contrast not found | Check metadata['factor'].unique() |
| Non-integer counts | Round to int OR use t-test |
| NaN in padj | Independent filtering removed genes |
See troubleshooting.md for full debugging guide.
Weekly Installs
125
Repository
GitHub Stars
1.2K
First Seen
Feb 19, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykPass
Installed on
codex122
gemini-cli121
opencode121
github-copilot120
cursor118
kimi-cli117
智能OCR文字识别工具 - 支持100+语言,高精度提取图片/PDF/手写文本
1,000 周安装
(dds.var['genewise_dispersions'] < thr).sum() |