Registry / data / gprofiler-official

gprofiler-official

JSON →
library1.0.0pypypi✓ verified 23d ago

The official Python 3 interface to the g:Profiler toolkit, providing functional enrichment analysis of GO and other terms, conversion between identifier namespaces, and mapping orthologous genes. It is currently at version 1.0.0, released in April 2019, and appears to have a stable, though not rapid, release cadence based on its history.

pip install gprofiler-official
INSTALL
IMPORT
SIG · GPROFILER-OFFICIAL
G
gprofiler-official
datapythonv1.0.0
Install
2.3s avg
Import
371ms
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.384s · 21.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.3s · import 0.358s · 22MB
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GProfiler
from gprofiler import GProfiler

This quickstart demonstrates how to initialize the `GProfiler` client and perform basic functional enrichment analysis (g:GOSt) and gene ID conversion (g:Convert). It's recommended to provide a `user_agent` for API calls and to set `return_dataframe=True` for convenient result handling with pandas.

import os from gprofiler import GProfiler # Initialize GProfiler object # user_agent is optional but good practice to identify your application. # Setting return_dataframe=True makes results easier to work with using pandas. gp = GProfiler( user_agent=os.environ.get('GPROFILER_USER_AGENT', 'MyAwesomeBioTool/1.0'), return_dataframe=True ) # Example: Functional enrichment analysis (g:GOSt) # Query a list of genes for Homo sapiens genes_query = ['NR1H4', 'TRIP12', 'UBC', 'FCRL3', 'PLXNA3', 'GDNF', 'VPS11'] print(f"Querying genes: {genes_query}") results = gp.profile(organism='hsapiens', query=genes_query) print("\nFunctional Enrichment Results (head):") if results is not None and not results.empty: print(results.head()) else: print("No enrichment results found or query failed.") # Example: Gene ID conversion (g:Convert) # Convert gene IDs from one namespace to another convert_query = ['NR1H4', 'TRIP12'] print(f"\nConverting gene IDs: {convert_query}") converted_genes = gp.convert( organism='hsapiens', query=convert_query, target_namespace='ENTREZGENE_ACC' ) print("\nGene ID Conversion Results (head):") if converted_genes is not None and not converted_genes.empty: print(converted_genes.head()) else: print("No conversion results found or query failed.")
gprofiler --version
Debug
Known issues
breakingThe 1.0.x series introduced breaking changes compared to the 0.3.x series. Code written for older versions (e.g., 0.3.5) will not be compatible with 1.0.0 without modifications.
fix
Review the API documentation for version 1.0.0 and update your code accordingly. For legacy projects requiring Python 2, use `pip install gprofiler-official==0.2.3`.
affects: <1.0.0
gotchaThe library is exclusively for Python 3 since version 0.3. Earlier versions (e.g., 0.2.x) were Python 2 compatible. Attempting to use recent versions with Python 2 will result in errors.
fix
Ensure your project is running on Python 3. If Python 2 support is strictly necessary, use version 0.2.3 specifically.
affects: >=0.3.0
gotchaIf identifiers in your query have multiple possible mappings in g:Profiler, they might be excluded by default. This can lead to incomplete results.
fix
Check for identifier discrepancy warnings in the g:Profiler output. You may need to manually map ambiguous genes or re-submit the query with explicit mappings to ensure all identifiers are correctly interpreted.
affects: All
gotchaUsing `return_dataframe=True` (as shown in quickstart) requires the `pandas` library to be installed. If `pandas` is not present, this will lead to an `ImportError` or `ModuleNotFoundError` when results are being processed.
fix
Install `pandas` explicitly if you intend to use the DataFrame output: `pip install pandas`.
affects: All
Errors
Common errors & fixes
ImportError: cannot import name 'GProfiler' from 'gprofiler'
This error typically occurs when trying to import the `GProfiler` class with incorrect capitalization, or if there's an older or conflicting `gprofiler` package installed alongside `gprofiler-official`.
fix
Ensure you have `gprofiler-official` installed (not `gprofiler` or `python-gprofiler`) and use the correct capitalization for the import: `from gprofiler import GProfiler`.
-bash: gprofiler_cli.py: command not found
This indicates that the `gprofiler_cli.py` command-line script is either not installed in a location included in your system's PATH, or it might be deprecated/not the primary way to interact with the `gprofiler-official` library in its current version (1.0.0), which primarily focuses on its Python API.
fix
The recommended way to use `gprofiler-official` (v1.0.0) is through its Python API. Use `from gprofiler import GProfiler` in a Python script and call methods on the `GProfiler` object. If a command-line interface is strictly needed, verify if your installation created a `gprofiler.py` executable in your PATH or check the library's official documentation for alternative CLI usage.
AttributeError: 'list' object has no attribute 'items'
This error occurs when you attempt to call the `.items()` method on a Python list object. The `.items()` method is specific to dictionaries and is used to retrieve key-value pairs. This can happen if the `gprofiler` method returns a list of results (e.g., a list of dictionaries) and you mistakenly try to treat the entire list as a single dictionary.
fix
If the `gprofiler` method returns a list, you need to iterate through the list to access individual dictionary items within it. Alternatively, initialize `GProfiler` with `return_dataframe=True` to get results as a pandas DataFrame, which offers different methods for data access. For example: `gp = GProfiler(return_dataframe=True)`.
Upgrade
Version history
1.0.0latest on PyPI · released Apr 2, 2019
Audit
Dependencies
pandasoptionalRequired if 'return_dataframe=True' is used for results processing.
Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
gprofiler-official — pip install gprofiler-official · libregistry