Example #1
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()
# layout.drawNetwork('compartment_network.png')
Example #2
0
sl.setReactionColor("_J0", "red", species="A")

sl.setReactionEdgeColor("_J3", "#0000ff30")

sl.setReactionEdgeColor("_J4", "pink", species="D")

# only applies to FancyArrowPatch arrowhead
sl.setReactionFillColor("_J2", "lightgreen")

sl.setReactionCurveWidth("_J0", 5, role_name="product")
sl.setReactionCurveWidth("_J4", 10)
sl.setReactionCurveWidth(["_J1", "_J2", "_J3"], 15)

sl.setNodeFillColor("A", "pink")
sl.setNodeEdgeColor("all", "green")
sl.setNodeEdgeWidth(["D", "X1", "C"], 3)

sl.setNodeFontWeight(["X0", "A", "B", "C", "D", "X1"], "bold")

sl.setNodeTextAnchor("X0", "right")
sl.setNodeTextAnchor("A", "left")
sl.setNodeVTextAnchor("B", "center")

sl.drawNetwork()

print("_J0 width: ", sl.getReactionCurveWidth("_J0"))

print("_J1 edge color: ", sl.getReactionEdgeColor("_J1"))
print("_J1 fill color: ", sl.getReactionFillColor("_J1"))

print("_J3 edge color: ", sl.getReactionEdgeColor("_J3"))
Example #3
0
model_file = Path(
    pkg_resources.resource_filename("libsbml_draw",
                                    "model/data/" + model_file_name))

sl = SBMLlayout(str(model_file))

sl._describeModel()

print("node ids: ", sl.getNodeIds())
print("reaction ids: ", sl.getReactionIds())

sl.drawNetwork()

sl._describeReaction(0)

sl.setNodeEdgeWidth("all", 2)

out_file = "model_out.xml"
sl.writeSBMLFile("model_out.xml")

sl2 = SBMLlayout(out_file)

print("sl2 layoutSpecified: ", sl2._SBMLlayout__layoutSpecified)

sl2.drawNetwork()

sl.getArrowheadVert(1, 1)

centroid = sl.getNodeCentroid("X0")
print("centroid: ", centroid)
Example #4
0
model_file = Path(
    pkg_resources.resource_filename("libsbml_draw",
                                    "model/data/" + model_file_name))

applyRender = True

sl = SBMLlayout(str(model_file), applyRender=applyRender)

sl._describeModel()

sl.setReactionCurveWidth("all", 5)
sl.setReactionCurveWidth("_J0", 7, role_name="product")

sl.setNodeEdgeColor("X1", "#ff0000")
sl.setNodeFillColor("X1", "#ff000030")
sl.setNodeEdgeWidth("X1", 3)
sl.setNodeFontWeight(["A", "B", "C", "D"], "bold")

sl.setReactionEdgeColor("_J0", "#ff0000", role_name="product")
sl.setReactionEdgeColor("_J1", "#ff00ff", role_name="substrate")
sl.setReactionEdgeColor("_J2", "#ff00ff", role_name="product")
sl.setReactionEdgeColor("_J5", "#00ff00", species="D")
sl.setReactionEdgeColor("_J3", "#ffff00", role_name="product")
sl.setReactionEdgeColor("_J4", "#00ffff")

model_file_name = "ftest_no_layout.xml"

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