/bio-de-results
Extract, filter, annotate, and export differential expression results from DESeq2 or edgeR. Use for identifying significant genes, applying multiple testing corrections, adding gene annotations, and preparing results for downstream analysis. Use when filtering and exporting DE
$ npx -y skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-de-results --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-results
Context preview
The summary Claude sees to decide when to auto-load this skill.
Extract, filter, annotate, and export differential expression results from DESeq2 or edgeR. Use for identifying significant genes, applying multiple testing corrections, adding gene annotations, and preparing results for downstream analysis. Use when filtering and exporting DE
SKILL.md
bio-de-results.SKILL.mdname: bio-de-results
description: Extract, filter, annotate, and export differential expression results from DESeq2 or edgeR. Use for identifying significant genes, applying multiple testing corrections, adding gene annotations, and preparing results for downstream analysis. Use when filtering and exporting DE analysis results.
tool_type: r
primary_tool: DESeq2
Version Compatibility
Reference examples tested with: DESeq2 1.42+, edgeR 4.0+
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.
DE Results
Extract, filter, and export differential expression results.
Required Libraries
library(DESeq2) # or library(edgeR)
library(dplyr) # For data manipulation
Extracting DESeq2 Results
**Goal:** Retrieve DE statistics from a fitted DESeq2 model as a usable data frame.
**Approach:** Call results() with optional shrinkage, then convert to a data frame with gene identifiers.
# Basic results
res <- results(dds)
# With specific alpha (adjusted p-value threshold)
res <- results(dds, alpha = 0.05)
# With log fold change shrinkage
res <- lfcShrink(dds, coef = 'condition_treated_vs_control', type = 'apeglm')
# Convert to data frame
res_df <- as.data.frame(res)
res_df$gene <- rownames(res_df)
Extracting edgeR Results
**Goal:** Retrieve DE statistics from a fitted edgeR model as a data frame.
**Approach:** Use topTags with n=Inf to extract all gene-level results.
# Get all results
results <- topTags(qlf, n = Inf)$table
# Add gene column
results$gene <- rownames(results)
Filtering Significant Genes
**Goal:** Identify genes meeting statistical significance and biological effect size criteria.
**Approach:** Subset results by adjusted p-value, fold change magnitude, and expression level thresholds.
**"Get the significant differentially expressed genes"** → Filter DE results by adjusted p-value and fold change cutoffs to produce up- and down-regulated gene lists.
By Adjusted P-value
# DESeq2
sig_genes <- subset(res, padj < 0.05)
# edgeR
sig_genes <- subset(results, FDR < 0.05)
# Using dplyr
sig_genes <- res_df %>%
filter(padj < 0.05) %>%
arrange(padj)By Fold Change
# Absolute log2 fold change > 1 (2-fold change)
sig_genes <- subset(res, padj < 0.05 & abs(log2FoldChange) > 1)
# Up-regulated only
up_genes <- subset(res, padj < 0.05 & log2FoldChange > 1)
# Down-regulated only
down_genes <- subset(res, padj < 0.05 & log2FoldChange < -1)
Combined Filters
# Stringent filtering
sig_genes <- res_df %>%
filter(padj < 0.01,
abs(log2FoldChange) > 1,
baseMean > 10) %>%
arrange(padj)Ordering Results
**Goal:** Rank DE genes by statistical significance or biological effect size.
**Approach:** Sort results by adjusted p-value, absolute fold change, or mean expression.
# By adjusted p-value (most significant first)
res_ordered <- res[order(res$padj), ]
# By absolute fold change (largest changes first)
res_ordered <- res[order(abs(res$log2FoldChange), decreasing = TRUE), ]
# By base mean expression
res_ordered <- res[order(res$baseMean, decreasing = TRUE), ]
# Combined: significant genes ordered by fold change
sig_ordered <- res_df %>%
filter(padj < 0.05) %>%
arrange(desc(abs(log2FoldChange)))Summary Statistics
**Goal:** Quantify the number of up- and down-regulated genes at chosen thresholds.
**Approach:** Count genes passing significance filters and report directional breakdown.
# DESeq2 summary
summary(res)
# Manual counts
n_tested <- sum(!is.na(res$padj))
n_sig <- sum(res$padj < 0.05, na.rm = TRUE)
n_up <- sum(res$padj < 0.05 & res$log2FoldChange > 0, na.rm = TRUE)
n_down <- sum(res$padj < 0.05 & res$log2FoldChange < 0, na.rm = TRUE)
cat(sprintf('Tested: %d genes\n', n_tested))
cat(sprintf('Significant (padj < 0.05): %d genes\n', n_sig))
cat(sprintf('Up-regulated: %d genes\n', n_up))
cat(sprintf('Down-regulated: %d genes\n', n_down))
# edgeR summary
summary(decideTests(qlf))Adding Gene Annotations
**Goal:** Enrich DE results with gene symbols, descriptions, and cross-database identifiers.
**Approach:** Map Ensembl or Entrez IDs to human-readable annotations using org.db, biomaRt, or custom files.
**"Add gene names to my DE results"** → Map gene identifiers to symbols and descriptions using annotation databases, then merge with the results table.
From Bioconductor Annotation Package
library(org.Hs.eg.db) # Human; use org.Mm.eg.db for mouse
# If gene IDs are Ensembl
res_df$symbol <- mapIds(org.Hs.eg.db,
keys = rownames(res_df),
column = 'SYMBOL',
keytype = 'ENSEMBL',
multiVals = 'first')
res_df$entrez <- mapIds(org.Hs.eg.db,
keys = rownames(res_df),
column = 'ENTREZID',
keytype = 'ENSEMBL',
multiVals = 'first')
res_df$description <- mapIds(org.Hs.eg.db,
keys = rownames(res_df),
column = 'GENENAME',
keytype = 'ENSEMBL',
multiVals = 'first')From BioMart
library(biomaRt)
mart <- useMart('ensembl', dataset = 'hsapiens_gene_ensembl')
annotations <- getBM(
attributes = c('ensembl_gene_id', 'external_gene_name', 'description'),
filters = 'ensembl_gene_id',
values = rownames(res_df),
mart = mart
)
# Merge with results
res_annotated <- merge(res_df, annotations,
by.x = 'row.names', by.y = 'ensembl_gene_id',
all.x = TRUE)From Custom File
``
Read more
name: bio-de-results description: Extract, filter, annotate, and export differential expression results from DESeq2 or edgeR. Use for identifying significant genes, applying multiple testing corrections, adding gene annotations, and preparing results for downstream analysis. Use when filtering and exporting DE analysis results. tool_type: r primary_tool: DESeq2
Version Compatibility
Reference examples tested with: DESeq2 1.42+, edgeR 4.0+
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.
DE Results
Extract, filter, and export differential expression results.
Required Libraries
library(DESeq2) # or library(edgeR) library(dplyr) # For data manipulation
Extracting DESeq2 Results
**Goal:** Retrieve DE statistics from a fitted DESeq2 model as a usable data frame.
**Approach:** Call results() with optional shrinkage, then convert to a data frame with gene identifiers.
# Basic results res <- results(dds) # With specific alpha (adjusted p-value threshold) res <- results(dds, alpha = 0.05) # With log fold change shrinkage res <- lfcShrink(dds, coef = 'condition_treated_vs_control', type = 'apeglm') # Convert to data frame res_df <- as.data.frame(res) res_df$gene <- rownames(res_df)
Extracting edgeR Results
**Goal:** Retrieve DE statistics from a fitted edgeR model as a data frame.
**Approach:** Use topTags with n=Inf to extract all gene-level results.
# Get all results results <- topTags(qlf, n = Inf)$table # Add gene column results$gene <- rownames(results)
Filtering Significant Genes
**Goal:** Identify genes meeting statistical significance and biological effect size criteria.
**Approach:** Subset results by adjusted p-value, fold change magnitude, and expression level thresholds.
**"Get the significant differentially expressed genes"** → Filter DE results by adjusted p-value and fold change cutoffs to produce up- and down-regulated gene lists.
By Adjusted P-value
# DESeq2
sig_genes <- subset(res, padj < 0.05)
# edgeR
sig_genes <- subset(results, FDR < 0.05)
# Using dplyr
sig_genes <- res_df %>%
filter(padj < 0.05) %>%
arrange(padj)By Fold Change
# Absolute log2 fold change > 1 (2-fold change) sig_genes <- subset(res, padj < 0.05 & abs(log2FoldChange) > 1) # Up-regulated only up_genes <- subset(res, padj < 0.05 & log2FoldChange > 1) # Down-regulated only down_genes <- subset(res, padj < 0.05 & log2FoldChange < -1)
Combined Filters
# Stringent filtering
sig_genes <- res_df %>%
filter(padj < 0.01,
abs(log2FoldChange) > 1,
baseMean > 10) %>%
arrange(padj)Ordering Results
**Goal:** Rank DE genes by statistical significance or biological effect size.
**Approach:** Sort results by adjusted p-value, absolute fold change, or mean expression.
# By adjusted p-value (most significant first)
res_ordered <- res[order(res$padj), ]
# By absolute fold change (largest changes first)
res_ordered <- res[order(abs(res$log2FoldChange), decreasing = TRUE), ]
# By base mean expression
res_ordered <- res[order(res$baseMean, decreasing = TRUE), ]
# Combined: significant genes ordered by fold change
sig_ordered <- res_df %>%
filter(padj < 0.05) %>%
arrange(desc(abs(log2FoldChange)))Summary Statistics
**Goal:** Quantify the number of up- and down-regulated genes at chosen thresholds.
**Approach:** Count genes passing significance filters and report directional breakdown.
# DESeq2 summary
summary(res)
# Manual counts
n_tested <- sum(!is.na(res$padj))
n_sig <- sum(res$padj < 0.05, na.rm = TRUE)
n_up <- sum(res$padj < 0.05 & res$log2FoldChange > 0, na.rm = TRUE)
n_down <- sum(res$padj < 0.05 & res$log2FoldChange < 0, na.rm = TRUE)
cat(sprintf('Tested: %d genes\n', n_tested))
cat(sprintf('Significant (padj < 0.05): %d genes\n', n_sig))
cat(sprintf('Up-regulated: %d genes\n', n_up))
cat(sprintf('Down-regulated: %d genes\n', n_down))
# edgeR summary
summary(decideTests(qlf))Adding Gene Annotations
**Goal:** Enrich DE results with gene symbols, descriptions, and cross-database identifiers.
**Approach:** Map Ensembl or Entrez IDs to human-readable annotations using org.db, biomaRt, or custom files.
**"Add gene names to my DE results"** → Map gene identifiers to symbols and descriptions using annotation databases, then merge with the results table.
From Bioconductor Annotation Package
library(org.Hs.eg.db) # Human; use org.Mm.eg.db for mouse
# If gene IDs are Ensembl
res_df$symbol <- mapIds(org.Hs.eg.db,
keys = rownames(res_df),
column = 'SYMBOL',
keytype = 'ENSEMBL',
multiVals = 'first')
res_df$entrez <- mapIds(org.Hs.eg.db,
keys = rownames(res_df),
column = 'ENTREZID',
keytype = 'ENSEMBL',
multiVals = 'first')
res_df$description <- mapIds(org.Hs.eg.db,
keys = rownames(res_df),
column = 'GENENAME',
keytype = 'ENSEMBL',
multiVals = 'first')From BioMart
library(biomaRt)
mart <- useMart('ensembl', dataset = 'hsapiens_gene_ensembl')
annotations <- getBM(
attributes = c('ensembl_gene_id', 'external_gene_name', 'description'),
filters = 'ensembl_gene_id',
values = rownames(res_df),
mart = mart
)
# Merge with results
res_annotated <- merge(res_df, annotations,
by.x = 'row.names', by.y = 'ensembl_gene_id',
all.x = TRUE)From Custom File
``
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

