Skip to content

image

Rendering of SBGN documents as images.

The rendering is performed by the web service of Frank Bergmann at https://sbml.bioquant.uni-heidelberg.de/layout, i.e., it requires an internet connection. For the documentation of the service see http://sysbioapps.spdns.org/Layout.

from pathlib import Path

from libsbgnpy import read_sbgn_from_file, render_sbgn

sbgn = read_sbgn_from_file(Path("map.sbgn"))
render_sbgn(sbgn, Path("map.png"))

render_sbgn

render_sbgn(sbgn, image_file, file_format='png')

Render an SBGN document to an image.

The document is sent to the rendering web service, which lays the map out and returns the image. The request is equivalent to

curl -X POST -F file=@"map.sbgn"         https://sbml.bioquant.uni-heidelberg.de/layout -o map.png

Parameters:

Name Type Description Default
sbgn Sbgn

SBGN document

required
image_file Path

path of the image to create, ending in .<file_format>

required
file_format str

image format, only png is supported

'png'

Raises:

Type Description
ValueError

if the format is not supported or the file has another suffix

RequestException

if the web service cannot be reached or fails