‹ 首页

alterlab-pydeseq2

@alterlab-ieu · 收录于 1 周前

Run differential gene expression analysis on bulk RNA-seq count matrices with PyDESeq2, the Python port of DESeq2 — size-factor normalization, dispersion estimation, Wald tests, FDR (Benjamini-Hochberg) correction, and volcano/MA plots. Use when identifying differentially expressed genes between conditions from raw bulk RNA-seq counts. Part of the AlterLab Academic Skills suite.

适合你,如果正在分析批量RNA-seq数据,需要找出不同条件下的差异表达基因

/ 下载安装
alterlab-pydeseq2.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add alterlab-ieu/alterlab-academic-skills/alterlab-pydeseq2
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- alterlab-ieu/alterlab-academic-skills/alterlab-pydeseq2
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify alterlab-ieu/alterlab-academic-skills/alterlab-pydeseq2
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
39GitHub stars
~1.3K最小装载
~10.2K含声明引用
~11.1K文本包总量
镜像托管

怎么用

技能原文 SKILL.md作者撰写 · MIT · a0064fd

PyDESeq2

Overview

PyDESeq2 is a Python implementation of DESeq2 for differential expression analysis with bulk RNA-seq data. It supports complete workflows from data loading through result interpretation, including single-factor and multi-factor designs, Wald tests with multiple-testing correction, optional apeGLM shrinkage, and integration with pandas and AnnData.

When to Use This Skill

Use this skill when:

  • Analyzing bulk RNA-seq count data for differential expression
  • Comparing gene expression between experimental conditions (e.g., treated vs control)
  • Performing multi-factor designs accounting for batch effects or covariates
  • Converting R-based DESeq2 workflows to Python
  • Integrating differential expression analysis into Python-based pipelines
  • Users mention "DESeq2", "differential expression", "RNA-seq analysis", or "PyDESeq2"
Installation and Requirements
uv pip install "pydeseq2>=0.5,<0.6"

System requirements (pydeseq2 0.5.x): Python ≥3.11; numpy ≥2.0, pandas ≥2.2, scipy ≥1.12, scikit-learn ≥1.4, anndata ≥0.11, formulaic ≥1.0.2 (parses the ~ design formula), matplotlib ≥3.9. These are pulled in automatically as dependencies.

API note (0.4+): parallelism is configured through an inference object, not a bare n_cpus= kwarg:

from pydeseq2.default_inference import DefaultInference
inference = DefaultInference(n_cpus=8)
dds = DeseqDataSet(counts=counts_df, metadata=metadata, design="~condition", inference=inference)
ds = DeseqStats(dds, contrast=["condition", "treated", "control"], inference=inference)
Core Workflow
  1. Prepare data — load counts as samples × genes (transpose with .T if loaded genes × samples); filter low-count genes (e.g., total reads < 10); drop samples with missing metadata.
  2. Specify the design — Wilkinson formula ("~condition", "~batch + condition"); put adjustment variables before the variable of interest.
  3. FitDeseqDataSet(...).deseq2() runs the full pipeline (size factors → dispersions → LFCs → Cook's outliers).
  4. TestDeseqStats(dds, contrast=[var, test, ref]).summary(); read results_df.
  5. (Optional) shrinkds.lfc_shrink() for visualization/ranking only; p-values stay unshrunken.
  6. Interpret/export — filter on padj < 0.05, plot volcano/MA, save CSV/pickle.

Minimal skeleton:

from pydeseq2.dds import DeseqDataSet
from pydeseq2.ds import DeseqStats

dds = DeseqDataSet(counts=counts_df, metadata=metadata, design="~condition")
dds.deseq2()
ds = DeseqStats(dds, contrast=["condition", "treated", "control"])
ds.summary()
significant = ds.results_df[ds.results_df.padj < 0.05]
Command-Line Script

This skill includes a complete standalone script for standard analyses:

python scripts/run_deseq2_analysis.py \
  --counts counts.csv \
  --metadata metadata.csv \
  --design "~batch + condition" \
  --contrast condition treated control \
  --output results/ \
  --min-counts 10 --alpha 0.05 --n-cpus 4 --plots

It handles data loading/validation, gene+sample filtering, the full DESeq2 pipeline, statistical testing with customizable parameters, result export (CSV, pickle), and optional volcano/MA plots. Refer users to scripts/run_deseq2_analysis.py for batch-processing multiple datasets.

Routing Guidance
  • Running a standard analysis (load → fit → test → export), or any specific design (two-group, multi-comparison, batch, covariate)references/pipeline_steps.md.
  • Interpreting results, ranking genes, plotting volcano/MA, or quality metricsreferences/interpretation_and_plots.md.
  • Hitting an error (index mismatch, all-zero counts, "not full rank", no significant genes) → Troubleshooting in references/interpretation_and_plots.md.
  • Need exact class/method parameters or object attributesreferences/api_reference.md.
  • Complex experimental designs or in-depth workflowreferences/workflow_guide.md.
Key Reminders
  1. Data orientation matters: counts usually load genes × samples but need samples × genes — transpose with .T if needed.
  2. Sample filtering: remove samples with missing metadata before analysis.
  3. Gene filtering: drop low-count genes (e.g., < 10 total reads) to improve power.
  4. Design formula order: adjustment variables before the variable of interest ("~batch + condition").
  5. LFC shrinkage timing: shrink after testing, for visualization/ranking only — p-values stay unshrunken.
  6. Significance: use padj < 0.05 (Benjamini-Hochberg FDR), not raw p-values.
  7. Contrast format: [variable, test_level, reference_level].
  8. Save intermediates: pickle the DeseqDataSet to avoid re-running the expensive fit.
Reference Index
  • references/pipeline_steps.md — Quick-start, the six pipeline steps with full code (data prep, design, fitting, testing, shrinkage, export), and four common experimental designs.
  • references/interpretation_and_plots.md — Filtering/ranking significant genes, quality metrics, volcano and MA plots, and a troubleshooting guide.
  • references/api_reference.md — Complete PyDESeq2 class/method/parameter and data-structure documentation.
  • references/workflow_guide.md — In-depth complete workflows, data-loading patterns, multi-factor designs, and best practices.
Additional Resources
  • Official Documentation: https://pydeseq2.readthedocs.io
  • GitHub Repository: https://github.com/owkin/PyDESeq2
  • Publication: Muzellec et al. (2023) Bioinformatics, DOI: 10.1093/bioinformatics/btad547
  • Original DESeq2 (R): Love et al. (2014) Genome Biology, DOI: 10.1186/s13059-014-0550-8
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。