bio-differential-expression-deseq2-basics
Performs differential expression on bulk RNA-seq count data with DESeq2's negative-binomial GLM, Wald and LRT testing, apeglm/ashr/normal LFC shrinkage…
от lilinji★ 18 звёзд на GitHub
Установить bio-differential-expression-deseq2-basics в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Version Compatibility
Reference examples tested with: DESeq2 1.42+, apeglm 1.28+, ashr 2.2+, IHW 1.34+, tximport 1.30+, edgeR 4.0+ (for cross-comparison), PyDESeq2 0.5+
Before using code patterns, verify installed versions match. If versions differ:
- R:
packageVersion('<pkg>')then?function_nameto verify parameters - Python:
pip show <package>thenhelp(module.function)to check signatures
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
DESeq2 Basics
"Find differentially expressed genes between conditions" -> Fit a negative-binomial GLM per gene with shared dispersion shrinkage, test the coefficient of interest (Wald) or the joint effect of a factor (LRT), and report a shrunken effect-size estimate for ranking.
The Single Most Important Modern Insight -- Shrunken LFC and the Wald p-value come from different models
lfcShrink() returns LFCs from a Bayesian posterior with apeglm/ashr/normal priors, BUT the p-value column it carries forward is still the unshrunken Wald p-value from results(). This is a deliberate design choice (Zhu, Ibrahim, Love 2019 Bioinformatics 35:2084) -- the shrunken estimate is for ranking and visualization; the p-value is for inference. Reporting "shrunken LFC = 0.4, padj = 1e-8" mixes two models, which is fine because both are correct for their stated purpose. What is NOT fine: using the shrunken LFC in a downstream filter and then claiming FDR control on that filter (it has none). For threshold-based FDR claims, use lfcThreshold= or TREAT (glmTreat in edgeR).
A second consequence: results(dds) with no name= or contrast= argument silently returns the last coefficient in resultsNames(dds) -- which depends on factor level order and design formula order. Always specify the contrast explicitly. Tutorials that hard-code results(dds) are setting an example that breaks the moment another factor is added.
Algorithmic Taxonomy
| Test / estimator | What it tests | When mandatory | Failure mode |
|---|---|---|---|
| Wald | One coefficient = 0 | Two-level factor or single contrast | Anti-conservative with many low-count outliers |
LRT (test='LRT', reduced=) |
Joint effect of dropped terms (>=1 df) | Multi-level factor, omnibus, interaction with >1 df | Reports LFC of the LAST coefficient, not omnibus -- read p-value but never report the LFC as "the effect" |
lfcShrink(type='apeglm') (Zhu 2019) |
Posterior LFC under heavy-tailed Cauchy prior | DEFAULT for ranking and visualization | Requires coef=; cannot use contrast= or numeric vectors |
lfcShrink(type='ashr') (Stephens 2017) |
Posterior LFC under unimodal prior; reports lfsr/svalue with svalue=TRUE |
Arbitrary contrasts via contrast= |
Slightly different inferential frame (sign-error rather than null-FDR) |
lfcShrink(type='normal') |
Posterior LFC under zero-centered normal; accepts coef= or contrast= (with res=) |
Quasi-deprecated since v1.16; only path to get shrunken p-values | Cannot be used with formulas containing interaction terms |
TREAT / lfcThreshold= (McCarthy & Smyth 2009) |
LFC magnitude exceeds threshold tau | Want FDR control for " | LFC |
Decision Tree by Scenario
| Scenario | Recommended path | Why |
|---|---|---|
| Two-group bulk RNA-seq, n>=3/group | DESeq() + results(name=...) + lfcShrink(coef=..., type='apeglm') |
Modern default; apeglm is the right prior |
| Factor with 3+ levels, "any change" question | DESeq(test='LRT', reduced=~1); read padj only |
Wald + p-value combining is wrong |
Interaction ~ genotype * treatment |
Build combined factor group = paste(genotype, treatment) and design ~ 0 + group; contrast pairs of interest |
Avoids the resultsNames trap; works with apeglm via relevel |
| Paired design (tumor/normal same patient) | ~ patient + tissue; pairing variable FIRST |
Absorbs subject variability; n_paired effective sample size |
| Salmon/kallisto input | tximport() -> DESeqDataSetFromTximport() |
Carries length offsets automatically; DESeqDataSetFromMatrix(round(...)) loses length correction |
| n=2/group, no choice | Continue but report results as exploratory; consider edgeR QL F-test as sensitivity | Schurch 2016 RNA 22:839: all tools miss 20-40% of true positives at n=3 |
| Single-cell pseudobulk (counts aggregated per donor) | DESeq2 standard pipeline on pseudobulk matrix | Crowell 2020 Nat Commun 11:6077: pseudobulk avoids the FDR inflation of cell-level DE |
| Many DE genes expected (>50% of genome) | estimateSizeFactors(controlGenes=stable) or spike-in normalization |
Median-of-ratios assumes most genes unchanged |
| GSEA preranked input | Shrunken LFC OR stat (Wald Z) as the rank |
Unshrunken LFC do |
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- examples/basic_workflow.R
- examples/batch_correction.R
- examples/multi_condition.R
- usage-guide.md
FAQ
Что делает скилл bio-differential-expression-deseq2-basics?
Performs differential expression on bulk RNA-seq count data with DESeq2's negative-binomial GLM, Wald and LRT testing, apeglm/ashr/normal LFC shrinkage, independent filtering, Cook's outlier handling, VST/rlog transforms, and design formulas including paired, batch, and interaction terms. Use when running bulk DE, choosing DESeq2 over edgeR or limma-voom, building a paired or interaction design, applying LFC shrinkage for ranking or GSEA, choosing Wald vs LRT, troubleshooting padj=NA, picking VST vs rlog, importing salmon/kallisto via tximport, or analyzing prokaryotic RNA-seq.
Как установить скилл bio-differential-expression-deseq2-basics?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл bio-differential-expression-deseq2-basics запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…