[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ECW275C5KMB7H924WSH0F9":3,"skill-same:01M7ECW275C5KMB7H924WSH0F9":70},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":14,"repositoryHtmlUrl":33,"repositoryHomepageUrl":33,"ownerHtmlUrl":34,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":35,"install":36,"resources":49},"01M7ECW275C5KMB7H924WSH0F9","bio-differential-expression-edger-basics",null,"Performs differential expression on bulk RNA-seq count data with edgeR's negative-binomial GLM and quasi-likelihood F-test framework. Covers DGEList construction, filterByExpr, TMM\u002FTMMwsp normalization, robust dispersion estimation, glmQLFit\u002FglmQLFTest, TREAT for magnitude-bounded hypotheses, contrasts via no-intercept designs, voom and voomWithQualityWeights for heterogeneous samples, and the edgeR v4 bias-corrected APL changes. Use when running bulk DE with edgeR, choosing edgeR over DESeq2 (small n, transcript DE via catchSalmon, large samples), needing TREAT for a fold-change-threshold hypothesis, troubleshooting v3-to-v4 reproducibility, building paired or interaction designs, or handling library-quality heterogeneity.","Mr-Nobody-Anonymous\u002FAll-skills","Mr-Nobody-Anonymous","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F184253119?v=4","01M7AEXFJHKTYQW5R0ZCQQTWFV","anonymous","01M7C00M3GQR4QKP9GZA42GFAK",0,"MIT","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-differential-expression-edger-basics\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bio-differential-expression-edger-basics\ndescription: Performs differential expression on bulk RNA-seq count data with edgeR's negative-binomial GLM and quasi-likelihood F-test framework. Covers DGEList construction, filterByExpr, TMM\u002FTMMwsp normalization, robust dispersion estimation, glmQLFit\u002FglmQLFTest, TREAT for magnitude-bounded hypotheses, contrasts via no-intercept designs, voom and voomWithQualityWeights for heterogeneous samples, and the edgeR v4 bias-corrected APL changes. Use when running bulk DE with edgeR, choosing edgeR over DESeq2 (small n, transcript DE via catchSalmon, large samples), needing TREAT for a fold-change-threshold hypothesis, troubleshooting v3-to-v4 reproducibility, building paired or interaction designs, or handling library-quality heterogeneity.\ntool_type: r\nprimary_tool: edgeR\nsource: \"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills\"\nsource_repository: \"GPTomics\u002FbioSkills\"\nsource_path: \"differential-expression\u002Fedger-basics\u002FSKILL.md\"\nlicense: \"MIT\"\nimported_at: \"2026-09-20\"\n---\n\n## Version Compatibility\n\nReference examples tested with: edgeR 4.0+, limma 3.58+, statmod 1.5+ (for voom internals), tximport 1.30+ (for catchSalmon path)\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- R: `packageVersion('\u003Cpkg>')` then `?function_name` to verify parameters\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed\npackage and adapt the example to match the actual API rather than retrying.\n\n# edgeR Basics\n\n**\"Find differentially expressed genes between conditions\"** -> Fit a negative-binomial GLM per gene with empirical-Bayes-moderated dispersions, test coefficients with the quasi-likelihood F-test (proper finite-sample FPR control), and report ranked DE lists.\n\n## The Single Most Important Modern Insight -- edgeR v4 changed the QL framework and `legacy=FALSE` is now default\n\nChen, Chen, Lun, Baldoni, Smyth (2025) *Nucleic Acids Res* 53(2):gkaf018 introduced a bias-corrected adjusted profile likelihood (APL) for dispersion estimation that handles small\u002Fzero counts properly, and reworked the QL framework. `glmQLFit()` in v4 takes `legacy=FALSE` by default. Old (v3) pipelines that worked perfectly in 2023 now produce subtly different numbers in 2025 -- not wrong, just different. If a tutorial result doesn't match, check which version was used; set `legacy=TRUE` to reproduce v3 exactly OR (preferred) re-run with v4 defaults and accept the new -- better -- numbers.\n\nTwo other v4 changes worth knowing: (1) `calcNormFactors()` is deprecated in favor of `normLibSizes()` (same function, new name); (2) `method='TMM'` remains the documented default; `method='TMMwsp'` (TMM with singleton pairing) is an alternative introduced for samples with many zeros and is the preferred choice for sparse \u002F low-count data. Pass `method=` explicitly for reproducibility. Old names still work, so old scripts run, but new code should use the new names.\n\nThe choice between Wald-equivalent (`glmLRT`) and QL-F (`glmQLFTest`) is not a stylistic preference: `glmQLFTest` is the modern default because it accounts for uncertainty in the dispersion estimate via an additional QL dispersion. `glmLRT` is anti-conservative with small n. The two p-values differ -- `glmQLFTest` p-values are typically >= `glmLRT` p-values for the same model (the second-stage QL dispersion correction is usually >= 1).\n\n## Algorithmic Taxonomy\n\n| Test | What it does | When mandatory | Failure mode |\n|------|--------------|----------------|--------------|\n| QL F-test (`glmQLFit` + `glmQLFTest`) | NB GLM with second-stage QL dispersion to model dispersion uncertainty | DEFAULT for any modern bulk DE | None within design assumptions |\n| LRT (`glmFit` + `glmLRT`) | Likelihood-ratio of nested GLMs using point dispersion estimate | Only when n>=10\u002Fgroup AND simple design AND no QL F-test available | Anti-conservative with small n -- inflated false positives |\n| Exact test (`exactTest`) | Conditional NB test for two groups, no covariates | Legacy; one-factor two-group ONLY | Cannot adjust for batch or covariates |\n| TREAT (`glmTreat`) | Tests H0: |LFC| \u003C= tau vs HA: |LFC| > tau (McCarthy & Smyth 2009) | Want FDR control for \"biologically meaningful fold change\" claim | Conservative; tau must be pre-specified |\n| voom + lmFit + eBayes | Linear model with empirical-Bayes moderation on voom-weighted log-CPM | Heterogeneous library sizes (>3x); samples with widely varying quality | Assumes log-normal-after-weighting; less direct count model |\n| voomWithQualityWeights | voom + per-sample quality weights from arrayWeights (Liu 2015) | Some samples markedly worse quality (low RIN, contamination) | With very small n, sample weights are noisy |\n\n## Decision Tree by Scenario\n\n| Scenario | Recommended path | Why |\n|----------|------------------|-----|\n| Standard bulk RNA-seq, n>=3\u002Fgroup, modern script | `filterByExpr -> normLibSizes -> estimateDisp(robust=TRUE) -> glmQLFit(robust=TRUE) -> glmQLFTest` | Modern default with proper FPR control |\n| n=2-3\u002Fgroup | edgeR QL F-test (over DESeq2) | Schurch 2016 *RNA* 22:839 + edgeR v4 changes: QL is the tightest FPR control at small n |\n| Library sizes vary >3x or RIN heterogeneous | `voom` or `voomWithQualityWeights` + lmFit + eBayes | Precision weights downweight noisy observations per sample |\n| Pre-specified biologically meaningful fold-change threshold | `glmTreat(fit, coef=..., lfc=log2(1.5))` | Post-hoc filtering by |LFC| does NOT control FDR for the magnitude hypothesis |\n| Multi-group, \"any change\" omnibus | `glmQLFTest(fit, coef=2:k)` | Joint F-test on multiple coefficients |\n| Multi-group, all pairwise contrasts | `~ 0 + group` parameterization + `makeContrasts` | Clean, readable contrasts |\n| Transcript-level DE (DTE) | `catchSalmon()` \u002F `catchKallisto()` -> `DGEList` with overdispersion | Baldoni 2024 *NAR* 52:e13: properly handles inferential variance |\n| Cross-tool sanity check | Run DESeq2 in parallel; expect >=70% overlap at top 500 | \u003C60% overlap suggests modeling problem, not tool difference |\n| Single-cell pseudobulk | Aggregate counts per donor; standard edgeR QL pipeline | Crowell 2020 *Nat Commun* 11:6077: pseudobulk avoids the FDR inflation of cell-level DE |\n| Reproducing pre-2025 result | `glmQLFit(legacy=TRUE)` | edgeR v4 introduced bias-corrected APL with `legacy=FALSE` default; v3 was slightly biased |\n\n## Standard Workflow\n\n**Goal:** Take a raw integer count matrix and group labels to a ranked DE table with proper finite-sample FPR control.\n\n**Approach:** DGEList -> design-aware filtering -> TMM normalization (or TMMwsp for sparse data) -> robust dispersion estimation -> QL fit with robust dispersion shrinkage -> QL F-test on the coefficient of interest -> ranked table.\n\n```r\nlibrary(edgeR)\nlibrary(limma)\n\ny \u003C- DGEList(counts = counts, group = group)\ndesign \u003C- model.matrix(~ group)\n\nkeep \u003C- filterByExpr(y, design)\ny \u003C- y[keep, , keep.lib.sizes = FALSE]\n\ny \u003C- normLibSizes(y)\ny \u003C- estimateDisp(y, design, robust = TRUE)\nplotBCV(y)\n\nfit \u003C- glmQLFit(y, design, robust = TRUE)\nqlf \u003C- glmQLFTest(fit, coef = 2)\n\ntopTags(qlf, n = 20)\nall_de \u003C- topTags(qlf, n = Inf, sort.by = 'none')$table\n```\n\nThe `robust = TRUE` flags propagate Phipson, Lee, Majewski, Alexander, Smyth (2016) *Ann Appl Stat* 10:946 robust hyperparameter estimation through both the NB dispersion shrinkage (`estimateDisp`) AND the QL dispersion shrinkage (`glmQLFit`). Set BOTH; setting only one is the single most common omission. The default `robust=FALSE` is a relic.\n\n## Filtering -- `filterByExpr` Internals\n\n**Goal:** Remove genes with insufficient expression to reduce noise and multiple-testing burden, in a design-aware way.\n\n**Approach:** `filterByExpr(y, design)` uses the smallest group size from the design matrix to set the minimum number of samples; threshold is CPM >= `min.count \u002F median.lib.size * 1e6` AND total count >= `min.total.count`.\n\nDefault parameters: `min.count = 10`, `min.total.count = 15`, `large.n = 10`, `min.prop = 0.7`.\n\n```r\nkeep \u003C- filterByExpr(y, design)\ny \u003C- y[keep, , keep.lib.sizes = FALSE]\n```\n\nFilter ONCE, before normalization and dispersion estimation. Filtering after `estimateDisp` invalidates the trended dispersion (the trend was fit on the now-smaller gene set). edgeR has no automatic independent filtering like DESeq2 -- skipping `filterByExpr` is the single biggest reason an edgeR analysis underperforms a comparable DESeq2 analysis.\n\n## Normalization -- TMM\u002FTMMwsp Is an Offset, Not a Division\n\n**Goal:** Correct for library composition bias (the \"few genes consume disproportionate reads\" problem) via a per-sample scaling factor.\n\n**Approach:** `normLibSizes(y)` defaults to `method='TMM'` in v4 (same as v3); `method='TMMwsp'` is the preferred alternative for sparse \u002F single-cell-pseudobulk data with many zeros. Result is a vector of normalization factors stored in `y$samples$norm.factors`; the effective library size is `lib.size * norm.factors`. Counts are NOT divided.\n\n```r\ny \u003C- normLibSizes(y)\ny$samples$norm.factors\n\ncpm_vis \u003C- cpm(y, normalized.lib.sizes = TRUE)\nlog_cpm \u003C- cpm(y, log = TRUE, prior.count = 2)\n```\n\nThe factor enters the GLM as part of the offset. Running TMM on pre-normalized values is wrong (and silent -- gives wrong numbers without error). `prior.count = 2` is the modern edgeR default for `cpm(log=TRUE)`; smaller priors (0.25) make low-count log values noisy; larger priors (5-10) shrink them toward zero.\n\nWhen TMM\u002FTMMwsp assumptions fail (see Failure Modes: prokaryotic stress, MYC amplification, viral host shutoff): use `method='upperquartile'` or supply known stable reference genes via offsets.\n\n## QL F-test vs LRT vs Exact Test\n\n```r\nfit_ql \u003C- glmQLFit(y, design, robust = TRUE)\nqlf \u003C- glmQLFTest(fit_ql, coef = 2)\n\nfit_lrt \u003C- glmFit(y, design)\nlrt \u003C- glmLRT(fit_lrt, coef = 2)\n\ny \u003C- estimateDisp(y)\net \u003C- exactTest(y)\n```\n\nQL F-test is the modern default. LRT is anti-conservative with small n because it does not account for dispersion uncertainty. The exact test handles only two-group one-factor designs and exists for backward compatibility -- use the GLM pipeline for anything with covariates or blocking.\n\nIn v4, the QL F-test is bias-corrected via the new APL when `legacy=FALSE` (the v4 default). To exactly reproduce a v3 result: `glmQLFit(y, design, robust = TRUE, legacy = TRUE)`.\n\n## TREAT -- Testing Against a Fold-Change Threshold\n\n**Goal:** Control FDR for the hypothesis \"biologically meaningful fold change\", not \"fold change non-zero\".\n\n**Approach:** `glmTreat(fit, coef=..., lfc=log2(tau))` tests H0: |LFC| \u003C= tau vs HA: |LFC| > tau. The threshold tau MUST be biologically pre-specified -- choosing tau after seeing the data is p-hacking.\n\n```r\ntr \u003C- glmTreat(fit, coef = 2, lfc = log2(1.5))\ntopTags(tr)\n```\n\nThe cardinal sin TREAT avoids: filtering `padj \u003C 0.05 & abs(logFC) > 1` after a vanilla QL F-test does NOT control FDR for \"the LFC exceeds 1\". Post-hoc filtering is FDR-controlled for the |LFC|>0 hypothesis only. If reviewers ask \"what is the FDR of the '2-fold up' gene list\", the only honest answers are TREAT (FDR controlled at the threshold) or \"FDR is for non-zero only; the magnitude filter has no FDR guarantee\".\n\nEquivalent in DESeq2: `results(dds, lfcThreshold = log2(1.5), altHypothesis = 'greaterAbs')`. Both implement the McCarthy & Smyth 2009 *Bioinformatics* 25:765 idea.\n\n## Contrasts via No-Intercept Designs\n\n**Goal:** Define clean pairwise or multi-group contrasts.\n\n**Approach:** Use `~ 0 + group` parameterization so each coefficient is the group mean; build `makeContrasts(...)` for any pairwise or weighted-average comparison.\n\n```r\ndesign \u003C- model.matrix(~ 0 + group)\ncolnames(design) \u003C- levels(group)\ny \u003C- estimateDisp(y, design, robust = TRUE)\nfit \u003C- glmQLFit(y, design, robust = TRUE)\n\ncon \u003C- makeContrasts(\n    TreatedVsControl = treated - control,\n    DrugAVsDrugB     = drugA - drugB,\n    ATvsBT           = (treated_A - control_A) - (treated_B - control_B),\n    levels = design\n)\n\nqlf_t_vs_c \u003C- glmQLFTest(fit, contrast = con[, 'TreatedVsControl'])\nqlf_interaction \u003C- glmQLFTest(fit, contrast = con[, 'ATvsBT'])\n```\n\n`makeContrasts` is more readable than numeric vectors for any non-trivial design.\n\n## voom and voomWithQualityWeights\n\n**Goal:** Use limma's linear-model framework with empirical-Bayes moderation, applying voom precision weights for the mean-variance trend of log-CPM.\n\n**Approach:** voom transforms counts to log-CPM with per-observation precision weights derived from the mean-variance trend; lmFit + eBayes proceeds as for microarrays.\n\n```r\nv \u003C- voom(y, design, plot = TRUE)\nfit \u003C- lmFit(v, design)\nfit \u003C- eBayes(fit, robust = TRUE)\ntt \u003C- topTable(fit, coef = 2, number = Inf)\n```\n\n`voomWithQualityWeights` (Liu, Holik, Su et al. 2015 *NAR* 43:e97) adds per-sample weights to downweight outlier samples. Use when:\n- Library sizes vary >5x across samples\n- RIN varies >2 units\n- PCA shows one or more samples clearly off the main cluster\n\n```r\nv \u003C- voomWithQualityWeights(y, design, plot = TRUE)\nfit \u003C- lmFit(v, design)\nfit \u003C- eBayes(fit, robust = TRUE)\n```\n\n`eBayes(robust = TRUE)` uses Phipson 2016 robust hyperparameter estimation -- NOT the default but strongly recommended for RNA-seq.\n\n## Transcript-Level DE via catchSalmon\n\n**Goal:** Test differential transcript expression with proper inferential variance from quantification bootstrap replicates.\n\n**Approach:** `catchSalmon()` \u002F `catchKallisto()` import per-transcript counts with overdispersion estimates from the bootstrap replicates; pass to `DGEList`; the rest of the pipeline is standard.\n\n```r\nsalmon \u003C- catchSalmon(paths = file.path('salmon_out', samples$id))\ny_tx \u003C- DGEList(counts = salmon$counts \u002F salmon$annotation$Overdispersion,\n                genes  = salmon$annotation)\n```\n\nBaldoni, Chen, Hediyeh-zadeh et al. 2024 *NAR* 52:e13 (\"Dividing out quantification uncertainty\"): the per-transcript Overdispersion column captures the variance contribution from the Salmon EM. Dividing the counts by this scaling provides effective counts that limma\u002FedgeR can model as if quantification was certain.\n\n## edgeR vs DESeq2 vs limma-voom\n\n| Scenario | Recommended | Rationale |\n|----------|-------------|-----------|\n| Modern default | DESeq2 or edgeR QL (both fine) | ~70-90% overlap on top hits; choose by ecosystem |\n| n = 2-3\u002Fgroup | edgeR QL | Tightest FPR at small n |\n| Library sizes heterogeneous | limma-voom or voomWithQualityWeights | Precision weights matter most here |\n| Salmon\u002Fkallisto -> gene-level DGE | DESeq2 (DESeqDataSetFromTximport handles offsets natively) | Cleanest path |\n| Salmon -> transcript-level DTE | edgeR `catchSalmon` | Baldoni 2024 framework |\n| Need apeglm\u002Fashr LFC shrinkage | DESeq2 | edgeR has no equivalent built-in |\n| Need TREAT-style threshold testing | Both (`glmTreat` or `lfcThreshold=`) | Equivalent |\n| Python-only environment | PyDESeq2 | No edgeR Python equivalent |\n\nIf DESeq2 and edgeR agree on >=70% of the top 500: results are robust. \u003C60%: investigate filtering, normalization, dispersion, or a confounded covariate -- usually a modeling issue.\n\n## Per-Method Failure Modes\n\n### Forgot `filterByExpr` -- inflated multiple-testing burden\n\n**Trigger:** edgeR pipeline run on a count matrix with all genes (~60k for human) including many with zero or near-zero counts; significant gene list smaller than expected.\n\n**Mechanism:** edgeR's QL pipeline does NOT have DESeq2's automatic independent filtering. Every gene tested contributes to the BH denominator.\n\n**Symptom:** Low-count genes dominate the tested set; tested-gene count is 60k instead of ~15-20k; padj distribution skewed toward 1.\n\n**Fix:** `filterByExpr(y, design)` BEFORE normalization and dispersion estimation. Filtering after `estimateDisp` invalidates the trended dispersion.\n\n### Used `glmLRT` with n=3 -- inflated false positives\n\n**Trigger:** Tutorial copy-paste of `glmFit` + `glmLRT` on small-n data; many \"significant\" genes that don't replicate.\n\n**Mechanism:** `glmLRT` uses a point dispersion estimate; with small n, dispersion is uncertain and the test is anti-conservative.\n\n**Symptom:** Many more DE genes than DESeq2 or limma-voom on the same data; p-value histogram has anti-conservative left tail.\n\n**Fix:** Use `glmQLFit` + `glmQLFTest` with `robust = TRUE` on both.\n\n### TMM\u002FRLE assumption broken -- size factors absorb biology\n\n**Trigger:** Bacterial stress response, viral infection with host shutoff, MYC-amplified tumor vs normal -- biological systems where >50% of genes truly change.\n\n**Mechanism:** TMM\u002FTMMwsp assumes most genes are unchanged. When violated, the \"trimmed reference\" is dominated by DE genes; the size factor compensates by absorbing the biological shift.\n\n**Symptom:** MA plot shows the bulk cloud shifted off zero; reported fold changes don't match orthogonal validation (qPCR, Western); known DE genes show muted LFC.\n\n**Fix:** `normLibSizes(y, method='upperquartile')` is a partial fix; supply ERCC spike-in offsets or curated stable housekeeping genes via `y$offset` for the principled solution.\n\n### Reproducibility break between edgeR v3 and v4\n\n**Trigger:** Pre-2025 script run on edgeR 4.0+ produces different DE genes than the published result.\n\n**Mechanism:** v4 changed the QL framework (bias-corrected APL) and the default behavior of `glmQLFit` (`legacy = FALSE`). TMM remains the documented default for `normLibSizes`; TMMwsp is an added alternative for sparse data.\n\n**Symptom:** Different significant gene set; absolute LFC differences of 5-15% on low-count genes; reviewer confusion.\n\n**Fix:** For exact reproduction: `glmQLFit(y, design, robust=TRUE, legacy=TRUE)`. The normalization default has not actually changed -- TMM remains the v4 default. Better: rerun and accept the v4 -- improved -- numbers, noting the version change in methods.\n\n## Common errors\n\n| Error \u002F symptom | Cause | Fix |\n|-----------------|-------|-----|\n| `decidetestsDGE` not found | Removed in edgeR v4 | Use `decideTests(qlf)` |\n| `design matrix not full rank` | Confounded covariates | Inspect with `alias(design)$Complete` |\n| `No residual df` | Too few replicates for the model | Reduce model complexity or get more samples |\n| Script expects `$adj.P.Val` but `topTags` returns `$FDR` | Tool-name column mix-up | edgeR uses `$FDR`; limma uses `$adj.P.Val`; DESeq2 uses `$padj` |\n| QL F p-values numerically different from a 2023 paper | edgeR v4 default `legacy=FALSE` | Set `legacy=TRUE` to reproduce v3, or note the version change |\n\n## References\n\n- Robinson MD, McCarthy DJ, Smyth GK. 2010. edgeR: a Bioconductor package for differential expression analysis of digital gene expression data. *Bioinformatics* 26(1):139-140. doi:10.1093\u002Fbioinformatics\u002Fbtp616\n- McCarthy DJ, Chen Y, Smyth GK. 2012. Differential expression analysis of multifactor RNA-Seq experiments with respect to biological variation. *Nucleic Acids Res* 40(10):4288-4297. doi:10.1093\u002Fnar\u002Fgks042\n- Chen Y, Lun ATL, Smyth GK. 2016. From reads to genes to pathways: differential expression analysis of RNA-Seq experiments using Rsubread and the edgeR quasi-likelihood pipeline. *F1000Res* 5:1438. doi:10.12688\u002Ff1000research.8987.2\n- Chen Y, Chen L, Lun ATL, Baldoni PL, Smyth GK. 2025. edgeR v4: powerful differential analysis of sequencing data with expanded functionality and improved support for small counts and larger datasets. *Nucleic Acids Res* 53(2):gkaf018. doi:10.1093\u002Fnar\u002Fgkaf018\n- Lund SP, Nettleton D, McCarthy DJ, Smyth GK. 2012. Detecting differential expression in RNA-sequence data using quasi-likelihood with shrunken dispersion estimates. *Stat Appl Genet Mol Biol* 11(5):Article 8. doi:10.1515\u002F1544-6115.1826\n- Phipson B, Lee S, Majewski IJ, Alexander WS, Smyth GK. 2016. Robust hyperparameter estimation protects against hypervariable genes and improves power to detect differential expression. *Ann Appl Stat* 10(2):946-963. doi:10.1214\u002F16-AOAS920\n- Law CW, Chen Y, Shi W, Smyth GK. 2014. voom: precision weights unlock linear model analysis tools for RNA-seq read counts. *Genome Biol* 15(2):R29. doi:10.1186\u002Fgb-2014-15-2-r29\n- Liu R, Holik AZ, Su S, Jansz N, Chen K, Leong HS, Blewitt ME, Asselin-Labat M-L, Smyth GK, Ritchie ME. 2015. Why weight? Modelling sample and observational level variability improves power in RNA-seq analyses. *Nucleic Acids Res* 43(15):e97. doi:10.1093\u002Fnar\u002Fgkv412\n- McCarthy DJ, Smyth GK. 2009. Testing significance relative to a fold-change threshold is a TREAT. *Bioinformatics* 25(6):765-771. doi:10.1093\u002Fbioinformatics\u002Fbtp053\n- Baldoni PL, Chen Y, Hediyeh-zadeh S, Liao Y, Dong X, Ritchie ME, Shi W, Smyth GK. 2024. Dividing out quantification uncertainty allows efficient assessment of differential transcript expression with edgeR. *Nucleic Acids Res* 52(3):e13. doi:10.1093\u002Fnar\u002Fgkad1167\n- Ritchie ME, Phipson B, Wu D, Hu Y, Law CW, Shi W, Smyth GK. 2015. limma powers differential expression analyses for RNA-sequencing and microarray studies. *Nucleic Acids Res* 43(7):e47. doi:10.1093\u002Fnar\u002Fgkv007\n- Schurch NJ et al. 2016. How many biological replicates are needed in an RNA-seq experiment and which differential expression tool should you use? *RNA* 22(6):839-851. doi:10.1261\u002Frna.053959.115\n- Robinson MD, Oshlack A. 2010. A scaling normalization method for differential expression analysis of RNA-seq data. *Genome Biol* 11(3):R25. doi:10.1186\u002Fgb-2010-11-3-r25\n\n## Related Skills\n\n- deseq2-basics - Cross-check, or use when LFC shrinkage (apeglm) needed\n- de-results - FDR, IHW, GSEA preparation, padj column name variation\n- de-visualization - BCV plot, MD plot, PCA via plotMDS\n- batch-correction - Include batch in design vs correct-then-test cardinal sin\n- timeseries-de - voom + splines for time-course\n- expression-matrix\u002Fcounts-ingest - Salmon\u002Fkallisto input via tximport or catchSalmon\n- expression-matrix\u002Fnormalization - TMM\u002FTMMwsp\u002FRLE mechanics\n- expression-matrix\u002Fmetadata-joins - Reference level, paired design, interaction parameterization\n- expression-matrix\u002Fgene-id-mapping - Annotating DE results with symbols\n- rna-quantification\u002Ftximport-workflow - Detailed tximport mechanics\n- pathway-analysis\u002Fgsea - Ranked-list input from DE\n","## Version Compatibility\n\nReference examples tested with: edgeR 4.0+, limma 3.58+, statmod 1.5+ (for voom internals), tximport 1.30+ (for catchSalmon path)\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- R: `packageVersion('\u003Cpkg>')` then `?function_name` to verify parameters\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed\npackage and adapt the example to match the actual API rather than retrying.\n\n# edgeR Basics\n\n**\"Find differentially expressed genes between conditions\"** -> Fit a negative-binomial GLM per gene with empirical-Bayes-moderated dispersions, test coefficients with the quasi-likelihood F-test (proper finite-sample FPR control), and report ranked DE lists.\n\n## The Single Most Important Modern Insight -- edgeR v4 changed the QL framework and `legacy=FALSE` is now default\n\nChen, Chen, Lun, Baldoni, Smyth (2025) *Nucleic Acids Res* 53(2):gkaf018 introduced a bias-corrected adjusted profile likelihood (APL) for dispersion estimation that handles small\u002Fzero counts properly, and reworked the QL framework. `glmQLFit()` in v4 takes `legacy=FALSE` by default. Old (v3) pipelines that worked perfectly in 2023 now produce subtly different numbers in 2025 -- not wrong, just different. If a tutorial result doesn't match, check which version was used; set `legacy=TRUE` to reproduce v3 exactly OR (preferred) re-run with v4 defaults and accept the new -- better -- numbers.\n\nTwo other v4 changes worth knowing: (1) `calcNormFactors()` is deprecated in favor of `normLibSizes()` (same function, new name); (2) `method='TMM'` remains the documented default; `method='TMMwsp'` (TMM with singleton pairing) is an alternative introduced for samples with many zeros and is the preferred choice for sparse \u002F low-count data. Pass `method=` explicitly for reproducibility. Old names still work, so old scripts run, but new code should use the new names.\n\nThe choice between Wald-equivalent (`glmLRT`) and QL-F (`glmQLFTest`) is not a stylistic preference: `glmQLFTest` is the modern default because it accounts for uncertainty in the dispersion estimate via an additional QL dispersion. `glmLRT` is anti-conservative with small n. The two p-values differ -- `glmQLFTest` p-values are typically >= `glmLRT` p-values for the same model (the second-stage QL dispersion correction is usually >= 1).\n\n## Algorithmic Taxonomy\n\n| Test | What it does | When mandatory | Failure mode |\n|------|--------------|----------------|--------------|\n| QL F-test (`glmQLFit` + `glmQLFTest`) | NB GLM with second-stage QL dispersion to model dispersion uncertainty | DEFAULT for any modern bulk DE | None within design assumptions |\n| LRT (`glmFit` + `glmLRT`) | Likelihood-ratio of nested GLMs using point dispersion estimate | Only when n>=10\u002Fgroup AND simple design AND no QL F-test available | Anti-conservative with small n -- inflated false positives |\n| Exact test (`exactTest`) | Conditional NB test for two groups, no covariates | Legacy; one-factor two-group ONLY | Cannot adjust for batch or covariates |\n| TREAT (`glmTreat`) | Tests H0: |LFC| \u003C= tau vs HA: |LFC| > tau (McCarthy & Smyth 2009) | Want FDR control for \"biologically meaningful fold change\" claim | Conservative; tau must be pre-specified |\n| voom + lmFit + eBayes | Linear model with empirical-Bayes moderation on voom-weighted log-CPM | Heterogeneous library sizes (>3x); samples with widely varying quality | Assumes log-normal-after-weighting; less direct count model |\n| voomWithQualityWeights | voom + per-sample quality weights from arrayWeights (Liu 2015) | Some samples markedly worse quality (low RIN, contamination) | With very small n, sample weights are noisy |\n\n## Decision Tree by Scenario\n\n| Scenario | Recommended path | Why |\n|----------|------------------|-----|\n| Standard bulk RNA-seq, n>=3\u002Fgroup, modern script | `filterByExpr -> normLibSizes -> estimateDisp(robust=TRUE) -> glmQLFit(robust=TRUE) -> glmQLFTest` | Modern default with proper FPR control |\n| n=2-3\u002Fgroup | edgeR QL F-test (over DESeq2) | Schurch 2016 *RNA* 22:839 + edgeR v4 changes: QL is the tightest FPR control at small n |\n| Library sizes vary >3x or RIN heterogeneous | `voom` or `voomWithQualityWeights` + lmFit + eBayes | Precision weights downweight noisy observations per sample |\n| Pre-specified biologically meaningful fold-change threshold | `glmTreat(fit, coef=..., lfc=log2(1.5))` | Post-hoc filtering by |LFC| does NOT control FDR for the magnitude hypothesis |\n| Multi-group, \"any change\" omnibus | `glmQLFTest(fit, coef=2:k)` | Joint F-test on multiple coefficients |\n| Multi-group, all pairwise contrasts | `~ 0 + group` parameterization + `makeContrasts` | Clean, readable contrasts |\n| Transcript-level DE (DTE) | `catchSalmon()` \u002F `catchKallisto()` -> `DGEList` with overdispersion | Baldoni 2024 *NAR* 52:e13: properly handles inferential variance |\n| Cross-tool sanity check | Run DESeq2 in parallel; expect >=70% overlap at top 500 | \u003C60% overlap suggests modeling problem, not tool difference |\n| Single-cell pseudobulk | Aggregate counts per donor; standard edgeR QL pipeline | Crowell 2020 *Nat Commun* 11:6077: pseudobulk avoids the FDR inflation of cell-level DE |\n| Reproducing pre-2025 result | `glmQLFit(legacy=TRUE)` | edgeR v4 introduced bias-corrected APL with `legacy=FALSE` default; v3 was slightly biased |\n\n## Standard Workflow\n\n**Goal:** Take a raw integer count matrix and group labels to a ranked DE table with proper finite-sample FPR control.\n\n**Approach:** DGEList -> design-aware filtering -> TMM normalization (or TMMwsp for sparse data) -> robust dispersion estimation -> QL fit with robust dispersion shrinkage -> QL F-test on the coefficient of interest -> ranked table.\n\n```r\nlibrary(edgeR)\nlibrary(limma)\n\ny \u003C- DGEList(counts = counts, group = group)\ndesign \u003C- model.matrix(~ group)\n\nkeep \u003C- filterByExpr(y, design)\ny \u003C- y[keep, , keep.lib.sizes = FALSE]\n\ny \u003C- normLibSizes(y)\ny \u003C- estimateDisp(y, design, robust = TRUE)\nplotBCV(y)\n\nfit \u003C- glmQLFit(y, design, robust = TRUE)\nqlf \u003C- glmQLFTest(fit, coef = 2)\n\ntopTags(qlf, n = 20)\nall_de \u003C- topTags(qlf, n = Inf, sort.by = 'none')$table\n```\n\nThe `robust = TRUE` flags propagate Phipson, Lee, Majewski, Alexander, Smyth (2016) *Ann Appl Stat* 10:946 robust hyperparameter estimation through both the NB dispersion shrinkage (`estimateDisp`) AND the QL dispersion shrinkage (`glmQLFit`). Set BOTH; setting only one is the single most common omission. The default `robust=FALSE` is a relic.\n\n## Filtering -- `filterByExpr` Internals\n\n**Goal:** Remove genes with insufficient expression to reduce noise and multiple-testing burden, in a design-aware way.\n\n**Approach:** `filterByExpr(y, design)` uses the smallest group size from the design matrix to set the minimum number of samples; threshold is CPM >= `min.count \u002F median.lib.size * 1e6` AND total count >= `min.total.count`.\n\nDefault parameters: `min.count = 10`, `min.total.count = 15`, `large.n = 10`, `min.prop = 0.7`.\n\n```r\nkeep \u003C- filterByExpr(y, design)\ny \u003C- y[keep, , keep.lib.sizes = FALSE]\n```\n\nFilter ONCE, before normalization and dispersion estimation. Filtering after `estimateDisp` invalidates the trended dispersion (the trend was fit on the now-smaller gene set). edgeR has no automatic independent filtering like DESeq2 -- skipping `filterByExpr` is the single biggest reason an edgeR analysis underperforms a comparable DESeq2 analysis.\n\n## Normalization -- TMM\u002FTMMwsp Is an Offset, Not a Division\n\n**Goal:** Correct for library composition bias (the \"few genes consume disproportionate reads\" problem) via a per-sample scaling factor.\n\n**Approach:** `normLibSizes(y)` defaults to `method='TMM'` in v4 (same as v3); `method='TMMwsp'` is the preferred alternative for sparse \u002F single-cell-pseudobulk data with many zeros. Result is a vector of normalization factors stored in `y$samples$norm.factors`; the effective library size is `lib.size * norm.factors`. Counts are NOT divided.\n\n```r\ny \u003C- normLibSizes(y)\ny$samples$norm.factors\n\ncpm_vis \u003C- cpm(y, normalized.lib.sizes = TRUE)\nlog_cpm \u003C- cpm(y, log = TRUE, prior.count = 2)\n```\n\nThe factor enters the GLM as part of the offset. Running TMM on pre-normalized values is wrong (and silent -- gives wrong numbers without error). `prior.count = 2` is the modern edgeR default for `cpm(log=TRUE)`; smaller priors (0.25) make low-count log values noisy; larger priors (5-10) shrink them toward zero.\n\nWhen TMM\u002FTMMwsp assumptions fail (see Failure Modes: prokaryotic stress, MYC amplification, viral host shutoff): use `method='upperquartile'` or supply known stable reference genes via offsets.\n\n## QL F-test vs LRT vs Exact Test\n\n```r\nfit_ql \u003C- glmQLFit(y, design, robust = TRUE)\nqlf \u003C- glmQLFTest(fit_ql, coef = 2)\n\nfit_lrt \u003C- glmFit(y, design)\nlrt \u003C- glmLRT(fit_lrt, coef = 2)\n\ny \u003C- estimateDisp(y)\net \u003C- exactTest(y)\n```\n\nQL F-test is the modern default. LRT is anti-conservative with small n because it does not account for dispersion uncertainty. The exact test handles only two-group one-factor designs and exists for backward compatibility -- use the GLM pipeline for anything with covariates or blocking.\n\nIn v4, the QL F-test is bias-corrected via the new APL when `legacy=FALSE` (the v4 default). To exactly reproduce a v3 result: `glmQLFit(y, design, robust = TRUE, legacy = TRUE)`.\n\n## TREAT -- Testing Against a Fold-Change Threshold\n\n**Goal:** Control FDR for the hypothesis \"biologically meaningful fold change\", not \"fold change non-zero\".\n\n**Approach:** `glmTreat(fit, coef=..., lfc=log2(tau))` tests H0: |LFC| \u003C= tau vs HA: |LFC| > tau. The threshold tau MUST be biologically pre-specified -- choosing tau after seeing the data is p-hacking.\n\n```r\ntr \u003C- glmTreat(fit, coef = 2, lfc = log2(1.5))\ntopTags(tr)\n```\n\nThe cardinal sin TREAT avoids: filtering `padj \u003C 0.05 & abs(logFC) > 1` after a vanilla QL F-test does NOT control FDR for \"the LFC exceeds 1\". Post-hoc filtering is FDR-controlled for the |LFC|>0 hypothesis only. If reviewers ask \"what is the FDR of the '2-fold up' gene list\", the only honest answers are TREAT (FDR controlled at the threshold) or \"FDR is for non-zero only; the magnitude filter has no FDR guarantee\".\n\nEquivalent in DESeq2: `results(dds, lfcThreshold = log2(1.5), altHypothesis = 'greaterAbs')`. Both implement the McCarthy & Smyth 2009 *Bioinformatics* 25:765 idea.\n\n## Contrasts via No-Intercept Designs\n\n**Goal:** Define clean pairwise or multi-group contrasts.\n\n**Approach:** Use `~ 0 + group` parameterization so each coefficient is the group mean; build `makeContrasts(...)` for any pairwise or weighted-average comparison.\n\n```r\ndesign \u003C- model.matrix(~ 0 + group)\ncolnames(design) \u003C- levels(group)\ny \u003C- estimateDisp(y, design, robust = TRUE)\nfit \u003C- glmQLFit(y, design, robust = TRUE)\n\ncon \u003C- makeContrasts(\n    TreatedVsControl = treated - control,\n    DrugAVsDrugB     = drugA - drugB,\n    ATvsBT           = (treated_A - control_A) - (treated_B - control_B),\n    levels = design\n)\n\nqlf_t_vs_c \u003C- glmQLFTest(fit, contrast = con[, 'TreatedVsControl'])\nqlf_interaction \u003C- glmQLFTest(fit, contrast = con[, 'ATvsBT'])\n```\n\n`makeContrasts` is more readable than numeric vectors for any non-trivial design.\n\n## voom and voomWithQualityWeights\n\n**Goal:** Use limma's linear-model framework with empirical-Bayes moderation, applying voom precision weights for the mean-variance trend of log-CPM.\n\n**Approach:** voom transforms counts to log-CPM with per-observation precision weights derived from the mean-variance trend; lmFit + eBayes proceeds as for microarrays.\n\n```r\nv \u003C- voom(y, design, plot = TRUE)\nfit \u003C- lmFit(v, design)\nfit \u003C- eBayes(fit, robust = TRUE)\ntt \u003C- topTable(fit, coef = 2, number = Inf)\n```\n\n`voomWithQualityWeights` (Liu, Holik, Su et al. 2015 *NAR* 43:e97) adds per-sample weights to downweight outlier samples. Use when:\n- Library sizes vary >5x across samples\n- RIN varies >2 units\n- PCA shows one or more samples clearly off the main cluster\n\n```r\nv \u003C- voomWithQualityWeights(y, design, plot = TRUE)\nfit \u003C- lmFit(v, design)\nfit \u003C- eBayes(fit, robust = TRUE)\n```\n\n`eBayes(robust = TRUE)` uses Phipson 2016 robust hyperparameter estimation -- NOT the default but strongly recommended for RNA-seq.\n\n## Transcript-Level DE via catchSalmon\n\n**Goal:** Test differential transcript expression with proper inferential variance from quantification bootstrap replicates.\n\n**Approach:** `catchSalmon()` \u002F `catchKallisto()` import per-transcript counts with overdispersion estimates from the bootstrap replicates; pass to `DGEList`; the rest of the pipeline is standard.\n\n```r\nsalmon \u003C- catchSalmon(paths = file.path('salmon_out', samples$id))\ny_tx \u003C- DGEList(counts = salmon$counts \u002F salmon$annotation$Overdispersion,\n                genes  = salmon$annotation)\n```\n\nBaldoni, Chen, Hediyeh-zadeh et al. 2024 *NAR* 52:e13 (\"Dividing out quantification uncertainty\"): the per-transcript Overdispersion column captures the variance contribution from the Salmon EM. Dividing the counts by this scaling provides effective counts that limma\u002FedgeR can model as if quantification was certain.\n\n## edgeR vs DESeq2 vs limma-voom\n\n| Scenario | Recommended | Rationale |\n|----------|-------------|-----------|\n| Modern default | DESeq2 or edgeR QL (both fine) | ~70-90% overlap on top hits; choose by ecosystem |\n| n = 2-3\u002Fgroup | edgeR QL | Tightest FPR at small n |\n| Library sizes heterogeneous | limma-voom or voomWithQualityWeights | Precision weights matter most here |\n| Salmon\u002Fkallisto -> gene-level DGE | DESeq2 (DESeqDataSetFromTximport handles offsets natively) | Cleanest path |\n| Salmon -> transcript-level DTE | edgeR `catchSalmon` | Baldoni 2024 framework |\n| Need apeglm\u002Fashr LFC shrinkage | DESeq2 | edgeR has no equivalent built-in |\n| Need TREAT-style threshold testing | Both (`glmTreat` or `lfcThreshold=`) | Equivalent |\n| Python-only environment | PyDESeq2 | No edgeR Python equivalent |\n\nIf DESeq2 and edgeR agree on >=70% of the top 500: results are robust. \u003C60%: investigate filtering, normalization, dispersion, or a confounded covariate -- usually a modeling issue.\n\n## Per-Method Failure Modes\n\n### Forgot `filterByExpr` -- inflated multiple-testing burden\n\n**Trigger:** edgeR pipeline run on a count matrix with all genes (~60k for human) including many with zero or near-zero counts; significant gene list smaller than expected.\n\n**Mechanism:** edgeR's QL pipeline does NOT have DESeq2's automatic independent filtering. Every gene tested contributes to the BH denominator.\n\n**Symptom:** Low-count genes dominate the tested set; tested-gene count is 60k instead of ~15-20k; padj distribution skewed toward 1.\n\n**Fix:** `filterByExpr(y, design)` BEFORE normalization and dispersion estimation. Filtering after `estimateDisp` invalidates the trended dispersion.\n\n### Used `glmLRT` with n=3 -- inflated false positives\n\n**Trigger:** Tutorial copy-paste of `glmFit` + `glmLRT` on small-n data; many \"significant\" genes that don't replicate.\n\n**Mechanism:** `glmLRT` uses a point dispersion estimate; with small n, dispersion is uncertain and the test is anti-conservative.\n\n**Symptom:** Many more DE genes than DESeq2 or limma-voom on the same data; p-value histogram has anti-conservative left tail.\n\n**Fix:** Use `glmQLFit` + `glmQLFTest` with `robust = TRUE` on both.\n\n### TMM\u002FRLE assumption broken -- size factors absorb biology\n\n**Trigger:** Bacterial stress response, viral infection with host shutoff, MYC-amplified tumor vs normal -- biological systems where >50% of genes truly change.\n\n**Mechanism:** TMM\u002FTMMwsp assumes most genes are unchanged. When violated, the \"trimmed reference\" is dominated by DE genes; the size factor compensates by absorbing the biological shift.\n\n**Symptom:** MA plot shows the bulk cloud shifted off zero; reported fold changes don't match orthogonal validation (qPCR, Western); known DE genes show muted LFC.\n\n**Fix:** `normLibSizes(y, method='upperquartile')` is a partial fix; supply ERCC spike-in offsets or curated stable housekeeping genes via `y$offset` for the principled solution.\n\n### Reproducibility break between edgeR v3 and v4\n\n**Trigger:** Pre-2025 script run on edgeR 4.0+ produces different DE genes than the published result.\n\n**Mechanism:** v4 changed the QL framework (bias-corrected APL) and the default behavior of `glmQLFit` (`legacy = FALSE`). TMM remains the documented default for `normLibSizes`; TMMwsp is an added alternative for sparse data.\n\n**Symptom:** Different significant gene set; absolute LFC differences of 5-15% on low-count genes; reviewer confusion.\n\n**Fix:** For exact reproduction: `glmQLFit(y, design, robust=TRUE, legacy=TRUE)`. The normalization default has not actually changed -- TMM remains the v4 default. Better: rerun and accept the v4 -- improved -- numbers, noting the version change in methods.\n\n## Common errors\n\n| Error \u002F symptom | Cause | Fix |\n|-----------------|-------|-----|\n| `decidetestsDGE` not found | Removed in edgeR v4 | Use `decideTests(qlf)` |\n| `design matrix not full rank` | Confounded covariates | Inspect with `alias(design)$Complete` |\n| `No residual df` | Too few replicates for the model | Reduce model complexity or get more samples |\n| Script expects `$adj.P.Val` but `topTags` returns `$FDR` | Tool-name column mix-up | edgeR uses `$FDR`; limma uses `$adj.P.Val`; DESeq2 uses `$padj` |\n| QL F p-values numerically different from a 2023 paper | edgeR v4 default `legacy=FALSE` | Set `legacy=TRUE` to reproduce v3, or note the version change |\n\n## References\n\n- Robinson MD, McCarthy DJ, Smyth GK. 2010. edgeR: a Bioconductor package for differential expression analysis of digital gene expression data. *Bioinformatics* 26(1):139-140. doi:10.1093\u002Fbioinformatics\u002Fbtp616\n- McCarthy DJ, Chen Y, Smyth GK. 2012. Differential expression analysis of multifactor RNA-Seq experiments with respect to biological variation. *Nucleic Acids Res* 40(10):4288-4297. doi:10.1093\u002Fnar\u002Fgks042\n- Chen Y, Lun ATL, Smyth GK. 2016. From reads to genes to pathways: differential expression analysis of RNA-Seq experiments using Rsubread and the edgeR quasi-likelihood pipeline. *F1000Res* 5:1438. doi:10.12688\u002Ff1000research.8987.2\n- Chen Y, Chen L, Lun ATL, Baldoni PL, Smyth GK. 2025. edgeR v4: powerful differential analysis of sequencing data with expanded functionality and improved support for small counts and larger datasets. *Nucleic Acids Res* 53(2):gkaf018. doi:10.1093\u002Fnar\u002Fgkaf018\n- Lund SP, Nettleton D, McCarthy DJ, Smyth GK. 2012. Detecting differential expression in RNA-sequence data using quasi-likelihood with shrunken dispersion estimates. *Stat Appl Genet Mol Biol* 11(5):Article 8. doi:10.1515\u002F1544-6115.1826\n- Phipson B, Lee S, Majewski IJ, Alexander WS, Smyth GK. 2016. Robust hyperparameter estimation protects against hypervariable genes and improves power to detect differential expression. *Ann Appl Stat* 10(2):946-963. doi:10.1214\u002F16-AOAS920\n- Law CW, Chen Y, Shi W, Smyth GK. 2014. voom: precision weights unlock linear model analysis tools for RNA-seq read counts. *Genome Biol* 15(2):R29. doi:10.1186\u002Fgb-2014-15-2-r29\n- Liu R, Holik AZ, Su S, Jansz N, Chen K, Leong HS, Blewitt ME, Asselin-Labat M-L, Smyth GK, Ritchie ME. 2015. Why weight? Modelling sample and observational level variability improves power in RNA-seq analyses. *Nucleic Acids Res* 43(15):e97. doi:10.1093\u002Fnar\u002Fgkv412\n- McCarthy DJ, Smyth GK. 2009. Testing significance relative to a fold-change threshold is a TREAT. *Bioinformatics* 25(6):765-771. doi:10.1093\u002Fbioinformatics\u002Fbtp053\n- Baldoni PL, Chen Y, Hediyeh-zadeh S, Liao Y, Dong X, Ritchie ME, Shi W, Smyth GK. 2024. Dividing out quantification uncertainty allows efficient assessment of differential transcript expression with edgeR. *Nucleic Acids Res* 52(3):e13. doi:10.1093\u002Fnar\u002Fgkad1167\n- Ritchie ME, Phipson B, Wu D, Hu Y, Law CW, Shi W, Smyth GK. 2015. limma powers differential expression analyses for RNA-sequencing and microarray studies. *Nucleic Acids Res* 43(7):e47. doi:10.1093\u002Fnar\u002Fgkv007\n- Schurch NJ et al. 2016. How many biological replicates are needed in an RNA-seq experiment and which differential expression tool should you use? *RNA* 22(6):839-851. doi:10.1261\u002Frna.053959.115\n- Robinson MD, Oshlack A. 2010. A scaling normalization method for differential expression analysis of RNA-seq data. *Genome Biol* 11(3):R25. doi:10.1186\u002Fgb-2010-11-3-r25\n\n## Related Skills\n\n- deseq2-basics - Cross-check, or use when LFC shrinkage (apeglm) needed\n- de-results - FDR, IHW, GSEA preparation, padj column name variation\n- de-visualization - BCV plot, MD plot, PCA via plotMDS\n- batch-correction - Include batch in design vs correct-then-test cardinal sin\n- timeseries-de - voom + splines for time-course\n- expression-matrix\u002Fcounts-ingest - Salmon\u002Fkallisto input via tximport or catchSalmon\n- expression-matrix\u002Fnormalization - TMM\u002FTMMwsp\u002FRLE mechanics\n- expression-matrix\u002Fmetadata-joins - Reference level, paired design, interaction parameterization\n- expression-matrix\u002Fgene-id-mapping - Annotating DE results with symbols\n- rna-quantification\u002Ftximport-workflow - Detailed tximport mechanics\n- pathway-analysis\u002Fgsea - Ranked-list input from DE\n",{"name":5,"source":24,"license":15,"tool_type":25,"description":7,"imported_at":26,"source_path":27,"primary_tool":28,"source_repository":29},"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills","r","2026-09-20","differential-expression\u002Fedger-basics\u002FSKILL.md","edgeR","GPTomics\u002FbioSkills","main","2d1750717747097b602acf30bd09a7cbd4b4c6ea","awesome_skills\u002Fbiology\u002Fbio-differential-expression-edger-basics","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous","2026-11-09 11:45:36",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-differential-expression-edger-basics",{"tool":42,"command":43},"bunx","bunx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-differential-expression-edger-basics",{"tool":45,"command":46},"pnpm","pnpm dlx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-differential-expression-edger-basics","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-differential-expression-edger-basics\u002FSKILL.md",true,[50,56,60,64],{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"examples\u002Fbasic_workflow.R","OTHER","其他",1344,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-differential-expression-edger-basics\u002Fexamples\u002Fbasic_workflow.R",{"path":57,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":58,"sourceHtmlUrl":59},"examples\u002Fbatch_correction.R",1341,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-differential-expression-edger-basics\u002Fexamples\u002Fbatch_correction.R",{"path":61,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":62,"sourceHtmlUrl":63},"examples\u002Fcontrasts.R",1499,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-differential-expression-edger-basics\u002Fexamples\u002Fcontrasts.R",{"path":65,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":68,"sourceHtmlUrl":69},"usage-guide.md","REFERENCE","参考文档",3350,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-differential-expression-edger-basics\u002Fusage-guide.md",[71,79,86,93,100,107],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":78},"01M7FFFZPC2025JQQHPHDX154J","dei-assessment","Assess diversity, equity, and inclusion with metrics. TRIGGERS - Use when user needs help with dei-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-assessment\u002FSKILL.md",[],[],"2026-11-16 10:05:34",{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":78},"01M7FFFWN8H4WA7A6Y398QKB6J","dei-action-plan","Create DEI action plans with goals and initiatives. TRIGGERS - Use when user needs help with dei-action-plan related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-action-plan\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":78},"01M7FFFSHTM0QZRVZ2NRJTJ0PY","culture-fit-assessment","Design culture add assessment processes. TRIGGERS - Use when user needs help with culture-fit-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fculture-fit-assessment\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":78},"01M7FFFMA12RKEQA38KHJSXXPS","cowork-to-code-bridge","Use an already-installed, independently verified cowork-to-code bridge to run narrowly approved actions on the user's own macOS, Linux, or WSL2 machine through a local file queue.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcowork-to-code-bridge\u002FSKILL.md",[],[],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":78},"01M7FFFH1F6M8YRGW5V487GH1K","counter-offer-response","Draft counter-offer responses for retention. TRIGGERS - Use when user needs help with counter-offer-response related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcounter-offer-response\u002FSKILL.md",[],[],{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":78},"01M7FFFDGEHV8Y7J9N40HZXW52","continuous-feedback-system","Design continuous feedback systems. TRIGGERS - Use when user needs help with continuous-feedback-system related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcontinuous-feedback-system\u002FSKILL.md",[],[]]