Library for KEGG pathway enrichment analysis.
Documentation: https://keggtools.org/
PyPi: https://pypi.org/project/keggtools/
keggtools
only supports python>=3.10
.
Dependencies
graphviz
python
dependencies
requests
pydot
scipy
Installation keggtools
package using pip
:
python3 -m pip install keggtools
To get a more detailed list of install options, please read the INSTALL.md
from keggtools import Resolver, IMMUNE_SYSTEM_PATHWAYS
ORGANISM_ID = "hsa"
resolver = Resolver()
# Select first immune system pathway as example
pathway_id = list(IMMUNE_SYSTEM_PATHWAYS.keys())[1]
# Resolve pathway
pathway = resolver.get_pathway(organism=ORGANISM_ID, code=pathway_id)
print(pathway)
from keggtools import Enrichment
# Add pathway object to list
pathway_list = []
# Init analysis with organism code
analysis = Enrichment(pathways=pathway_list)
# Study genes as list of entrez gene id's
study_genes = []
analysis.run_analysis(gene_list=study_genes)
# to_dataframe method requires pandas installation
result = analysis.to_dataframe()
print(result.head())
from keggtools.render import Renderer
# Load and parse pathway
renderer = Renderer(kegg_pathway=pathway)
# Render to dot graph
renderer.render()
# Export to png
renderer.to_file("output.png", extension="png")
Fast install with virtualenv
for development.
python3 -m virtualenv venv
source ./venv/bin/activate
pip install --upgrade pip
# Install from requirements
pip install -r requirements.txt
# Or use makefile
make install
ruff
is used for linting and formatting.
# Run formatter
make format
Static code analysis using mypy
.
# Run static code analysis
make typing
Run unittest for keggtools
package. This uses pytest
and coverage
.
# Run unittest for package
make testing
The package is using the flit
backend with a pyproject.toml
and twine
. To install from repo use
# Install package from repo
make build
MIT