Delegate independent tasks to specialized agents working concurrently with isolated context.
Enrichment Visualization
bio-pathway-enrichment-visualization
Visualize enrichment results using enrichplot package functions. Use when creating publication-quality figures from clusterProfiler results. Covers dotplot, barplot, cnetplot, emapplot, gseaplot2, ridgeplot, and treeplot.
SKILL.md
Full skill instructions
Enrichment Visualization
Scope
This skill covers enrichplot package functions designed for clusterProfiler results:
dotplot(),barplot()- Summary viewscnetplot(),emapplot(),treeplot()- Network/hierarchical viewsgseaplot2(),ridgeplot()- GSEA-specificgoplot(),heatplot(),upsetplot()- Specialized views
For custom ggplot2 enrichment dotplots (manual implementation), see data-visualization/specialized-omics-plots.
Setup
library(clusterProfiler)
library(enrichplot)
library(ggplot2)
# Assume ego (enrichGO result), kk (enrichKEGG result), or gse (GSEA result) exists
Dot Plot
Most common visualization - shows gene ratio, count, and significance.
dotplot(ego, showCategory = 20)
# Customize
dotplot(ego, showCategory = 15, font.size = 10, title = 'GO Enrichment') +
scale_color_gradient(low = 'red', high = 'blue')
# Save
pdf('go_dotplot.pdf', width = 10, height = 8)
dotplot(ego, showCategory = 20)
dev.off()
Bar Plot
Shows enrichment count or gene ratio.
barplot(ego, showCategory = 20)
# Customize
barplot(ego, showCategory = 15, x = 'GeneRatio', color = 'p.adjust')
Gene-Concept Network (cnetplot)
Shows relationships between genes and enriched terms.
# Basic cnetplot
cnetplot(ego)
# With fold change colors
cnetplot(ego, foldChange = gene_list)
# Circular layout
cnetplot(ego, circular = TRUE, colorEdge = TRUE)
# Customize node size
cnetplot(ego, node_label = 'gene', cex_label_gene = 0.8)
Enrichment Map (emapplot)
Shows term-term relationships based on shared genes.
# Requires pairwise_termsim first
ego_pt <- pairwise_termsim(ego)
emapplot(ego_pt)
# Customize
emapplot(ego_pt, showCategory = 30, cex_label_category = 0.6)
# Cluster by similarity
emapplot(ego_pt, group_category = TRUE, group_legend = TRUE)
Tree Plot
Hierarchical clustering of enriched terms.
ego_pt <- pairwise_termsim(ego)
treeplot(ego_pt)
# Show more categories
treeplot(ego_pt, showCategory = 30)
Upset Plot
Show overlapping genes between terms.
upsetplot(ego)
# Limit to specific number of terms
upsetplot(ego, n = 10)
GSEA-Specific Plots
Running Score Plot (gseaplot2)
# Single gene set
gseaplot2(gse, geneSetID = 1, title = gse$Description[1])
# Multiple gene sets
gseaplot2(gse, geneSetID = 1:3)
# With subplots
gseaplot2(gse, geneSetID = 1, subplots = 1:3)
# By term ID
gseaplot2(gse, geneSetID = 'GO:0006955')
Ridge Plot
Distribution of fold changes in gene sets.
ridgeplot(gse)
# Top n gene sets
ridgeplot(gse, showCategory = 15)
# Order by NES
ridgeplot(gse, showCategory = 20) + theme(axis.text.y = element_text(size = 8))
GO-Specific Plot (goplot)
DAG structure of GO terms.
# Only for GO enrichment results
goplot(ego)
# Specific ontology
goplot(ego_bp) # where ego_bp is enrichGO with ont='BP'
Heatplot
Gene-concept heatmap.
heatplot(ego, foldChange = gene_list)
# Customize
heatplot(ego, showCategory = 15, foldChange = gene_list)
Compare Multiple Analyses
# Compare clusters (from compareCluster)
dotplot(ck, showCategory = 10)
# Facet by cluster
dotplot(ck) + facet_grid(~Cluster)
Customize ggplot2 Elements
All enrichplot functions return ggplot2 objects.
p <- dotplot(ego, showCategory = 20)
# Add title
p + ggtitle('GO Biological Process Enrichment')
# Change theme
p + theme_minimal()
# Adjust text
p + theme(axis.text.y = element_text(size = 10))
# Change colors
p + scale_color_viridis_c()
Save Plots
# PDF (vector, publication quality)
pdf('enrichment_plots.pdf', width = 10, height = 8)
dotplot(ego, showCategory = 20)
dev.off()
# PNG (raster)
png('dotplot.png', width = 800, height = 600, res = 100)
dotplot(ego, showCategory = 20)
dev.off()
# Using ggsave
p <- dotplot(ego)
ggsave('dotplot.pdf', p, width = 10, height = 8)
Visualization Summary
| Function | Best For | Input Type |
|---|---|---|
| dotplot | Overview of enrichment | ORA, GSEA |
| barplot | Simple counts/ratios | ORA |
| cnetplot | Gene-term relationships | ORA |
| emapplot | Term clustering | ORA |
| treeplot | Hierarchical grouping | ORA |
| upsetplot | Term overlap | ORA |
| gseaplot2 | Running enrichment score | GSEA |
| ridgeplot | Fold change distribution | GSEA |
| goplot | GO DAG structure | GO only |
| heatplot | Gene-concept matrix | ORA |
Related Skills
- go-enrichment - Generate GO enrichment results
- kegg-pathways - Generate KEGG enrichment results
- gsea - Generate GSEA results
More Other skills
brand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.
internal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).
Fundamental design principles for writing maintainable, testable Python code.
responsive-design
Modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first strategies.
Generate Playwright tests from scenarios using interactive browser exploration and validation.
Automated website exploration and test case generation using Playwright.
Modern React state management with Redux Toolkit, Zustand, Jotai, and React Query for every state category.
gdpr-data-handling
GDPR-compliant data handling with consent management, data subject rights, and privacy controls.
Python error handling patterns including input validation, exception hierarchies, and partial failure handling. Use when implementing validation logic, designing exception strategies, handling batch processing failures, or building robust APIs.
refactor-plan
Detailed multi-file refactor planning with safety checks and rollback guidance.
