Home
MomaPy
MomaPy is a library for working with molecular maps. It currently supports SBGN and CellDesigner maps. Its key feature is its definition of a map, that is formed of two entities: a model, that describes what concepts are represented, and a layout, that describes how these concepts are represented. This definition is borrowed from SBML and its extensions layout+render, that allow users to add a layout to an SBML model. MomaPy aims at extending this definition to SBGN and CellDesigner maps.
Features of MomaPy include the following:
- support for SBGN PD and AF maps (read/write SBGN-ML with annotations, rendering information, and notes) and CellDesigner (read/write, with annotations and notes)
- read-only support for SBML (model only, no layout)
- decomposition of a map object into:
- a model object;
- a layout object;
- a mapping from layout element objects to model element objects.
- map, model, layout and mapping objects comparison; fast object in set checking
- rendering of maps to images (SVG, PDF, JPEG, PNG, WebP), or onto a Skia canvas for live rendering (via the
skiarenderer) - support for styling and CSS-like stylesheets (including effects such as shadows)
- automatic geometry and anchors (for arcs, shape borders)
- local positioning (e.g. right of shape, fit set of shapes)
- easy extension with new model and layout element types
Installation
MomaPy is available as a Python package and can be installed with pip as follows (Python >=3.10,<=3.14):
pip install momapy
Optional dependencies
MomaPy includes several optional dependencies for rendering maps with the skia or cairo backends:
skia
pip install momapy[skia]
This extra depends on skia-python (https://github.com/kyamagu/skia-python), which itself depends on the following system packages:
- opengl
- libegl
- fontconfig
cairo
pip install momapy[cairo]
This extra depends on pygobject (https://pygobject.gnome.org/guide/sysdeps.html), which itself depends on the following system packages:
- glib
- libffi
all
All optional dependencies can also be installed together:
pip install momapy[all]
Usage
Typical usage of MomaPy includes reading a map and exploring its model:
Or rendering its layout:
MomaPy also provides a command-line interface:
See CLI reference for details.
You can also customize the appearance using CSS-like stylesheets:
User manual
A user manual showcasing the main feature of MomaPy is available here: User manual.
Documentation
A complete documentaton for MomaPy's API is available here: API reference.