Skip to main content

pysbgn: supporting SBGN-ML v0.3 in Python

This package provides support for writing and reading SBGN-ML v0.3 files. The code is auto-generated using generateDS with a few code fixes and modifications making it compatible with libsbgn-python (which supports only SBGN-ML v0.2).

Requirements

python 3.5+

Installation

pip install pysbgn

Examples

The read/write API is the same as in libsbgn-python so you can use the examples from libsbgn-python documentation. Just make sure that the import statements are compatible with libsbgn-python as shown below. Note, however, that additional modules of libsbgn-python such as utils and render are not provided.

from pysbgn import sbgn_core as libsbgn
from pysbgn.sbgn_core import notesType as Notes
from pysbgn.sbgn_core import extensionType as Extension
from pysbgn.sbgn_types import Language, Orientation, GlyphClass, ArcClass, Name, Version, ArcGroupClass

A simple example

Note: this example is taken from libsbgn-python and shortened to included only three glyphs and two arcs.

from pysbgn import sbgn_core as libsbgn
from pysbgn.sbgn_types import Language, GlyphClass, ArcClass, Orientation

sbgn = libsbgn.sbgn()
map = libsbgn.map()
map.set_language(Language.PD)
sbgn.set_map(map)

# create a bounding box for the map
box = libsbgn.bbox(x=0, y=0, w=363, h=253)
map.set_bbox(box)

# two glyphs with labels
g = libsbgn.glyph(class_=GlyphClass.SIMPLE_CHEMICAL, id='glyph1')
g.set_label(libsbgn.label(text='Ethanol'))
g.set_bbox(libsbgn.bbox(x=40, y=120, w=60, h=60))
map.add_glyph(g)

g = libsbgn.glyph(class_=GlyphClass.SIMPLE_CHEMICAL, id='glyph_ethanal')
g.set_label(libsbgn.label(text='Ethanal'))
g.set_bbox(libsbgn.bbox(x=220, y=110, w=60, h=60))
map.add_glyph(g)

# glyph with ports (process)
g = libsbgn.glyph(class_=GlyphClass.PROCESS, id='pn1', orientation=Orientation.HORIZONTAL)
g.set_bbox(libsbgn.bbox(x=148, y=168, w=24, h=24))
g.add_port(libsbgn.port(x=136, y=180, id="pn1.1"))
map.add_glyph(g)

# arcs
a = libsbgn.arc(class_=ArcClass.CONSUMPTION, source="glyph1", target="pn1.1", id="a01")
a.set_start(libsbgn.startType(x=98, y=160))
a.set_end(libsbgn.endType(x=136, y=180))
map.add_arc(a)

a = libsbgn.arc(class_=ArcClass.PRODUCTION, source="pn1.1", target="glyph_ethanal", id="a05")
a.set_start(libsbgn.startType(x=184, y=180))
a.set_end(libsbgn.endType(x=224, y=154))
map.add_arc(a)

sbgn.export('result.xml')

Author

Vid Podpečan (vid.podpecan@ijs.si)

License

MIT

Metadata

Release files for pysbgn 0.2.1

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

Source distribution (sdist)

Source distribution for pysbgn 0.2.1
File Size Uploaded Provenance Actions
pysbgn-0.2.1.tar.gz 29.9 kB Without provenance Details for pysbgn-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pysbgn 0.2.1
File Interpreter ABI Platform Actions
pysbgn-0.2.1-py3-none-any.whl Python 3 none any Details for pysbgn-0.2.1-py3-none-any.whl

Total release size: 59.0 kB

Release files / pysbgn-0.2.1.tar.gz

Download URL pysbgn-0.2.1.tar.gz
Size 29.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b73416523f02c09569548e7315b41d04c515bee23f0e3171df6186a263b76bd2
BLAKE2b-256 checksum
How to use checksums
1196269e81fbec136f8adad03ddbaf1c7bf61b6eb86fb2878136625d2c074c6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.10

Release files / pysbgn-0.2.1-py3-none-any.whl

Download URL pysbgn-0.2.1-py3-none-any.whl
Size 29.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50ace8458f63c40da243e283fb727c56d7f87f6a5a1b71d2505742801c290c92
BLAKE2b-256 checksum
How to use checksums
9c0765085510a257d65d8d3202f430b19480bba2f4d5324cb32e879be3bc0a46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.10

Security for pysbgn 0.2.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files No provenance

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