# Pydeseq2 Workbench

> Run reproducible Python DESeq2 differential expression from raw RNA-seq counts with multi-factor designs, Wald tests, and FDR plots.

Pydeseq2 Workbench is a paid AI agent skill on Agensi by Sheeyassh. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $5 (one-time purchase)
- Creator: [Sheeyassh](https://www.agensi.io/creators/s1reyash)
- Version: 1.0.0
- Last updated: 2026-12-02
- Security: scan passed (2026-12-02); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/pydeseq2-workbench
- Tags: research-analysis, rna-seq, pydeseq2, bioinformatics, differential-expression

## About this skill

Run reproducible Python DESeq2 differential expression from raw RNA-seq counts with multi-factor designs, Wald tests, and FDR plots. This skill equips AI coding agents to execute rigorous bulk RNA-seq differential expression analysis in pure Python with PyDESeq2. It automates count-matrix validation, low-count filtering, negative binomial dispersion fitting, Wald testing, LFC shrinkage, and volcano/MA visualization.

### What it does
- **Count Matrix & Design Audit** Inspect existing RNA-seq pipelines and count matrices to catch normalized TPM/FPKM inputs, wrong `genes x samples` orientation, unaligned sample IDs, and missing batch covariates.
- **Multi-Factor Model & LFC Refinement** Tune low-count filtering thresholds, multi-factor design formulas (`~ batch + condition`), `lfc_shrink` settings, and publication-grade volcano/MA visualizations.
- **R-to-Python Port & Pipeline Verification** Build end-to-end Python differential expression pipelines or translate R `DESeq2` scripts into `DeseqDataSet`/`DeseqStats` workflows with automated sanity checks.
- **Deterministic Deliverables** Each run produces modular Python `pydeseq2` scripts, full statistical tables (`baseMean`, `log2FoldChange`, `lfcSE`, `stat`, `pvalue`, `padj`), thresholded significant DEG lists, volcano/MA plots, and count/orientation validation logs.

### How it works
1. **Pre-Flight & Scope Audit** verifies workspace boundaries, inputs, and required tools (`filesystem-read`, `filesystem-write`, `python3`, `shell-exec`) before modifying any files.
2. **Core Workflow Execution** runs **Count Matrix & Design Audit**, **Multi-Factor Model & LFC Refinement** using modular, non-destructive steps.
3. **Quality Gate Enforcement** applies skill-specific checks including *Schema Assertion & Memory-Safe DataFrame Pipelines*, *Deterministic Python Environment & Type Hygiene*.
4. **Verification & Reporting** validates every deliverable against the 7-point checklist and emits an evidence-backed summary.

### Frameworks & tools
Supports `anndata`, `csv`, `pandas`, `python`. Uses agent tools: `filesystem-read`, `filesystem-write`, `python3`, `shell-exec`. Prerequisites: Python 3.9+ and pydeseq2, pandas, numpy, and anndata, Raw RNA-seq count matrix. Compatible with Claude Code, Cursor, Windsurf, Antigravity, Codex CLI, and MCP-enabled agents.

### Why this beats prompting it yourself
Bioinformatics teams porting R DESeq2 pipelines to Python often hit silent bugs from untransposed `genes x samples` CSVs, accidentally normalized TPM inputs, or inverted contrast signs. This skill inspects your count files, metadata columns, and `anndata` or `pandas` setup to produce verified statistical tables and plots. Instead of ad-hoc prompting, Pydeseq2 Workbench enforces Schema Assertion & Memory-Safe DataFrame Pipelines, Deterministic Python Environment & Type Hygiene, Reproducibility Manifest & Dimensionality Checks alongside a deterministic 7-point verification checklist.

### Use cases
- Run bulk RNA-seq differential gene expression analysis natively in Python without maintaining an R environment.
- Control for technical batch effects, donor IDs, or covariates using multi-factor `DeseqDataSet` designs.
- Convert legacy R `DESeq2` scripts into reproducible Python workflows integrated with `anndata` (`.h5ad`) and `pandas`.
- Generate LFC-shrunk gene rankings, Benjamini-Hochberg FDR tables, and volcano/MA plots for downstream pathway enrichment.

### Known limitations
Only appropriate for bulk RNA-seq (or pseudo-bulk aggregated) raw integer count matrices; not valid for pre-normalized TPM/FPKM tables or unaggregated single-cell UMI matrices. Complex mixed-effects models, interaction-heavy spline designs, or specialized R-only shrinkage priors beyond PyDESeq2's supported `apeglm`/`normal` options may differ slightly from R `DESeq2`. Requires at least 2–3 biological replicates per condition for reliable dispersion estimation and Wald hypothesis testing.

## Requires

- Python 3.9+ and pydeseq2
- pandas, numpy, and anndata
- Raw RNA-seq count matrix
- Python

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Pydeseq2 Workbench skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How does this differ from asking an AI agent to analyze RNA-seq data with pandas?

Generic data-science prompts frequently pass normalized TPM counts into DESeq2, skip low-count filtering, or miss the `genes x samples` transpose requirement. This workbench enforces raw-count validation, explicit contrast directions, dispersion checks, and publication-ready DEG exports.

### Which Python libraries and workflows are compatible?

It supports Python 3.9+ with `pydeseq2`, `pandas`, `anndata`, `numpy`, and `matplotlib`/`seaborn`, integrating seamlessly with any AI coding agent in Jupyter, CLI scripts, or Snakemake/Nextflow repos.

### What concrete outputs does a PyDESeq2 run produce?

You receive runnable `pydeseq2` analysis scripts (modeled on `scripts/run_deseq2_analysis.py`), complete differential expression CSVs (`baseMean` through `padj`), filtered significant gene lists, and volcano/MA diagnostic plots.

### What prerequisites are required, and can it replace an existing R DESeq2 script?

You need Python 3.9+ with `pydeseq2`, `pandas`, `numpy`, and `anndata`, plus a raw integer RNA-seq count matrix and sample metadata table. It can also translate an existing R `DESeq2` script directly into Python without altering upstream alignment/quantification steps.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
