Skip to main content

kegg-map-kit

CI Python Dependencies License

Colour KEGG pathway maps from a table of KEGG Ontology (KO) identifiers and render the result as SVG. A scriptable, SVG-producing counterpart to the KEGG Mapper Color tool.

Zero runtime dependencies — Python 3.10+ and the standard library.

Example

Glycolysis coloured by log2 fold change

Glycolysis (ko00010) coloured from twelve values. Each box carries its EC number redrawn on top of an opaque fill, so the caption stays legible at any colour; the value is printed beneath; KO boxes with no data are grey; and the colorbar is pinned to a fixed range so separate maps stay comparable.

kegg-map-kit ko00010 -i examples/demo.tsv -o glycolysis.svg \
    --cmap coolwarm --vmin -2.5 --vmax 2.5 \
    --box-labels ec --unmapped-color '#ececec' --label-values

The numbers in examples/demo.tsv are synthetic. examples/glycolysis_vector.svg is the same data through --mode vector: no bitmap at all, so it rasterises losslessly at any resolution, at the cost of KEGG's arrows and decorations.

Install

uv tool install kegg-map-kit
# or
pip install kegg-map-kit

Use

kegg-map-kit ko00010 -i data.tsv -o map.svg

data.tsv holds a KO identifier per line, followed by either colours or numbers:

K00844	#ff0000
K01810	blue
K00845	#00ff00,#000000

The third line uses KEGG Mapper's bg,fg syntax: the second colour sets the box's label colour in --mode vector. Fields may be separated by tabs, commas or spaces, so a file written for KEGG Mapper works unchanged. Only whole lines beginning with # are treated as comments; there are no trailing comments.

or values, which are mapped through a colormap and get a legend:

K00844	2.0	1.4
K01810	-1.5	-0.2

Several columns, or several KOs sharing one box, split that box into vertical slices (up to 12).

Options

Flag Default Meaning
--mode raster|vector raster raster embeds KEGG's map PNG and paints on top; vector redraws boxes from KGML alone
--cmap NAME coolwarm coolwarm, RdBu, viridis, Reds, Blues
--vmin / --vmax auto Colour scale bounds. Diverging maps auto-scale symmetrically
--opacity 0.75 Overlay opacity in raster mode
--offline off Use the cache only, never the network
--cache DIR $XDG_CACHE_HOME/kegg-map-kit, else ~/.cache/kegg-map-kit Cache location
--kgml / --png — Use local files instead of fetching
--na-color COLOR — Fill for blank cells; blank cells are skipped by default
--unmapped-color COLOR — Fill for KO boxes the input has no data for. Boxes carrying no KO at all (compounds, links to other maps) are left as KEGG drew them
--box-labels ko|symbol|ec — Repaint each box's caption on top of the fill, so an opaque colour stays readable. ec reproduces the string KEGG itself prints in the box. Implies --opacity 1.0
--box-label-color, --box-label-size auto, 7 Box label colour (default: auto black/white by fill darkness) and font size
--blend normal|multiply normal multiply keeps KEGG's own captions legible under a translucent fill
--label-values off Print each value beneath its box. Value input only
--label-size 7 Font size for --label-values
--no-legend, --no-links — Suppress the colorbar / the links to KEGG
-q off Suppress the summary line

Coloured boxes carry hover text and link to their KEGG entry page.

KEGG data is cached indefinitely under --cache; delete that directory to refresh.

Exit codes

Code Meaning
0 Success
1 User error — bad pathway id, unusable command line, malformed input table, unknown colormap, --png with --mode vector, offline cache miss, KEGG 404, corrupt map image
2 Network failure with no usable cache

Exit 2 means the network, and only the network, so a script can retry on 2 and give up on 1.

Scope

v0.1.0 handles KO-level maps (ko#####) and colours rectangle entries only. Compounds, organism-specific gene IDs, and the line-based global maps such as ko01100 are not coloured.

Licence

MIT. KEGG data is © Kanehisa Laboratories and is subject to the KEGG terms of use; this tool only retrieves and renders it.

Metadata

Release files for kegg-map-kit 0.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 kegg-map-kit 0.1.0
File Size Uploaded
kegg_map_kit-0.1.0.tar.gz 159.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kegg-map-kit 0.1.0
File Interpreter ABI Platform
kegg_map_kit-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 182.4 kB

Release files / kegg_map_kit-0.1.0.tar.gz

Download URL kegg_map_kit-0.1.0.tar.gz
Size 159.4 kB
Tags Source
SHA-256 checksum
How to use checksums
882fc3a1acb1bfc0b23a455bae9c54a49634823ca2e2a6954a5c19d7a4676d68
BLAKE2b-256 checksum
How to use checksums
3c70f2393531e9b1142ac6eb3374e7b51a1ca31701ce0822dc68a6742e31b6bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 17, 2026.

Transparency log

Release files / kegg_map_kit-0.1.0-py3-none-any.whl

Download URL kegg_map_kit-0.1.0-py3-none-any.whl
Size 23.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
49c31166af692f82855b992c4d594b8b55d0b172c60a449965675fd7f401910c
BLAKE2b-256 checksum
How to use checksums
1858c85214c666d15ca9b0be3e66a9448bb2531705648995f3d3b577b11a1ba3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

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