gsea-enrichment-analysis

2
0
Source

Gene set enrichment analysis with correct geneset format handling. Critical guidance for loading pathway databases and running enrichment in OmicVerse.

Install

mkdir -p .claude/skills/gsea-enrichment-analysis && curl -L -o skill.zip "https://mcp.directory/api/skills/download/4144" && unzip -o skill.zip -d .claude/skills/gsea-enrichment-analysis && rm skill.zip

Installs to .claude/skills/gsea-enrichment-analysis

About this skill

GSEA and Pathway Enrichment Analysis

Overview

This skill covers gene set enrichment analysis (GSEA) and pathway enrichment workflows in OmicVerse. It provides critical guidance on the correct data formats and API usage patterns to avoid common errors.

Critical API Reference - Geneset Format

IMPORTANT: Use Dictionary Format, NOT File Path!

The ov.bulk.geneset_enrichment() function requires a dictionary of gene sets, NOT a file path string. You must first load the geneset file using ov.utils.geneset_prepare().

CORRECT usage:

# Step 1: Download pathway database (if not already available)
ov.utils.download_pathway_database()

# Step 2: Load geneset file into dictionary format - REQUIRED!
pathways_dict = ov.utils.geneset_prepare(
    'genesets/GO_Biological_Process_2021.txt',  # or .gmt file
    organism='Human'  # or 'Mouse'
)

# Step 3: Now run enrichment with the DICTIONARY
enr = ov.bulk.geneset_enrichment(
    gene_list=deg_genes,
    pathways_dict=pathways_dict,  # Pass the DICTIONARY, not file path!
    pvalue_type='auto',
    organism='Human'
)

WRONG - DO NOT USE:

# WRONG! Don't pass file path directly to geneset_enrichment!
# enr = ov.bulk.geneset_enrichment(
#     gene_list=deg_genes,
#     pathways_dict='genesets/GO_Biological_Process_2021.gmt'  # ERROR! String path doesn't work!
# )

# WRONG! geneset_enrichment expects dict, not file path
# enr = ov.bulk.geneset_enrichment(
#     gene_list=deg_genes,
#     pathways_dict='GO_Biological_Process_2021'  # ERROR!
# )

File Format Support

File ExtensionLoad MethodNotes
.txtov.utils.geneset_prepare()OmicVerse format
.gmtov.utils.geneset_prepare()Standard GMT format
.jsonjson.load() then convertCustom handling needed

Complete Enrichment Workflow

import omicverse as ov

# 1. Setup
ov.plot_set()

# 2. Ensure pathway database is available
ov.utils.download_pathway_database()

# 3. Load gene sets - ALWAYS use geneset_prepare first!
go_bp = ov.utils.geneset_prepare('genesets/GO_Biological_Process_2021.txt', organism='Human')
go_mf = ov.utils.geneset_prepare('genesets/GO_Molecular_Function_2021.txt', organism='Human')
kegg = ov.utils.geneset_prepare('genesets/KEGG_2021_Human.txt', organism='Human')

# 4. Prepare gene list (e.g., from DEG analysis)
# Assuming dds is a pyDEG object with results
deg_genes = dds.result.loc[dds.result['sig'] != 'normal'].index.tolist()

# 5. Run enrichment with dictionary
enr_go_bp = ov.bulk.geneset_enrichment(
    gene_list=deg_genes,
    pathways_dict=go_bp,  # Dictionary, NOT file path!
    pvalue_type='auto',
    organism='Human'
)

# 6. Visualize results
ov.bulk.geneset_plot(enr_go_bp, figsize=(6, 8), num=10)

# 7. For multiple databases, combine into dict
enr_dict = {
    'GO_BP': enr_go_bp,
    'GO_MF': enr_go_mf,
    'KEGG': enr_kegg
}
colors_dict = {
    'GO_BP': '#1f77b4',
    'GO_MF': '#ff7f0e',
    'KEGG': '#2ca02c'
}
ov.bulk.geneset_plot_multi(enr_dict, colors_dict, num=5)

Common Errors and Solutions

Error: "FileNotFoundError" or "pathways_dict is not a dict"

Cause: Passing file path string instead of dictionary to geneset_enrichment() Solution: First load with ov.utils.geneset_prepare(), then pass the returned dictionary

Error: "Missing file 'genesets/GO_Biological_Process_2021.gmt'"

Cause: Pathway database not downloaded Solution: Run ov.utils.download_pathway_database() first

Error: "No enriched pathways found"

Cause: Gene list doesn't overlap with pathway genes, or organism mismatch Solution:

  • Verify gene symbols match (human vs mouse capitalization)
  • Check organism parameter matches your data
  • Ensure gene list has sufficient genes (>10 recommended)

Pathway Databases Available

After running ov.utils.download_pathway_database():

  • GO_Biological_Process_2021.txt
  • GO_Molecular_Function_2021.txt
  • GO_Cellular_Component_2021.txt
  • KEGG_2021_Human.txt
  • KEGG_2021_Mouse.txt
  • Reactome_2022.txt
  • WikiPathway_2023_Human.txt
  • And many more...

Best Practices

  1. Always load genesets first: Never pass file paths directly to geneset_enrichment()
  2. Check gene format: Ensure gene symbols match (CAPS for human, Title case for mouse)
  3. Download once: Run download_pathway_database() once per environment
  4. Specify organism: Always set organism='Human' or organism='Mouse'
  5. Use background genes: For more accurate results, provide background parameter

Examples

  • "Run GO enrichment on my DEG results using the correct geneset_prepare workflow"
  • "Perform KEGG pathway analysis on upregulated genes with proper dictionary format"
  • "Compare GO BP, MF, and KEGG enrichment results using geneset_plot_multi"

References

  • Tutorial notebook: t_deg.ipynb (enrichment section)
  • Pathway download: ov.utils.download_pathway_database()
  • Quick reference: reference.md

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

643969

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

591705

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

318398

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

339397

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

451339

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

304231

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.