[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ECV1E354DC1MNZT2F24GCF":3,"skill-same:01M7ECV1E354DC1MNZT2F24GCF":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},"01M7ECV1E354DC1MNZT2F24GCF","bio-differential-expression-de-results",null,"Extracts, filters, annotates, and exports differential expression results from DESeq2 or edgeR with proper handling of padj=NA (independent filtering, Cook's outliers, all-zero), multiple-testing correction choice (BH vs Storey q-value vs IHW vs lfsr), TREAT vs post-hoc fold-change filtering, p-value histogram diagnostics, gene annotation via org.db\u002FbiomaRt\u002Fmygene, GSEA preranked input, ORA background construction, replication reality (Schurch 2016 small-n result), and SABV\u002Fsex-stratified reporting. Use when extracting and interpreting DE results, troubleshooting padj=NA, choosing FDR method, preparing ranked lists for pathway analysis, annotating gene IDs, or comparing DESeq2 vs edgeR outputs.","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-de-results\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bio-differential-expression-de-results\ndescription: Extracts, filters, annotates, and exports differential expression results from DESeq2 or edgeR with proper handling of padj=NA (independent filtering, Cook's outliers, all-zero), multiple-testing correction choice (BH vs Storey q-value vs IHW vs lfsr), TREAT vs post-hoc fold-change filtering, p-value histogram diagnostics, gene annotation via org.db\u002FbiomaRt\u002Fmygene, GSEA preranked input, ORA background construction, replication reality (Schurch 2016 small-n result), and SABV\u002Fsex-stratified reporting. Use when extracting and interpreting DE results, troubleshooting padj=NA, choosing FDR method, preparing ranked lists for pathway analysis, annotating gene IDs, or comparing DESeq2 vs edgeR outputs.\ntool_type: r\nprimary_tool: DESeq2\nsource: \"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills\"\nsource_repository: \"GPTomics\u002FbioSkills\"\nsource_path: \"differential-expression\u002Fde-results\u002FSKILL.md\"\nlicense: \"MIT\"\nimported_at: \"2026-09-20\"\n---\n\n## Version Compatibility\n\nReference examples tested with: DESeq2 1.42+, edgeR 4.0+, IHW 1.34+, qvalue 2.34+, ashr 2.2+, AnnotationDbi 1.66+, org.Hs.eg.db 3.18+, biomaRt 2.58+, mygene 1.38+ (Python), dplyr 1.1+, openxlsx 4.2+\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- R: `packageVersion('\u003Cpkg>')` then `?function_name` to verify parameters\n- Python: `pip show \u003Cpackage>` then `help(module.function)` to check signatures\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# DE Results\n\n**\"What are my significant genes?\"** -> Extract DE estimates and p-values from the fitted model, handle missing padj correctly, apply FDR control appropriate to the design, and produce the table or ranked list the downstream tool actually needs.\n\n## The Single Most Important Modern Insight -- `padj = NA` has three distinct meanings\n\nA `NA` in the `padj` column is not a missing value; it is a flag indicating which filter excluded the gene. The three causes -- independent filtering, Cook's distance outlier, and all-zero in a group -- have completely different remediations. Dropping all NA rows blindly silently discards real signal, most often from low-count master regulators (transcription factors expressed at ~10 counts) that pass biology but fail the data-driven baseMean threshold.\n\n| `padj = NA` cause | DESeq2 detection | What it means | Fix if undesired |\n|-------------------|------------------|---------------|-------------------|\n| Independent filtering | finite `pvalue`, `NA` `padj`, baseMean below auto threshold | Removed before BH adjustment to maximize rejections at `alpha` | `results(dds, independentFiltering = FALSE)` OR `filterFun = ihw` |\n| Cook's distance outlier | `NA` `pvalue`, `NA` `padj`, baseMean > 0, group has >=3 reps | One sample has Cook's > `qf(0.99, p, m-p)` | `results(dds, cooksCutoff = FALSE)` |\n| All-zero or near-zero in a group | `NA` `pvalue` AND baseMean very low | Insufficient information to test | Filter at preprocess time; or accept |\n\nIndependent filtering (Bourgon, Gentleman, Huber 2010 *PNAS* 107:9546) chooses the baseMean threshold to maximize rejections. The filter MUST be independent of the test statistic under the null -- this is why baseMean (the across-sample mean) is the canonical choice. Using \"min count in treatment group\" as a filter VIOLATES the independence requirement and inflates type-I error. Most pipelines unknowingly do this; do not.\n\nA second axis: at n>=7 per group, `DESeq()` also REPLACES outlier counts via `replaceOutliers()` and refits (default `minReplicatesForReplace = 7`). Cook's filtering is NOT computed for continuous covariates -- a continuous-covariate analysis has effectively no outlier filtering.\n\n## Algorithmic Taxonomy\n\n| Method | What it computes | When to use | Failure mode |\n|--------|------------------|-------------|--------------|\n| BH (`p.adjust(method='BH')`, DESeq2 default `pAdjustMethod='BH'`) | FDR at fixed alpha; Benjamini-Hochberg 1995 | Default for most RNA-seq DE | Assumes independence or PRDS; many overlapping tests violate |\n| Storey q-value (`qvalue::qvalue`) | q-value using estimated pi_0 | Genome-scale with many true nulls | Pi_0 estimation can fail at small test counts |\n| IHW (`results(filterFun=ihw)`, Ignatiadis 2016 *Nat Methods* 13:577) | Weighted BH with covariate-informed weights | Modern default for DESeq2; +5-20% discoveries at same FDR | Covariate MUST be independent under null |\n| ashr local false sign rate (`lfsr` \u002F `svalue`, with `svalue=TRUE`) | P(sign of estimate is wrong) | When effect-direction certainty is what matters | Conservative lower bound on FDR; not interchangeable with padj |\n| BY (`p.adjust(method='BY')`) | Benjamini-Yekutieli; arbitrary dependence | Strongly correlated tests | Uniformly conservative; rarely needed for DE |\n| Holm \u002F Bonferroni | FWER | Small confirmatory test sets | Far too conservative for genome-scale |\n| TREAT \u002F `lfcThreshold=` | FDR for \"|LFC| > tau\" hypothesis | Pre-specified biologically meaningful threshold | tau must be set BEFORE looking at data |\n\n## Decision Tree by Scenario\n\n| Scenario | Recommended approach | Why |\n|----------|---------------------|-----|\n| Standard bulk DE, two groups | DESeq2 results with default BH; report padj \u003C 0.05 | Default works |\n| Want more power at same FDR | `results(dds, filterFun = ihw)` | IHW typically gains 5-20% |\n| Pre-specified biological fold-change matters | `results(dds, lfcThreshold = log2(1.5), altHypothesis = 'greaterAbs')` OR `glmTreat(fit, lfc = log2(1.5))` | Post-hoc `padj\u003C0.05 & abs(LFC)>1` does NOT control FDR for the magnitude claim |\n| Ranking for GSEA preranked | `stat` (Wald Z) for DESeq2 OR shrunken LFC | Never use unshrunken LFC -- low-count noise dominates |\n| ORA input | Subset by padj\u003C0.05; background = ALL TESTED genes (post-independent-filtering) | Background = \"all genes in genome\" is wrong; pre-filtering already excluded many |\n| Many NA padj including biologically interesting genes | Diagnose: independent filtering vs Cook's vs all-zero; turn off the offending filter only for that gene set | Blanket `na.omit` discards signal |\n| Multi-condition design | LRT for \"any change\" first; pairwise per-level Wald for effect sizes | LRT padj is omnibus; LRT LFC is one specific coefficient |\n| Small n (\u003C=3\u002Fgroup) | Report as exploratory, top hits only | Schurch 2016: tools miss 20-40% of true positives at n=3 |\n| Human \u002F mouse with mixed sexes | Include sex as covariate; run sex-stratified sensitivity | SABV mandate; sex effect is real and chromosomal |\n| Prokaryotic | Use Prokka\u002FBakta GFF, KEGG strain code | Ensembl\u002Forg.db are eukaryote-only |\n\n## Extracting Results\n\n**Goal:** Pull DE estimates and p-values from a fitted DESeq2 or edgeR object into a usable data frame with explicit contrast naming.\n\n**Approach:** `results()` (DESeq2) or `topTags()` (edgeR) with explicit `name=` \u002F `coef=`; convert to data.frame; preserve row order if planning to join with annotation.\n\n```r\nlibrary(DESeq2)\nlibrary(dplyr)\n\nresultsNames(dds)\nres \u003C- results(dds, name = 'condition_treated_vs_control', alpha = 0.05)\nres_shrunk \u003C- lfcShrink(dds, coef = 'condition_treated_vs_control', type = 'apeglm')\n\nres_df \u003C- as.data.frame(res)\nres_df$gene \u003C- rownames(res_df)\n```\n\n```r\nlibrary(edgeR)\ntt \u003C- topTags(qlf, n = Inf, sort.by = 'none')$table\ntt$gene \u003C- rownames(tt)\n```\n\n`sort.by = 'none'` in `topTags` preserves the original gene order -- critical when joining with an annotation table by row index. Default is sort by p-value.\n\nColumn name reminder (a recurring cross-tool bug):\n\n| Tool | LFC column | Adjusted p-value column |\n|------|------------|------------------------|\n| DESeq2 | `log2FoldChange` | `padj` |\n| edgeR | `logFC` | `FDR` |\n| limma `topTable` | `logFC` | `adj.P.Val` |\n| limma `topTreat` | `logFC` | `adj.P.Val` (post-TREAT) |\n\n## TREAT vs Post-hoc LFC Filtering\n\n**Goal:** Make a defensible FDR claim about \"biologically meaningful fold change\" genes.\n\n**Approach:** Use TREAT or `lfcThreshold=` to test a magnitude hypothesis with proper FDR control. Post-hoc filtering of `padj\u003C0.05 & abs(LFC)>tau` does NOT control FDR for the magnitude claim.\n\n```r\nres_treat \u003C- results(dds, lfcThreshold = log2(1.5), altHypothesis = 'greaterAbs', alpha = 0.05)\n\n# edgeR equivalent\ntr \u003C- glmTreat(fit, coef = 2, lfc = log2(1.5))\n```\n\nWhat a reviewer is really probing with a \"200 genes >2x changed at FDR 5%\" claim: is the FDR for the change>2x claim or for the change-non-zero claim? Post-hoc filtering controls FDR only for the latter. TREAT (or `lfcThreshold=`) controls FDR for the former. McCarthy & Smyth 2009 *Bioinformatics* 25:765 is the canonical citation.\n\n## IHW for Better Power\n\n**Goal:** Gain 5-20% more discoveries at the same FDR by weighting p-values with a covariate (typically baseMean) that informs power but is independent of the null.\n\n**Approach:** `results(dds, filterFun = ihw)` replaces independent filtering with Ignatiadis 2016 hypothesis weighting.\n\n```r\nlibrary(IHW)\nres_ihw \u003C- results(dds, filterFun = ihw, alpha = 0.05)\n```\n\nWhen IHW does NOT help:\n- Small number of tests (\u003C5000 after filtering) -- not enough data to learn weights\n- Covariate is treatment-correlated (violates the null-independence requirement)\n- Covariate uninformative about test power\n\nStorey q-value as an alternative (different framework -- estimates pi_0 fraction of true nulls):\n\n```r\nlibrary(qvalue)\nqv \u003C- qvalue(res$pvalue[!is.na(res$pvalue)])\nres$qvalue \u003C- NA\nres$qvalue[!is.na(res$pvalue)] \u003C- qv$qvalues\n```\n\nashr lfsr (local false sign rate -- probability the estimated direction is wrong):\n\n```r\nres_ashr \u003C- lfcShrink(dds, coef = 'condition_treated_vs_control',\n                       type = 'ashr', svalue = TRUE)\nres_ashr$svalue  # FDR-like, based on lfsr; requires svalue=TRUE\n```\n\n`svalue=TRUE` is required to populate the `svalue` column; the default returns the standard `pvalue`\u002F`padj` columns only. lfsr and padj are NOT interchangeable. lfsr asks \"P(sign wrong)\"; padj asks \"expected fraction of false discoveries\". When reporting, state which.\n\n## P-value Histogram Diagnostics\n\n**Goal:** Diagnose model misspecification, hidden batch effects, or over-correction by inspecting the raw p-value distribution.\n\n**Approach:** Plot raw p-values; under a correctly specified null, the histogram is uniform with an upward spike near zero (the true DE genes).\n\n```r\nlibrary(ggplot2)\nggplot(res_df, aes(x = pvalue)) +\n    geom_histogram(bins = 50, fill = 'steelblue', color = 'white') +\n    labs(x = 'P-value', y = 'Frequency', title = 'P-value distribution') +\n    theme_bw()\n```\n\n| Shape | Meaning | Action |\n|-------|---------|--------|\n| Uniform + spike near 0 | Correct: null genes uniform, true DE near 0 | Proceed |\n| Anti-conservative (U-shape; both ends spiked) | Hidden batch effect, unmodeled confounder, dispersion misspecified | Inspect PCA for batch; add covariate; check `plotDispEsts` |\n| Conservative (depleted near 0, spike near 1) | Over-correction; too many covariates; wrong dispersion | Simplify model; check dispersion plot for excess shrinkage |\n| Spike only at p = 1 | Discrete artifact from very-low-count genes | Pre-filter more aggressively |\n| Bimodal with spike at 0.5 | Unusual; suggests a discrete categorical test masquerading | Investigate |\n\nThe histogram is one of the cheapest sanity checks in a DE pipeline; always plot it before believing the gene list.\n\n## Filtering and Ordering\n\n**Goal:** Subset to significant genes and rank by p-value, fold change, or expression level for downstream use.\n\n**Approach:** dplyr-style filter + arrange; handle NA padj explicitly per the three-meanings table at the top.\n\n```r\nsig \u003C- res_df %>%\n    filter(!is.na(padj), padj \u003C 0.05, abs(log2FoldChange) > 1, baseMean > 10) %>%\n    arrange(padj)\n\n# Up- vs down-regulated\nup   \u003C- sig %>% filter(log2FoldChange > 0)\ndown \u003C- sig %>% filter(log2FoldChange \u003C 0)\n\n# Summary\nn_tested \u003C- sum(!is.na(res$padj))\nn_sig    \u003C- sum(res$padj \u003C 0.05, na.rm = TRUE)\ncat(sprintf('Tested: %d   Significant (padj\u003C0.05): %d   Up: %d   Down: %d\\n',\n            n_tested, n_sig, sum(sig$log2FoldChange > 0), sum(sig$log2FoldChange \u003C 0)))\n```\n\n## Gene Annotation\n\n**Goal:** Map gene IDs to symbols, descriptions, and cross-database identifiers for human-readable results.\n\n**Approach:** Prefer `AnnotationDbi::mapIds` with org.db (fast, local, version-pinned); fall back to biomaRt or mygene for symbols\u002Faliases not in org.db; for prokaryotes, use Prokka\u002FBakta GFF.\n\n```r\nlibrary(org.Hs.eg.db)\nlibrary(AnnotationDbi)\n\nres_df$symbol \u003C- mapIds(org.Hs.eg.db, keys = sub('\\\\..*', '', res_df$gene),\n                         keytype = 'ENSEMBL', column = 'SYMBOL', multiVals = 'first')\nres_df$entrez \u003C- mapIds(org.Hs.eg.db, keys = sub('\\\\..*', '', res_df$gene),\n                         keytype = 'ENSEMBL', column = 'ENTREZID', multiVals = 'first')\n```\n\nThe `sub('\\\\..*', '', ...)` strips the Ensembl version. CAUTION: this regex destroys the `_PAR_Y` suffix in GENCODE 25-43 PAR genes -- use `sub('\\\\.[0-9]+(_PAR_Y)?$', '\\\\1', ...)` to preserve. See `expression-matrix\u002Fgene-id-mapping` for full details.\n\nFor HGNC symbols changed since 2020 (`SEPT1` -> `SEPTIN1`, `MARCH1` -> `MARCHF1`, `MARC1` -> `MTARC1`, `DEC1` -> `DELEC1`) old symbol-keyed downstream tools silently drop genes. Always join on stable Ensembl or Entrez IDs; use symbols as display labels only.\n\nFor prokaryotes:\n\n```r\nlibrary(rtracklayer)\ngff \u003C- import('annotation.gff3')\ngene_info \u003C- as.data.frame(gff[gff$type == 'gene',\n                                c('locus_tag', 'Name', 'product')])\nres_annotated \u003C- merge(res_df, gene_info, by.x = 'gene',\n                        by.y = 'locus_tag', all.x = TRUE)\n```\n\n## GSEA Preranked Input\n\n**Goal:** Produce a ranked list of all genes (no significance filter) for fgsea \u002F clusterProfiler GSEA.\n\n**Approach:** Rank by Wald statistic (DESeq2 `stat`) or shrunken LFC. NEVER use a filtered set as GSEA input -- GSEA's permutation null requires the full background.\n\n```r\ngsea_ranks \u003C- res_df$stat\nnames(gsea_ranks) \u003C- res_df$gene\ngsea_ranks \u003C- sort(gsea_ranks[!is.na(gsea_ranks)], decreasing = TRUE)\n\n# edgeR equivalent\ngsea_ranks_edger \u003C- sign(tt$logFC) * -log10(tt$PValue)\nnames(gsea_ranks_edger) \u003C- rownames(tt)\ngsea_ranks_edger \u003C- sort(gsea_ranks_edger[is.finite(gsea_ranks_edger)],\n                         decreasing = TRUE)\n```\n\n`stat` (Wald Z) is preferred over raw LFC for GSEA because it combines effect and precision in one number. Unshrunken LFC is dominated by low-count noise.\n\n## ORA Input\n\n**Goal:** Run over-representation analysis (enrichGO, enrichKEGG) on a significant gene list with the correct background.\n\n**Approach:** Subset to padj\u003C0.05; background = ALL TESTED genes (post-independent-filtering), NOT the genome.\n\n```r\nlibrary(clusterProfiler)\n\nsig_entrez \u003C- na.omit(res_df$entrez[res_df$padj \u003C 0.05])\nbg_entrez  \u003C- na.omit(res_df$entrez[!is.na(res_df$padj)])\n\nora \u003C- enrichGO(gene          = sig_entrez,\n                universe      = bg_entrez,\n                OrgDb         = org.Hs.eg.db,\n                keyType       = 'ENTREZID',\n                ont           = 'BP',\n                pAdjustMethod = 'BH')\n```\n\nCommon mistake: omitting `universe=` lets clusterProfiler default to \"all annotated genes for this organism\" -- which includes thousands of genes never tested. The resulting enrichment p-values are wrong (too small). The background MUST be the tested set.\n\n## Cross-Tool Concordance Check\n\n```r\ndeseq2_sig \u003C- rownames(subset(deseq2_res, padj \u003C 0.05))\nedger_sig  \u003C- rownames(subset(edger_tt,  FDR  \u003C 0.05))\n\ncommon      \u003C- intersect(deseq2_sig, edger_sig)\ndeseq2_only \u003C- setdiff(deseq2_sig, edger_sig)\nedger_only  \u003C- setdiff(edger_sig, deseq2_sig)\n\ncat(sprintf('DESeq2 sig: %d   edgeR sig: %d   Common: %d (%.1f%%)\\n',\n            length(deseq2_sig), length(edger_sig), length(common),\n            100 * length(common) \u002F min(length(deseq2_sig), length(edger_sig))))\n```\n\nConcordance >70% at the top 500: robust. \u003C60%: suspect filtering, normalization, or design difference -- not a tool difference. Run both pipelines with the same filtering and design to isolate.\n\n## Per-Method Failure Modes\n\n### Dropped a key gene by removing NAs\n\n**Trigger:** Pipeline does `res_df \u003C- na.omit(res_df)`; downstream gene of interest is missing from results.\n\n**Mechanism:** Gene was flagged by independent filtering OR Cook's distance; padj is NA but the biology is real.\n\n**Symptom:** A gene with clear differential expression in the count matrix is absent from the results table.\n\n**Fix:** Diagnose which filter fired (independent filtering vs Cook's vs all-zero); rerun `results()` with the appropriate filter off (`independentFiltering = FALSE` or `cooksCutoff = FALSE`).\n\n### Reported FDR on a magnitude-filtered gene set\n\n**Trigger:** Methods section says \"genes with padj \u003C 0.05 and abs(LFC) > 1 (FDR \u003C 5%)\".\n\n**Mechanism:** BH controls FDR for the |LFC| > 0 hypothesis, not the |LFC| > 1 hypothesis. The post-hoc filter adds no FDR control.\n\n**Symptom:** Reviewer challenges the FDR claim; replication studies show many of the filtered genes are not the magnitude expected.\n\n**Fix:** Use TREAT (`glmTreat`) or `lfcThreshold=` to test the magnitude hypothesis with proper FDR control. Re-do the methods sentence to match what was actually computed.\n\n### ORA universe wrong\n\n**Trigger:** ORA p-values look implausibly small for a small significant gene set.\n\n**Mechanism:** `universe=` argument omitted; clusterProfiler defaulted to all annotated genes in the organism, including thousands never in the tested set.\n\n**Symptom:** Many enriched pathways at strict thresholds; results don't replicate; reviewer questions the background.\n\n**Fix:** Explicitly pass `universe = bg_entrez` where `bg_entrez` is the set of tested gene IDs (i.e., those with non-NA padj).\n\n### \"Significant\" gene list in n=3 study doesn't replicate\n\n**Trigger:** Small RNA-seq study finds 200 DE genes; validation in independent cohort recovers 60.\n\n**Mechanism:** Schurch 2016 *RNA* 22:839: at n=3\u002Fgroup, all tools miss 20-40% of true positives compared to n=30. Variability of the gene list itself is high.\n\n**Symptom:** 30-50% replication of the gene list across independent runs of the SAME data.\n\n**Fix:** Frame the small-n DE list as hypothesis-generating, not as a stable set of facts. Validate top hits orthogonally before drawing conclusions. Use TREAT for biologically meaningful thresholds to require larger effects.\n\n### Sex-confounded design gives spurious chrX\u002FchrY signal\n\n**Trigger:** Mixed-sex cohort; sex not in the design; many chrY genes call as DE.\n\n**Mechanism:** Sex distribution differs across the experimental groups; the \"treatment effect\" partially captures sex.\n\n**Symptom:** chrY genes (DDX3Y, RPS4Y1, UTY) and XIST dominate the top DE list.\n\n**Fix:** Include sex in the design (`~ sex + condition`); rerun. For chrX\u002FchrY-specific analyses, sex MUST be in the model or the analysis is uninterpretable. Mauvais-Jarvis et al. 2020 *Lancet* 396:565 reviews the SABV requirement.\n\n## Common errors\n\n| Error \u002F symptom | Cause | Fix |\n|-----------------|-------|-----|\n| `$FDR` not found on DESeq2 result | DESeq2 uses `padj`; edgeR uses `FDR` | Check tool, use correct column |\n| `summary(res)` shows different cutoff than `results(alpha=)` | `summary(res, alpha=)` defaults to 0.1 | Pass `alpha` explicitly to `summary()` |\n| All `padj` NA | All genes filtered (rare; usually a data problem) | Check `independentFilteringResults(res)`; inspect baseMean distribution |\n| Direction of LFC reversed | Reference level not set; alphabetical default | `relevel()` BEFORE `DESeq()` |\n| Gene symbol mapping rate \u003C50% | Mixed Ensembl versions; recent HGNC renames | Verify Ensembl release, check for SEPT\u002FMARCH\u002FMARC renames |\n| `enrichGO` reports thousands of pathways | Wrong `universe=` | Pass `universe = bg_entrez` (tested set, not genome) |\n\n## References\n\n- Benjamini Y, Hochberg Y. 1995. Controlling the false discovery rate: a practical and powerful approach to multiple testing. *J R Stat Soc Ser B* 57(1):289-300. doi:10.1111\u002Fj.2517-6161.1995.tb02031.x\n- Storey JD. 2003. The positive false discovery rate: a Bayesian interpretation and the q-value. *Ann Stat* 31(6):2013-2035. doi:10.1214\u002Faos\u002F1074290335\n- Ignatiadis N, Klaus B, Zaugg JB, Huber W. 2016. Data-driven hypothesis weighting increases detection power in genome-scale multiple testing. *Nat Methods* 13(7):577-580. doi:10.1038\u002Fnmeth.3885\n- Bourgon R, Gentleman R, Huber W. 2010. Independent filtering increases detection power for high-throughput experiments. *PNAS* 107(21):9546-9551. doi:10.1073\u002Fpnas.0914005107\n- Stephens M. 2017. False discovery rates: a new deal. *Biostatistics* 18(2):275-294. doi:10.1093\u002Fbiostatistics\u002Fkxw041\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- 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- Love MI, Huber W, Anders S. 2014. Moderated estimation of fold change and dispersion for RNA-seq data with DESeq2. *Genome Biol* 15(12):550. doi:10.1186\u002Fs13059-014-0550-8\n- Mauvais-Jarvis F et al. 2020. Sex and gender: modifiers of health, disease, and medicine. *Lancet* 396(10250):565-582. doi:10.1016\u002FS0140-6736(20)31561-0\n- Bruford EA et al. 2020. Guidelines for human gene nomenclature. *Nat Genet* 52:754-758. doi:10.1038\u002Fs41588-020-0669-3\n- Ziemann M, Eren Y, El-Osta A. 2016. Gene name errors are widespread in the scientific literature. *Genome Biol* 17:177. doi:10.1186\u002Fs13059-016-1044-7\n- Wu T et al. 2021. clusterProfiler 4.0: A universal enrichment tool for interpreting omics data. *The Innovation* 2(3):100141. doi:10.1016\u002Fj.xinn.2021.100141\n\n## Related Skills\n\n- deseq2-basics - Generate DESeq2 results; design, contrasts, LRT, shrinkage\n- edger-basics - Generate edgeR results; QL F-test, TREAT, voom\n- de-visualization - P-value histogram, MA plot, volcano with shrunken LFC, heatmap, sample distance\n- batch-correction - Include batch in design (vs Nygaard 2016 cardinal sin)\n- timeseries-de - LRT-with-reduced-model patterns for time\n- expression-matrix\u002Fgene-id-mapping - ID conversion, HGNC renames, ortholog mapping\n- expression-matrix\u002Fmetadata-joins - Sex covariate, paired design, sample swap detection\n- pathway-analysis\u002Fgo-enrichment - ORA with proper background\n- pathway-analysis\u002Fgsea - GSEA preranked input from `stat` or shrunken LFC\n- pathway-analysis\u002Fkegg-pathways - KEGG with strain-specific organism codes\n- data-visualization\u002Fvolcano-and-ma-plots - Custom volcano with apeglm-shrunken LFC\n","## Version Compatibility\n\nReference examples tested with: DESeq2 1.42+, edgeR 4.0+, IHW 1.34+, qvalue 2.34+, ashr 2.2+, AnnotationDbi 1.66+, org.Hs.eg.db 3.18+, biomaRt 2.58+, mygene 1.38+ (Python), dplyr 1.1+, openxlsx 4.2+\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- R: `packageVersion('\u003Cpkg>')` then `?function_name` to verify parameters\n- Python: `pip show \u003Cpackage>` then `help(module.function)` to check signatures\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# DE Results\n\n**\"What are my significant genes?\"** -> Extract DE estimates and p-values from the fitted model, handle missing padj correctly, apply FDR control appropriate to the design, and produce the table or ranked list the downstream tool actually needs.\n\n## The Single Most Important Modern Insight -- `padj = NA` has three distinct meanings\n\nA `NA` in the `padj` column is not a missing value; it is a flag indicating which filter excluded the gene. The three causes -- independent filtering, Cook's distance outlier, and all-zero in a group -- have completely different remediations. Dropping all NA rows blindly silently discards real signal, most often from low-count master regulators (transcription factors expressed at ~10 counts) that pass biology but fail the data-driven baseMean threshold.\n\n| `padj = NA` cause | DESeq2 detection | What it means | Fix if undesired |\n|-------------------|------------------|---------------|-------------------|\n| Independent filtering | finite `pvalue`, `NA` `padj`, baseMean below auto threshold | Removed before BH adjustment to maximize rejections at `alpha` | `results(dds, independentFiltering = FALSE)` OR `filterFun = ihw` |\n| Cook's distance outlier | `NA` `pvalue`, `NA` `padj`, baseMean > 0, group has >=3 reps | One sample has Cook's > `qf(0.99, p, m-p)` | `results(dds, cooksCutoff = FALSE)` |\n| All-zero or near-zero in a group | `NA` `pvalue` AND baseMean very low | Insufficient information to test | Filter at preprocess time; or accept |\n\nIndependent filtering (Bourgon, Gentleman, Huber 2010 *PNAS* 107:9546) chooses the baseMean threshold to maximize rejections. The filter MUST be independent of the test statistic under the null -- this is why baseMean (the across-sample mean) is the canonical choice. Using \"min count in treatment group\" as a filter VIOLATES the independence requirement and inflates type-I error. Most pipelines unknowingly do this; do not.\n\nA second axis: at n>=7 per group, `DESeq()` also REPLACES outlier counts via `replaceOutliers()` and refits (default `minReplicatesForReplace = 7`). Cook's filtering is NOT computed for continuous covariates -- a continuous-covariate analysis has effectively no outlier filtering.\n\n## Algorithmic Taxonomy\n\n| Method | What it computes | When to use | Failure mode |\n|--------|------------------|-------------|--------------|\n| BH (`p.adjust(method='BH')`, DESeq2 default `pAdjustMethod='BH'`) | FDR at fixed alpha; Benjamini-Hochberg 1995 | Default for most RNA-seq DE | Assumes independence or PRDS; many overlapping tests violate |\n| Storey q-value (`qvalue::qvalue`) | q-value using estimated pi_0 | Genome-scale with many true nulls | Pi_0 estimation can fail at small test counts |\n| IHW (`results(filterFun=ihw)`, Ignatiadis 2016 *Nat Methods* 13:577) | Weighted BH with covariate-informed weights | Modern default for DESeq2; +5-20% discoveries at same FDR | Covariate MUST be independent under null |\n| ashr local false sign rate (`lfsr` \u002F `svalue`, with `svalue=TRUE`) | P(sign of estimate is wrong) | When effect-direction certainty is what matters | Conservative lower bound on FDR; not interchangeable with padj |\n| BY (`p.adjust(method='BY')`) | Benjamini-Yekutieli; arbitrary dependence | Strongly correlated tests | Uniformly conservative; rarely needed for DE |\n| Holm \u002F Bonferroni | FWER | Small confirmatory test sets | Far too conservative for genome-scale |\n| TREAT \u002F `lfcThreshold=` | FDR for \"|LFC| > tau\" hypothesis | Pre-specified biologically meaningful threshold | tau must be set BEFORE looking at data |\n\n## Decision Tree by Scenario\n\n| Scenario | Recommended approach | Why |\n|----------|---------------------|-----|\n| Standard bulk DE, two groups | DESeq2 results with default BH; report padj \u003C 0.05 | Default works |\n| Want more power at same FDR | `results(dds, filterFun = ihw)` | IHW typically gains 5-20% |\n| Pre-specified biological fold-change matters | `results(dds, lfcThreshold = log2(1.5), altHypothesis = 'greaterAbs')` OR `glmTreat(fit, lfc = log2(1.5))` | Post-hoc `padj\u003C0.05 & abs(LFC)>1` does NOT control FDR for the magnitude claim |\n| Ranking for GSEA preranked | `stat` (Wald Z) for DESeq2 OR shrunken LFC | Never use unshrunken LFC -- low-count noise dominates |\n| ORA input | Subset by padj\u003C0.05; background = ALL TESTED genes (post-independent-filtering) | Background = \"all genes in genome\" is wrong; pre-filtering already excluded many |\n| Many NA padj including biologically interesting genes | Diagnose: independent filtering vs Cook's vs all-zero; turn off the offending filter only for that gene set | Blanket `na.omit` discards signal |\n| Multi-condition design | LRT for \"any change\" first; pairwise per-level Wald for effect sizes | LRT padj is omnibus; LRT LFC is one specific coefficient |\n| Small n (\u003C=3\u002Fgroup) | Report as exploratory, top hits only | Schurch 2016: tools miss 20-40% of true positives at n=3 |\n| Human \u002F mouse with mixed sexes | Include sex as covariate; run sex-stratified sensitivity | SABV mandate; sex effect is real and chromosomal |\n| Prokaryotic | Use Prokka\u002FBakta GFF, KEGG strain code | Ensembl\u002Forg.db are eukaryote-only |\n\n## Extracting Results\n\n**Goal:** Pull DE estimates and p-values from a fitted DESeq2 or edgeR object into a usable data frame with explicit contrast naming.\n\n**Approach:** `results()` (DESeq2) or `topTags()` (edgeR) with explicit `name=` \u002F `coef=`; convert to data.frame; preserve row order if planning to join with annotation.\n\n```r\nlibrary(DESeq2)\nlibrary(dplyr)\n\nresultsNames(dds)\nres \u003C- results(dds, name = 'condition_treated_vs_control', alpha = 0.05)\nres_shrunk \u003C- lfcShrink(dds, coef = 'condition_treated_vs_control', type = 'apeglm')\n\nres_df \u003C- as.data.frame(res)\nres_df$gene \u003C- rownames(res_df)\n```\n\n```r\nlibrary(edgeR)\ntt \u003C- topTags(qlf, n = Inf, sort.by = 'none')$table\ntt$gene \u003C- rownames(tt)\n```\n\n`sort.by = 'none'` in `topTags` preserves the original gene order -- critical when joining with an annotation table by row index. Default is sort by p-value.\n\nColumn name reminder (a recurring cross-tool bug):\n\n| Tool | LFC column | Adjusted p-value column |\n|------|------------|------------------------|\n| DESeq2 | `log2FoldChange` | `padj` |\n| edgeR | `logFC` | `FDR` |\n| limma `topTable` | `logFC` | `adj.P.Val` |\n| limma `topTreat` | `logFC` | `adj.P.Val` (post-TREAT) |\n\n## TREAT vs Post-hoc LFC Filtering\n\n**Goal:** Make a defensible FDR claim about \"biologically meaningful fold change\" genes.\n\n**Approach:** Use TREAT or `lfcThreshold=` to test a magnitude hypothesis with proper FDR control. Post-hoc filtering of `padj\u003C0.05 & abs(LFC)>tau` does NOT control FDR for the magnitude claim.\n\n```r\nres_treat \u003C- results(dds, lfcThreshold = log2(1.5), altHypothesis = 'greaterAbs', alpha = 0.05)\n\n# edgeR equivalent\ntr \u003C- glmTreat(fit, coef = 2, lfc = log2(1.5))\n```\n\nWhat a reviewer is really probing with a \"200 genes >2x changed at FDR 5%\" claim: is the FDR for the change>2x claim or for the change-non-zero claim? Post-hoc filtering controls FDR only for the latter. TREAT (or `lfcThreshold=`) controls FDR for the former. McCarthy & Smyth 2009 *Bioinformatics* 25:765 is the canonical citation.\n\n## IHW for Better Power\n\n**Goal:** Gain 5-20% more discoveries at the same FDR by weighting p-values with a covariate (typically baseMean) that informs power but is independent of the null.\n\n**Approach:** `results(dds, filterFun = ihw)` replaces independent filtering with Ignatiadis 2016 hypothesis weighting.\n\n```r\nlibrary(IHW)\nres_ihw \u003C- results(dds, filterFun = ihw, alpha = 0.05)\n```\n\nWhen IHW does NOT help:\n- Small number of tests (\u003C5000 after filtering) -- not enough data to learn weights\n- Covariate is treatment-correlated (violates the null-independence requirement)\n- Covariate uninformative about test power\n\nStorey q-value as an alternative (different framework -- estimates pi_0 fraction of true nulls):\n\n```r\nlibrary(qvalue)\nqv \u003C- qvalue(res$pvalue[!is.na(res$pvalue)])\nres$qvalue \u003C- NA\nres$qvalue[!is.na(res$pvalue)] \u003C- qv$qvalues\n```\n\nashr lfsr (local false sign rate -- probability the estimated direction is wrong):\n\n```r\nres_ashr \u003C- lfcShrink(dds, coef = 'condition_treated_vs_control',\n                       type = 'ashr', svalue = TRUE)\nres_ashr$svalue  # FDR-like, based on lfsr; requires svalue=TRUE\n```\n\n`svalue=TRUE` is required to populate the `svalue` column; the default returns the standard `pvalue`\u002F`padj` columns only. lfsr and padj are NOT interchangeable. lfsr asks \"P(sign wrong)\"; padj asks \"expected fraction of false discoveries\". When reporting, state which.\n\n## P-value Histogram Diagnostics\n\n**Goal:** Diagnose model misspecification, hidden batch effects, or over-correction by inspecting the raw p-value distribution.\n\n**Approach:** Plot raw p-values; under a correctly specified null, the histogram is uniform with an upward spike near zero (the true DE genes).\n\n```r\nlibrary(ggplot2)\nggplot(res_df, aes(x = pvalue)) +\n    geom_histogram(bins = 50, fill = 'steelblue', color = 'white') +\n    labs(x = 'P-value', y = 'Frequency', title = 'P-value distribution') +\n    theme_bw()\n```\n\n| Shape | Meaning | Action |\n|-------|---------|--------|\n| Uniform + spike near 0 | Correct: null genes uniform, true DE near 0 | Proceed |\n| Anti-conservative (U-shape; both ends spiked) | Hidden batch effect, unmodeled confounder, dispersion misspecified | Inspect PCA for batch; add covariate; check `plotDispEsts` |\n| Conservative (depleted near 0, spike near 1) | Over-correction; too many covariates; wrong dispersion | Simplify model; check dispersion plot for excess shrinkage |\n| Spike only at p = 1 | Discrete artifact from very-low-count genes | Pre-filter more aggressively |\n| Bimodal with spike at 0.5 | Unusual; suggests a discrete categorical test masquerading | Investigate |\n\nThe histogram is one of the cheapest sanity checks in a DE pipeline; always plot it before believing the gene list.\n\n## Filtering and Ordering\n\n**Goal:** Subset to significant genes and rank by p-value, fold change, or expression level for downstream use.\n\n**Approach:** dplyr-style filter + arrange; handle NA padj explicitly per the three-meanings table at the top.\n\n```r\nsig \u003C- res_df %>%\n    filter(!is.na(padj), padj \u003C 0.05, abs(log2FoldChange) > 1, baseMean > 10) %>%\n    arrange(padj)\n\n# Up- vs down-regulated\nup   \u003C- sig %>% filter(log2FoldChange > 0)\ndown \u003C- sig %>% filter(log2FoldChange \u003C 0)\n\n# Summary\nn_tested \u003C- sum(!is.na(res$padj))\nn_sig    \u003C- sum(res$padj \u003C 0.05, na.rm = TRUE)\ncat(sprintf('Tested: %d   Significant (padj\u003C0.05): %d   Up: %d   Down: %d\\n',\n            n_tested, n_sig, sum(sig$log2FoldChange > 0), sum(sig$log2FoldChange \u003C 0)))\n```\n\n## Gene Annotation\n\n**Goal:** Map gene IDs to symbols, descriptions, and cross-database identifiers for human-readable results.\n\n**Approach:** Prefer `AnnotationDbi::mapIds` with org.db (fast, local, version-pinned); fall back to biomaRt or mygene for symbols\u002Faliases not in org.db; for prokaryotes, use Prokka\u002FBakta GFF.\n\n```r\nlibrary(org.Hs.eg.db)\nlibrary(AnnotationDbi)\n\nres_df$symbol \u003C- mapIds(org.Hs.eg.db, keys = sub('\\\\..*', '', res_df$gene),\n                         keytype = 'ENSEMBL', column = 'SYMBOL', multiVals = 'first')\nres_df$entrez \u003C- mapIds(org.Hs.eg.db, keys = sub('\\\\..*', '', res_df$gene),\n                         keytype = 'ENSEMBL', column = 'ENTREZID', multiVals = 'first')\n```\n\nThe `sub('\\\\..*', '', ...)` strips the Ensembl version. CAUTION: this regex destroys the `_PAR_Y` suffix in GENCODE 25-43 PAR genes -- use `sub('\\\\.[0-9]+(_PAR_Y)?$', '\\\\1', ...)` to preserve. See `expression-matrix\u002Fgene-id-mapping` for full details.\n\nFor HGNC symbols changed since 2020 (`SEPT1` -> `SEPTIN1`, `MARCH1` -> `MARCHF1`, `MARC1` -> `MTARC1`, `DEC1` -> `DELEC1`) old symbol-keyed downstream tools silently drop genes. Always join on stable Ensembl or Entrez IDs; use symbols as display labels only.\n\nFor prokaryotes:\n\n```r\nlibrary(rtracklayer)\ngff \u003C- import('annotation.gff3')\ngene_info \u003C- as.data.frame(gff[gff$type == 'gene',\n                                c('locus_tag', 'Name', 'product')])\nres_annotated \u003C- merge(res_df, gene_info, by.x = 'gene',\n                        by.y = 'locus_tag', all.x = TRUE)\n```\n\n## GSEA Preranked Input\n\n**Goal:** Produce a ranked list of all genes (no significance filter) for fgsea \u002F clusterProfiler GSEA.\n\n**Approach:** Rank by Wald statistic (DESeq2 `stat`) or shrunken LFC. NEVER use a filtered set as GSEA input -- GSEA's permutation null requires the full background.\n\n```r\ngsea_ranks \u003C- res_df$stat\nnames(gsea_ranks) \u003C- res_df$gene\ngsea_ranks \u003C- sort(gsea_ranks[!is.na(gsea_ranks)], decreasing = TRUE)\n\n# edgeR equivalent\ngsea_ranks_edger \u003C- sign(tt$logFC) * -log10(tt$PValue)\nnames(gsea_ranks_edger) \u003C- rownames(tt)\ngsea_ranks_edger \u003C- sort(gsea_ranks_edger[is.finite(gsea_ranks_edger)],\n                         decreasing = TRUE)\n```\n\n`stat` (Wald Z) is preferred over raw LFC for GSEA because it combines effect and precision in one number. Unshrunken LFC is dominated by low-count noise.\n\n## ORA Input\n\n**Goal:** Run over-representation analysis (enrichGO, enrichKEGG) on a significant gene list with the correct background.\n\n**Approach:** Subset to padj\u003C0.05; background = ALL TESTED genes (post-independent-filtering), NOT the genome.\n\n```r\nlibrary(clusterProfiler)\n\nsig_entrez \u003C- na.omit(res_df$entrez[res_df$padj \u003C 0.05])\nbg_entrez  \u003C- na.omit(res_df$entrez[!is.na(res_df$padj)])\n\nora \u003C- enrichGO(gene          = sig_entrez,\n                universe      = bg_entrez,\n                OrgDb         = org.Hs.eg.db,\n                keyType       = 'ENTREZID',\n                ont           = 'BP',\n                pAdjustMethod = 'BH')\n```\n\nCommon mistake: omitting `universe=` lets clusterProfiler default to \"all annotated genes for this organism\" -- which includes thousands of genes never tested. The resulting enrichment p-values are wrong (too small). The background MUST be the tested set.\n\n## Cross-Tool Concordance Check\n\n```r\ndeseq2_sig \u003C- rownames(subset(deseq2_res, padj \u003C 0.05))\nedger_sig  \u003C- rownames(subset(edger_tt,  FDR  \u003C 0.05))\n\ncommon      \u003C- intersect(deseq2_sig, edger_sig)\ndeseq2_only \u003C- setdiff(deseq2_sig, edger_sig)\nedger_only  \u003C- setdiff(edger_sig, deseq2_sig)\n\ncat(sprintf('DESeq2 sig: %d   edgeR sig: %d   Common: %d (%.1f%%)\\n',\n            length(deseq2_sig), length(edger_sig), length(common),\n            100 * length(common) \u002F min(length(deseq2_sig), length(edger_sig))))\n```\n\nConcordance >70% at the top 500: robust. \u003C60%: suspect filtering, normalization, or design difference -- not a tool difference. Run both pipelines with the same filtering and design to isolate.\n\n## Per-Method Failure Modes\n\n### Dropped a key gene by removing NAs\n\n**Trigger:** Pipeline does `res_df \u003C- na.omit(res_df)`; downstream gene of interest is missing from results.\n\n**Mechanism:** Gene was flagged by independent filtering OR Cook's distance; padj is NA but the biology is real.\n\n**Symptom:** A gene with clear differential expression in the count matrix is absent from the results table.\n\n**Fix:** Diagnose which filter fired (independent filtering vs Cook's vs all-zero); rerun `results()` with the appropriate filter off (`independentFiltering = FALSE` or `cooksCutoff = FALSE`).\n\n### Reported FDR on a magnitude-filtered gene set\n\n**Trigger:** Methods section says \"genes with padj \u003C 0.05 and abs(LFC) > 1 (FDR \u003C 5%)\".\n\n**Mechanism:** BH controls FDR for the |LFC| > 0 hypothesis, not the |LFC| > 1 hypothesis. The post-hoc filter adds no FDR control.\n\n**Symptom:** Reviewer challenges the FDR claim; replication studies show many of the filtered genes are not the magnitude expected.\n\n**Fix:** Use TREAT (`glmTreat`) or `lfcThreshold=` to test the magnitude hypothesis with proper FDR control. Re-do the methods sentence to match what was actually computed.\n\n### ORA universe wrong\n\n**Trigger:** ORA p-values look implausibly small for a small significant gene set.\n\n**Mechanism:** `universe=` argument omitted; clusterProfiler defaulted to all annotated genes in the organism, including thousands never in the tested set.\n\n**Symptom:** Many enriched pathways at strict thresholds; results don't replicate; reviewer questions the background.\n\n**Fix:** Explicitly pass `universe = bg_entrez` where `bg_entrez` is the set of tested gene IDs (i.e., those with non-NA padj).\n\n### \"Significant\" gene list in n=3 study doesn't replicate\n\n**Trigger:** Small RNA-seq study finds 200 DE genes; validation in independent cohort recovers 60.\n\n**Mechanism:** Schurch 2016 *RNA* 22:839: at n=3\u002Fgroup, all tools miss 20-40% of true positives compared to n=30. Variability of the gene list itself is high.\n\n**Symptom:** 30-50% replication of the gene list across independent runs of the SAME data.\n\n**Fix:** Frame the small-n DE list as hypothesis-generating, not as a stable set of facts. Validate top hits orthogonally before drawing conclusions. Use TREAT for biologically meaningful thresholds to require larger effects.\n\n### Sex-confounded design gives spurious chrX\u002FchrY signal\n\n**Trigger:** Mixed-sex cohort; sex not in the design; many chrY genes call as DE.\n\n**Mechanism:** Sex distribution differs across the experimental groups; the \"treatment effect\" partially captures sex.\n\n**Symptom:** chrY genes (DDX3Y, RPS4Y1, UTY) and XIST dominate the top DE list.\n\n**Fix:** Include sex in the design (`~ sex + condition`); rerun. For chrX\u002FchrY-specific analyses, sex MUST be in the model or the analysis is uninterpretable. Mauvais-Jarvis et al. 2020 *Lancet* 396:565 reviews the SABV requirement.\n\n## Common errors\n\n| Error \u002F symptom | Cause | Fix |\n|-----------------|-------|-----|\n| `$FDR` not found on DESeq2 result | DESeq2 uses `padj`; edgeR uses `FDR` | Check tool, use correct column |\n| `summary(res)` shows different cutoff than `results(alpha=)` | `summary(res, alpha=)` defaults to 0.1 | Pass `alpha` explicitly to `summary()` |\n| All `padj` NA | All genes filtered (rare; usually a data problem) | Check `independentFilteringResults(res)`; inspect baseMean distribution |\n| Direction of LFC reversed | Reference level not set; alphabetical default | `relevel()` BEFORE `DESeq()` |\n| Gene symbol mapping rate \u003C50% | Mixed Ensembl versions; recent HGNC renames | Verify Ensembl release, check for SEPT\u002FMARCH\u002FMARC renames |\n| `enrichGO` reports thousands of pathways | Wrong `universe=` | Pass `universe = bg_entrez` (tested set, not genome) |\n\n## References\n\n- Benjamini Y, Hochberg Y. 1995. Controlling the false discovery rate: a practical and powerful approach to multiple testing. *J R Stat Soc Ser B* 57(1):289-300. doi:10.1111\u002Fj.2517-6161.1995.tb02031.x\n- Storey JD. 2003. The positive false discovery rate: a Bayesian interpretation and the q-value. *Ann Stat* 31(6):2013-2035. doi:10.1214\u002Faos\u002F1074290335\n- Ignatiadis N, Klaus B, Zaugg JB, Huber W. 2016. Data-driven hypothesis weighting increases detection power in genome-scale multiple testing. *Nat Methods* 13(7):577-580. doi:10.1038\u002Fnmeth.3885\n- Bourgon R, Gentleman R, Huber W. 2010. Independent filtering increases detection power for high-throughput experiments. *PNAS* 107(21):9546-9551. doi:10.1073\u002Fpnas.0914005107\n- Stephens M. 2017. False discovery rates: a new deal. *Biostatistics* 18(2):275-294. doi:10.1093\u002Fbiostatistics\u002Fkxw041\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- 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- Love MI, Huber W, Anders S. 2014. Moderated estimation of fold change and dispersion for RNA-seq data with DESeq2. *Genome Biol* 15(12):550. doi:10.1186\u002Fs13059-014-0550-8\n- Mauvais-Jarvis F et al. 2020. Sex and gender: modifiers of health, disease, and medicine. *Lancet* 396(10250):565-582. doi:10.1016\u002FS0140-6736(20)31561-0\n- Bruford EA et al. 2020. Guidelines for human gene nomenclature. *Nat Genet* 52:754-758. doi:10.1038\u002Fs41588-020-0669-3\n- Ziemann M, Eren Y, El-Osta A. 2016. Gene name errors are widespread in the scientific literature. *Genome Biol* 17:177. doi:10.1186\u002Fs13059-016-1044-7\n- Wu T et al. 2021. clusterProfiler 4.0: A universal enrichment tool for interpreting omics data. *The Innovation* 2(3):100141. doi:10.1016\u002Fj.xinn.2021.100141\n\n## Related Skills\n\n- deseq2-basics - Generate DESeq2 results; design, contrasts, LRT, shrinkage\n- edger-basics - Generate edgeR results; QL F-test, TREAT, voom\n- de-visualization - P-value histogram, MA plot, volcano with shrunken LFC, heatmap, sample distance\n- batch-correction - Include batch in design (vs Nygaard 2016 cardinal sin)\n- timeseries-de - LRT-with-reduced-model patterns for time\n- expression-matrix\u002Fgene-id-mapping - ID conversion, HGNC renames, ortholog mapping\n- expression-matrix\u002Fmetadata-joins - Sex covariate, paired design, sample swap detection\n- pathway-analysis\u002Fgo-enrichment - ORA with proper background\n- pathway-analysis\u002Fgsea - GSEA preranked input from `stat` or shrunken LFC\n- pathway-analysis\u002Fkegg-pathways - KEGG with strain-specific organism codes\n- data-visualization\u002Fvolcano-and-ma-plots - Custom volcano with apeglm-shrunken LFC\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\u002Fde-results\u002FSKILL.md","DESeq2","GPTomics\u002FbioSkills","main","2d1750717747097b602acf30bd09a7cbd4b4c6ea","awesome_skills\u002Fbiology\u002Fbio-differential-expression-de-results","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-de-results",{"tool":42,"command":43},"bunx","bunx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-differential-expression-de-results",{"tool":45,"command":46},"pnpm","pnpm dlx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-differential-expression-de-results","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-differential-expression-de-results\u002FSKILL.md",true,[50,56,60,64],{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"examples\u002Fannotate_results.R","OTHER","其他",1244,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-differential-expression-de-results\u002Fexamples\u002Fannotate_results.R",{"path":57,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":58,"sourceHtmlUrl":59},"examples\u002Fexport_excel.R",1760,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-differential-expression-de-results\u002Fexamples\u002Fexport_excel.R",{"path":61,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":62,"sourceHtmlUrl":63},"examples\u002Ffilter_results.R",1439,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-differential-expression-de-results\u002Fexamples\u002Ffilter_results.R",{"path":65,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":68,"sourceHtmlUrl":69},"usage-guide.md","REFERENCE","参考文档",2410,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-differential-expression-de-results\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",[],[]]