Skip to main content

Enrichment analysis and visualisation toolkit for KEGG pathways

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keggtools-1.1.0.tar.gz (45.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

keggtools-1.1.0-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

Details for the file keggtools-1.1.0.tar.gz.

File metadata

  • Download URL: keggtools-1.1.0.tar.gz
  • Upload date:
  • Size: 45.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for keggtools-1.1.0.tar.gz
Algorithm Hash digest
SHA256 72e1013a028972a975ad3d89a81c445aae1492c848c44b45a1da3c169be23dab
MD5 683996181e153e9db06589c6ca4d8008
BLAKE2b-256 82c85f6c8b2199a12a4e9e21c4e983e9b1e1dfcc2374c8d192880dcbf60637a4

See more details on using hashes here.

File details

Details for the file keggtools-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: keggtools-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 33.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for keggtools-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6cf201248336524df4c06fb2ff56f7092424843e42caf6f857543c9e533fedac
MD5 359b3c012d0d7e341192d3c1501c6522
BLAKE2b-256 98e18ce1563aa9be33822679d655b177621524fb7d43577081fc6eb10ae26caf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page