Skip to main content

Application of KEGG REST API with DRF(DjangoRestFramework)

Installation

python3 -m pip install django_rest_kegg

Install App to Your Djanog Rest Project

1 edit proj/settings.py

INSTALL_APPS += [
    'rest_framework',
    'django_rest_kegg'
]

# the path to store image and conf files
KEGG_DB_PATH = './keggdb'

2 edit proj/urls.py

urlpatterns += [
    path('kegg/', include('django_rest_kegg.urls')),
]

Initialize KEGG Database

# migarate database
python3 manage.py makemigrations django_rest_kegg
python3 manage.py migrate

# download image and conf files for all pathways
# and build table
python3 manage.py build [--dbpath PATH] [--drop]

# everything is ok, enjoy it!
python3 manage.py runserver

Endpoints

/kegg/pathway list all pathways

/kegg/pathway?path=<PATH>&type=<TYPE>&gene=<GENE>&color=<COLOR>

  • path: a map number, eg. map00010
  • type: conf, svg or png [default: png]
  • color: default color [default: green]
  • gene: genes to be highlighted, example formats:
    • gene={"red":"K00886,K01222,K01223"}
    • gene={"FF00FF":"K00886,K01222,K01223"}
    • gene={"red":"K00886,K01222","blue":"K01610,K00918"}
    • gene=["K00886,K01222,K01223"]
    • gene=["K00886,K01222,K01223"]&color=pink

Demo Project

git clone https://www.github.com/suqingdong/django_rest_kegg.git

cd django_rest_kegg/demo

python3 manage.py makemigrations django_rest_kegg

python3 manage.py migrate
# Operations to perform:
#   Apply all migrations: admin, auth, contenttypes, django_rest_kegg, sessions
# Running migrations:
#   Applying contenttypes.0001_initial... OK
#   Applying auth.0001_initial... OK
#   Applying admin.0001_initial... OK
#   ...
#   Applying django_rest_kegg.0001_initial... OK
#   Applying sessions.0001_initial... OK

python3 manage.py build

python3 manage.py runserver

Metadata

Release files for django-rest-kegg 1.0.7

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

Source distribution (sdist)

Source distribution for django-rest-kegg 1.0.7
File Size Uploaded
django_rest_kegg-1.0.7.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-rest-kegg 1.0.7
File Interpreter ABI Platform
django_rest_kegg-1.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 16.2 kB

Release files / django_rest_kegg-1.0.7.tar.gz

Download URL django_rest_kegg-1.0.7.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
42f259956ede32d431bf416bb70479241e65efd74b187e0411275a8259e1523d
BLAKE2b-256 checksum
How to use checksums
41d1bb72dd81e762ff3bf5081005a80f4534b4a5c2b6b05fb2d3affa5ac5f471
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.3

Release files / django_rest_kegg-1.0.7-py3-none-any.whl

Download URL django_rest_kegg-1.0.7-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
841e7c8f73afbf375bcfeee7818317c138af7485721126b4eed9be9e03bd77b3
BLAKE2b-256 checksum
How to use checksums
a95c739287af5e145424061d2e31f05cf9ff94620061f9c7b9b8438a2fdaa53d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.3

Release history Release notifications | RSS feed

This release

1.0.7 This release

2 release files

1.0.6

2 release files

1.0.5

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

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