/bio-de-edger-basics
Perform differential expression analysis using edgeR in R/Bioconductor. Use for analyzing RNA-seq count data with the quasi-likelihood F-test framework, creating DGEList objects, normalization, dispersion estimation, and statistical testing. Use when performing DE analysis with
$ npx -y skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-de-edger-basics --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/bio-de-edger-basics
Context preview
The summary Claude sees to decide when to auto-load this skill.
Perform differential expression analysis using edgeR in R/Bioconductor. Use for analyzing RNA-seq count data with the quasi-likelihood F-test framework, creating DGEList objects, normalization, dispersion estimation, and statistical testing. Use when performing DE analysis with
SKILL.md
bio-de-edger-basics.SKILL.mdname: bio-de-edger-basics
description: Perform differential expression analysis using edgeR in R/Bioconductor. Use for analyzing RNA-seq count data with the quasi-likelihood F-test framework, creating DGEList objects, normalization, dispersion estimation, and statistical testing. Use when performing DE analysis with edgeR.
tool_type: r
primary_tool: edgeR
Version Compatibility
Reference examples tested with: DESeq2 1.42+, edgeR 4.0+, limma 3.58+, scanpy 1.10+
Before using code patterns, verify installed versions match. If versions differ:
- R: `packageVersion('<pkg>')` then `?function_name` to verify parameters
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
edgeR Basics
Differential expression analysis using edgeR's quasi-likelihood framework for RNA-seq count data.
Required Libraries
library(edgeR)
library(limma) # For design matrices and voom
Installation
if (!require('BiocManager', quietly = TRUE))
install.packages('BiocManager')
BiocManager::install('edgeR')Creating DGEList Object
**Goal:** Construct an edgeR container from a count matrix with sample group information.
**Approach:** Wrap raw counts and group labels into a DGEList object for normalization and testing.
**"Load my RNA-seq counts into edgeR"** → Create a DGEList from a count matrix with sample group assignments and optional gene annotations.
# From count matrix
# counts: matrix with genes as rows, samples as columns
# group: factor indicating sample groups
y <- DGEList(counts = counts, group = group)
# With gene annotation
y <- DGEList(counts = counts, group = group, genes = gene_info)
# Check structure
y
Standard edgeR Workflow (Quasi-Likelihood)
**Goal:** Run the complete edgeR QL pipeline from raw counts to differentially expressed gene lists.
**Approach:** Filter, normalize (TMM), estimate dispersions, fit quasi-likelihood GLM, and test coefficients with the QL F-test.
**"Find differentially expressed genes between my groups"** → Test for significant expression differences using negative binomial models with quasi-likelihood F-tests.
# Create DGEList
y <- DGEList(counts = counts, group = group)
# Filter low-expression genes
keep <- filterByExpr(y, group = group)
y <- y[keep, , keep.lib.sizes = FALSE]
# Normalize (TMM by default)
y <- calcNormFactors(y)
# Create design matrix
design <- model.matrix(~ group)
# Estimate dispersion (optional in edgeR v4+ but improves BCV plots)
y <- estimateDisp(y, design)
# Fit quasi-likelihood model
fit <- glmQLFit(y, design)
# Perform quasi-likelihood F-test
qlf <- glmQLFTest(fit, coef = 2)
# View top genes
topTags(qlf)
Filtering Low-Expression Genes
**Goal:** Remove genes with insufficient expression to reduce noise and multiple testing burden.
**Approach:** Apply automatic or manual CPM/count thresholds requiring expression in a minimum number of samples.
# Automatic filtering (recommended)
keep <- filterByExpr(y, group = group)
y <- y[keep, , keep.lib.sizes = FALSE]
# Manual filtering: CPM threshold
keep <- rowSums(cpm(y) > 1) >= 2 # At least 2 samples with CPM > 1
y <- y[keep, , keep.lib.sizes = FALSE]
# Filter by minimum counts
keep <- rowSums(y$counts >= 10) >= 3 # At least 3 samples with 10+ counts
y <- y[keep, , keep.lib.sizes = FALSE]
Normalization Methods
**Goal:** Correct for differences in library composition between samples.
**Approach:** Compute TMM (or alternative) normalization factors that adjust effective library sizes.
# TMM normalization (default, recommended)
y <- calcNormFactors(y, method = 'TMM')
# Alternative methods
y <- calcNormFactors(y, method = 'RLE') # Relative Log Expression
y <- calcNormFactors(y, method = 'upperquartile')
y <- calcNormFactors(y, method = 'none') # No normalization
# View normalization factors
y$samples$norm.factors
Design Matrices
**Goal:** Define the linear model structure for the experimental design.
**Approach:** Build model matrices encoding group, batch, and interaction terms for the GLM.
# Simple two-group comparison
design <- model.matrix(~ group)
# With batch correction
design <- model.matrix(~ batch + group)
# Interaction model
design <- model.matrix(~ genotype + treatment + genotype:treatment)
# No intercept (for direct group comparisons)
design <- model.matrix(~ 0 + group)
colnames(design) <- levels(group)
Dispersion Estimation
**Goal:** Estimate biological variability (dispersion) to parameterize the negative binomial model.
**Approach:** Compute common, trended, and gene-wise dispersions using empirical Bayes moderation.
# Estimate all dispersions
y <- estimateDisp(y, design)
# Or estimate separately
y <- estimateGLMCommonDisp(y, design)
y <- estimateGLMTrendedDisp(y, design)
y <- estimateGLMTagwiseDisp(y, design)
# View dispersions
y$common.dispersion
y$trended.dispersion
y$tagwise.dispersion
# Plot BCV (biological coefficient of variation)
plotBCV(y)
Quasi-Likelihood Testing
**Goal:** Test for differential expression using the quasi-likelihood framework for robust inference.
**Approach:** Fit a QL GLM and test individual coefficients, contrasts, or multiple coefficients simultaneously.
# Fit QL model
fit <- glmQLFit(y, design)
# Test specific coefficient
qlf <- glmQLFTest(fit, coef = 2)
# Test with contrast
contrast <- makeContrasts(groupB - groupA, levels = design)
qlf <- glmQLFTest(fit, contrast = contrast)
# Test multiple coefficients (ANOVA-like)
qlf <- glmQLFTest(fit, coef = 2:3)
Making Contrasts
**Goal:** Define specific pairwise or complex group comparisons for testing.
**Approach:** Use makeContrasts with a no-intercept design to specify arbitrary between-group differences.
# Design without intercept
design <- model.matrix(~ 0 + group)
colnames(design) <- levels(group)
y <- estimateDisp(y, desig
Read more
name: bio-de-edger-basics description: Perform differential expression analysis using edgeR in R/Bioconductor. Use for analyzing RNA-seq count data with the quasi-likelihood F-test framework, creating DGEList objects, normalization, dispersion estimation, and statistical testing. Use when performing DE analysis with edgeR. tool_type: r primary_tool: edgeR
Version Compatibility
Reference examples tested with: DESeq2 1.42+, edgeR 4.0+, limma 3.58+, scanpy 1.10+
Before using code patterns, verify installed versions match. If versions differ:
- R: `packageVersion('<pkg>')` then `?function_name` to verify parameters
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
edgeR Basics
Differential expression analysis using edgeR's quasi-likelihood framework for RNA-seq count data.
Required Libraries
library(edgeR) library(limma) # For design matrices and voom
Installation
if (!require('BiocManager', quietly = TRUE))
install.packages('BiocManager')
BiocManager::install('edgeR')Creating DGEList Object
**Goal:** Construct an edgeR container from a count matrix with sample group information.
**Approach:** Wrap raw counts and group labels into a DGEList object for normalization and testing.
**"Load my RNA-seq counts into edgeR"** → Create a DGEList from a count matrix with sample group assignments and optional gene annotations.
# From count matrix # counts: matrix with genes as rows, samples as columns # group: factor indicating sample groups y <- DGEList(counts = counts, group = group) # With gene annotation y <- DGEList(counts = counts, group = group, genes = gene_info) # Check structure y
Standard edgeR Workflow (Quasi-Likelihood)
**Goal:** Run the complete edgeR QL pipeline from raw counts to differentially expressed gene lists.
**Approach:** Filter, normalize (TMM), estimate dispersions, fit quasi-likelihood GLM, and test coefficients with the QL F-test.
**"Find differentially expressed genes between my groups"** → Test for significant expression differences using negative binomial models with quasi-likelihood F-tests.
# Create DGEList y <- DGEList(counts = counts, group = group) # Filter low-expression genes keep <- filterByExpr(y, group = group) y <- y[keep, , keep.lib.sizes = FALSE] # Normalize (TMM by default) y <- calcNormFactors(y) # Create design matrix design <- model.matrix(~ group) # Estimate dispersion (optional in edgeR v4+ but improves BCV plots) y <- estimateDisp(y, design) # Fit quasi-likelihood model fit <- glmQLFit(y, design) # Perform quasi-likelihood F-test qlf <- glmQLFTest(fit, coef = 2) # View top genes topTags(qlf)
Filtering Low-Expression Genes
**Goal:** Remove genes with insufficient expression to reduce noise and multiple testing burden.
**Approach:** Apply automatic or manual CPM/count thresholds requiring expression in a minimum number of samples.
# Automatic filtering (recommended) keep <- filterByExpr(y, group = group) y <- y[keep, , keep.lib.sizes = FALSE] # Manual filtering: CPM threshold keep <- rowSums(cpm(y) > 1) >= 2 # At least 2 samples with CPM > 1 y <- y[keep, , keep.lib.sizes = FALSE] # Filter by minimum counts keep <- rowSums(y$counts >= 10) >= 3 # At least 3 samples with 10+ counts y <- y[keep, , keep.lib.sizes = FALSE]
Normalization Methods
**Goal:** Correct for differences in library composition between samples.
**Approach:** Compute TMM (or alternative) normalization factors that adjust effective library sizes.
# TMM normalization (default, recommended) y <- calcNormFactors(y, method = 'TMM') # Alternative methods y <- calcNormFactors(y, method = 'RLE') # Relative Log Expression y <- calcNormFactors(y, method = 'upperquartile') y <- calcNormFactors(y, method = 'none') # No normalization # View normalization factors y$samples$norm.factors
Design Matrices
**Goal:** Define the linear model structure for the experimental design.
**Approach:** Build model matrices encoding group, batch, and interaction terms for the GLM.
# Simple two-group comparison design <- model.matrix(~ group) # With batch correction design <- model.matrix(~ batch + group) # Interaction model design <- model.matrix(~ genotype + treatment + genotype:treatment) # No intercept (for direct group comparisons) design <- model.matrix(~ 0 + group) colnames(design) <- levels(group)
Dispersion Estimation
**Goal:** Estimate biological variability (dispersion) to parameterize the negative binomial model.
**Approach:** Compute common, trended, and gene-wise dispersions using empirical Bayes moderation.
# Estimate all dispersions y <- estimateDisp(y, design) # Or estimate separately y <- estimateGLMCommonDisp(y, design) y <- estimateGLMTrendedDisp(y, design) y <- estimateGLMTagwiseDisp(y, design) # View dispersions y$common.dispersion y$trended.dispersion y$tagwise.dispersion # Plot BCV (biological coefficient of variation) plotBCV(y)
Quasi-Likelihood Testing
**Goal:** Test for differential expression using the quasi-likelihood framework for robust inference.
**Approach:** Fit a QL GLM and test individual coefficients, contrasts, or multiple coefficients simultaneously.
# Fit QL model fit <- glmQLFit(y, design) # Test specific coefficient qlf <- glmQLFTest(fit, coef = 2) # Test with contrast contrast <- makeContrasts(groupB - groupA, levels = design) qlf <- glmQLFTest(fit, contrast = contrast) # Test multiple coefficients (ANOVA-like) qlf <- glmQLFTest(fit, coef = 2:3)
Making Contrasts
**Goal:** Define specific pairwise or complex group comparisons for testing.
**Approach:** Use makeContrasts with a no-intercept design to specify arbitrary between-group differences.
# Design without intercept design <- model.matrix(~ 0 + group) colnames(design) <- levels(group) y <- estimateDisp(y, desig
The largest open-source medical AI skill library for OpenClaw.
Other skills on openclaw-medical-skills.
- /aav-vector-design-agent
<!--
Open skill - /adaptyv
Cloud laboratory platform for automated protein testing and validation. Use when designing proteins and needing experimental validation including binding assays, expression testing, thermostability measurements, enzyme activity assays, or protein sequence optimization. Also use
Open skill - /adhd-daily-planner
Time-blind friendly planning, executive function support, and daily structure for ADHD brains. Specializes in realistic time estimation, dopamine-aware task design, and building systems that
Open skill - /aeon
This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations
Open skill - /agent-browser
Browse the web for any task — research topics, read articles, interact with web apps, fill forms, take screenshots, extract data, and test web pages. Use whenever a browser would be useful, not just when the user explicitly asks.
Open skill - /agentd-drug-discovery
<!--
Open skill

