GSEApy - Gene Set Enrichment Analysis

1.1.13 · active · verified Thu Apr 16

GSEApy is a Python package for performing Gene Set Enrichment Analysis (GSEA) and other related methods like Enrichr, ssGSEA, and GSVA. It provides functionality to analyze gene expression data to identify significantly enriched gene sets and pathways. Currently at version 1.1.13, the library is actively maintained with frequent minor releases addressing bug fixes, compatibility updates, and API improvements, especially for integration with bioinformatics tools and data formats.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to perform an Enrichr analysis using a simple gene list. It will download specified gene set libraries (if not cached) and generate enrichment results in the specified output directory. For GSEA, expression data and class vectors are typically required.

import gseapy as gp
import os

# Example gene list for Enrichr
gene_list = ['TP53', 'MYC', 'EGFR', 'BRAF', 'KRAS', 'RB1', 'PTEN', 'PIK3CA']

# Run Enrichr analysis
enr = gp.enrichr(
    gene_list=gene_list,
    gene_sets=['KEGG_2021_Human', 'GO_Biological_Process_2021'], # Specify gene set libraries
    organism='Human', # Default
    outdir='enrichr_results_example', # Output directory
    cutoff=0.5, # P-value cutoff for results
    no_plot=True, # Set to False to generate plots
    verbose=False
)

print(f"Enrichr results saved to: {enr.outdir}")

# Optional: Clean up the generated directory
# import shutil
# if os.path.exists('enrichr_results_example'):
#     shutil.rmtree('enrichr_results_example')

view raw JSON →