Skip to main content

keggtools

Version codecov PyPI - Python Version GitHub Actions Workflow Status DOI

Library for KEGG pathway enrichment analysis.

Documentation: https://keggtools.org/

PyPi: https://pypi.org/project/keggtools/

Installation

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

API

Download and Parsing

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)

Enrichment and Testing

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())

Rendering

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")

Development

Dev installation

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

Linting

ruff is used for linting and formatting.

# Run formatter
make format

Static code analysis

Static code analysis using mypy.

# Run static code analysis
make typing

Testing

Run unittest for keggtools package. This uses pytest and coverage.

# Run unittest for package
make testing

Install package from repo

The package is using the flit backend with a pyproject.toml and twine. To install from repo use

# Install package from repo
make build

License

MIT

Metadata

Release files for keggtools 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for keggtools 1.1.0
File Size Uploaded
keggtools-1.1.0.tar.gz 45.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for keggtools 1.1.0
File Interpreter ABI Platform
keggtools-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 79.3 kB

Release files / keggtools-1.1.0.tar.gz

Download URL keggtools-1.1.0.tar.gz
Size 45.7 kB
Tags Source
SHA-256 checksum
How to use checksums
72e1013a028972a975ad3d89a81c445aae1492c848c44b45a1da3c169be23dab
BLAKE2b-256 checksum
How to use checksums
82c85f6c8b2199a12a4e9e21c4e983e9b1e1dfcc2374c8d192880dcbf60637a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release files / keggtools-1.1.0-py3-none-any.whl

Download URL keggtools-1.1.0-py3-none-any.whl
Size 33.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6cf201248336524df4c06fb2ff56f7092424843e42caf6f857543c9e533fedac
BLAKE2b-256 checksum
How to use checksums
98e18ce1563aa9be33822679d655b177621524fb7d43577081fc6eb10ae26caf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page