Skip to main content

Enrichment analysis and visualisation toolkit for KEGG pathways

Project description

keggtools

Library for KEGG pathway enrichment analysis.

Documentation: https://keggtools.org/

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

Installation

keggtools only supports python version greater than or equal 3.8.

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

Run linting with pylint for keggtools package.

# Run linting for package
make pylint

Static code analysis

Static code analysis using mypy. Run static code analysis with mypy.

# Run static code analysis
make mypy

Testing

Run unittest for keggtools package.

# Run unittest for package
make pytest

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 twine

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.0.2.tar.gz (31.9 kB view details)

Uploaded Source

Built Distribution

keggtools-1.0.2-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: keggtools-1.0.2.tar.gz
  • Upload date:
  • Size: 31.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.0

File hashes

Hashes for keggtools-1.0.2.tar.gz
Algorithm Hash digest
SHA256 1b1db71eb28d30bc12e1c26053f4999bd6e050d8e008deb7bff867fb11536587
MD5 927477abe47233707390047765cbd445
BLAKE2b-256 d0476c87d734c457f47aa8a63b4e05c46c9bd67da7b95eadd36df11be95ee113

See more details on using hashes here.

File details

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

File metadata

  • Download URL: keggtools-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.0

File hashes

Hashes for keggtools-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1e493cb05eb22759f62091bdc66a80b7941b0611536a9aba4e6e91f7d26cadfb
MD5 2d6362a6aa7fdcd5f7b68adcfd49ee27
BLAKE2b-256 eb82756e05d396d0c479c156b1da4197d7b18e7b46a46a6192cbc394d070bd86

See more details on using hashes here.

Supported by

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