from libsbml_draw.model.sbml_layout import SBMLlayout

model_file_name = "simple-L2-render-local.xml"
#model_file_name = "simple-L2-render-local-L3V1.xml"

model_file = Path(
    pkg_resources.resource_filename("libsbml_draw",
                                    "model/data/" + model_file_name))

sl = SBMLlayout(str(model_file))

sl._describeModel()

sl.drawNetwork()

sl.setCompartmentEdgeColor("vol1", "#0000ff")
sl.setCompartmentFillColor("vol1", "#ff000010")
sl.setCompartmentLineWidth("vol1", 5)

assert sl.getCompartmentEdgeColor("vol1") == "#0000ffff"
assert sl.getCompartmentFillColor("vol1") == "#ff000010"
assert sl.getCompartmentLineWidth("vol1") == 5

sl.drawNetwork("simple_render_local.png")

sl.writeSBMLFile("simple_render_local_out.xml")

slr = SBMLlayout("simple_render_local_out.xml")

slr.drawNetwork()
Exemple #2
0
Sometimes run into problems with a canvas which is too big (like in the schmerier 2008 model)

SBO term unexpected warning. Where does it come from 

Gradient colours are cool. Would like to see them. 

Font size should scale with scaling factor
'''

layout = SBMLlayout('Kholodenko2000.xml')
# print(layout.getNumberOfRoles())

layout.regenerateLayout()

[layout.setCompartmentEdgeColor(i, 'grey') for i in layout.getCompartmentIds()]
[layout.setNodeEdgeWidth(i, 10) for i in layout.getNodeIds()]
[layout.setNodeFontSize(i, 40) for i in layout.getNodeIds()]
[layout.setCompartmentLineWidth(i, 25) for i in layout.getCompartmentIds()]
# [layout.setReactionEdgeColor(i, edge_color='black') for i in layout.getReactionIds()]
[layout.setReactionCurveWidth(i, 10) for i in layout.getReactionIds()]
[layout.setArrowheadScale(i, 50) for i in range(layout.getNumberOfRoles())]
# [layout.setNodeColor(i, 'white') for i in layout.getNodeIds()]
# [layout.setNodeEdgeColor(i, 'black') for i in layout.getNodeIds()]
layout.drawNetwork('Kholodenko2000Layout.png', scaling_factor=1.5)

# layout.regenerateLayout()
# layout.regenerateLayout()
# layout.regenerateLayout()
# layout.regenerateLayout()
# layout.regenerateLayout()