Skip to main content

A library to work with molecular maps

Project description

momapy

PyPI Python License Binder Documentation

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 only, with annotations)
  • 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) and other surfaces (e.g. GLFW window)
  • 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.12):

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:

from momapy.io.core import read

map_ = read("my_map.sbgn").obj
for process in map_.model.processes:
    print(process)

Or rendering its layout:

from momapy.rendering.core import render_map

render_map(map_, "my_file.svg")

Demo

Online (no installation required)

Binder

Local

To run the demo locally:

git clone https://github.com/adrienrougny/momapy.git
cd momapy
pip install . jupyter
jupyter notebook demo/demo.ipynb

The demo includes additional files (utils.py, example data) in the demo/ directory that are only available in the repository.

Documentation

The documentation for momapy is available here.

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

momapy-0.4.3.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

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

momapy-0.4.3-py3-none-any.whl (179.9 kB view details)

Uploaded Python 3

File details

Details for the file momapy-0.4.3.tar.gz.

File metadata

  • Download URL: momapy-0.4.3.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for momapy-0.4.3.tar.gz
Algorithm Hash digest
SHA256 ff4f2a62d7cc68ddb502c5daa5ebb46a624c13aa3e47a5b598639be1d2ce73fb
MD5 9171a502aa1792668dafdf5be21708a6
BLAKE2b-256 84b2c57919048921f63020cf4cb220f127cc9798ee96d1bc1a4ae785ccd22ad3

See more details on using hashes here.

Provenance

The following attestation bundles were made for momapy-0.4.3.tar.gz:

Publisher: release.yml on adrienrougny/momapy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file momapy-0.4.3-py3-none-any.whl.

File metadata

  • Download URL: momapy-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 179.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for momapy-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9babd6b871153c4ead538052efae4f4fc352b8a94b5d9567bdc34844e06174ba
MD5 4f4cda532a6f05a541797b6504f6cef2
BLAKE2b-256 754d091d59deac8bcf9e0773e93b17eb6a77d8f91042d7a704d336a5b39f3c60

See more details on using hashes here.

Provenance

The following attestation bundles were made for momapy-0.4.3-py3-none-any.whl:

Publisher: release.yml on adrienrougny/momapy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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