{"id":8207,"library":"gseapy","title":"GSEApy - Gene Set Enrichment Analysis","description":"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.","status":"active","version":"1.1.13","language":"en","source_language":"en","source_url":"https://github.com/zqfang/GSEApy","tags":["biology","bioinformatics","gene set enrichment analysis","GSEA","enrichr","ssgsea","data analysis"],"install":[{"cmd":"pip install gseapy","lang":"bash","label":"Install latest stable version"}],"dependencies":[{"reason":"Numerical operations and array handling.","package":"numpy"},{"reason":"Data manipulation with DataFrames, crucial for input/output and internal data structures.","package":"pandas"},{"reason":"Scientific computing, statistical tests, and clustering algorithms.","package":"scipy"},{"reason":"Plotting and visualization of enrichment results.","package":"matplotlib"},{"reason":"Enhanced logging for better debugging and user feedback.","package":"loguru"}],"imports":[{"symbol":"gsea","correct":"import gseapy as gp\ngp.gsea(...)"},{"symbol":"enrichr","correct":"import gseapy as gp\ngp.enrichr(...)"},{"symbol":"prerank","correct":"import gseapy as gp\ngp.prerank(...)"},{"symbol":"ssgsea","correct":"import gseapy as gp\ngp.ssgsea(...)"},{"symbol":"plot","correct":"import gseapy as gp\ngp.plot.dotplot(...)"}],"quickstart":{"code":"import gseapy as gp\nimport os\n\n# Example gene list for Enrichr\ngene_list = ['TP53', 'MYC', 'EGFR', 'BRAF', 'KRAS', 'RB1', 'PTEN', 'PIK3CA']\n\n# Run Enrichr analysis\nenr = gp.enrichr(\n    gene_list=gene_list,\n    gene_sets=['KEGG_2021_Human', 'GO_Biological_Process_2021'], # Specify gene set libraries\n    organism='Human', # Default\n    outdir='enrichr_results_example', # Output directory\n    cutoff=0.5, # P-value cutoff for results\n    no_plot=True, # Set to False to generate plots\n    verbose=False\n)\n\nprint(f\"Enrichr results saved to: {enr.outdir}\")\n\n# Optional: Clean up the generated directory\n# import shutil\n# if os.path.exists('enrichr_results_example'):\n#     shutil.rmtree('enrichr_results_example')","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade gseapy to version 1.1.13 or newer: `pip install --upgrade gseapy`.","message":"Versions of gseapy prior to 1.1.12 may encounter compatibility issues when used with Pandas 3.0+, leading to `AttributeError` or `TypeError` during data processing and plotting. Key fixes were implemented in v1.1.12 and v1.1.13.","severity":"breaking","affected_versions":"<1.1.12"},{"fix":"Update gseapy to v1.1.8 or later and re-run any affected analyses: `pip install --upgrade gseapy`.","message":"A bug in gseapy v1.1.6 and v1.1.7 caused incorrect gene name order when calling `gsea()` with `permutation_type='gene_set'`, leading to potentially invalid results.","severity":"breaking","affected_versions":"1.1.6, 1.1.7"},{"fix":"Upgrade your Python environment to 3.8 or newer before installing gseapy: `conda create -n myenv python=3.9 && conda activate myenv`.","message":"GSEApy dropped support for Python 3.7 starting with version 1.1.10. Attempting to install or run gseapy 1.1.10+ on Python 3.7 will likely lead to dependency resolution errors or runtime issues.","severity":"deprecated","affected_versions":">=1.1.10 (for Python 3.7 users)"},{"fix":"Ensure you are using gseapy v1.1.9 or newer to guarantee consistent results across runs: `pip install --upgrade gseapy`.","message":"Results from `gsea()` or `prerank()` might be inconsistent between different runs or environments due to a potential compilation issue, which was addressed in v1.1.9.","severity":"gotcha","affected_versions":"<1.1.9"},{"fix":"Standardize all gene symbols to uppercase in your input data (e.g., `df.index = df.index.str.upper()`) before running GSEApy functions. Review the `no_genes` column in Enrichr results or the `data.gsea_data.genes.not_found` attribute for GSEA results.","message":"Gene symbol matching can be sensitive to casing. Although gseapy attempts to convert lowercase symbols to uppercase implicitly (since v1.1.5), inconsistent casing between your input data and gene set libraries can lead to genes not being found and thus ignored.","severity":"gotcha","affected_versions":"<1.1.5, all (best practice)"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Update gseapy to the latest version (1.1.13 or newer): `pip install --upgrade gseapy`.","cause":"This error often occurs when `gseapy.dotplot` or `gseapy.load_gmt` is used with Pandas 3.0+ and an older gseapy version.","error":"TypeError: 'Gene_sets' object is not subscriptable"},{"fix":"Ensure all gene identifiers in your input DataFrame's index are strings. Convert them explicitly if necessary (e.g., `df.index = df.index.astype(str)`).","cause":"This typically arises when gene names in your input data are not strings (e.g., integers) or contain mixed types, and gseapy attempts to call string methods like `.upper()` on them. This was partly addressed for Pandas 3.0 compatibility.","error":"AttributeError: 'int' object has no attribute 'upper'"},{"fix":"Verify that `gene_list` contains valid gene symbols and is not empty. Update gseapy to 1.1.4 or newer for better error handling.","cause":"Using an empty or invalid gene list as input to `gseapy.enrichr` or other functions, especially in gseapy versions prior to 1.1.4.","error":"ValueError: The gene_list cannot be empty, please input a list of gene symbols. (or similar error with empty gene lists)"},{"fix":"Upgrade gseapy to v1.1.8 or later (`pip install --upgrade gseapy`) and re-run your analysis.","cause":"A bug in gseapy v1.1.6 and v1.1.7 caused the gene name order to be inconsistent, leading to unreliable results for gene-set permutations.","error":"GSEA results are inconsistent across different runs or machines when permutation_type='gene_set'."}]}