示例#1
0
# Draw Pink and Green 
sl.drawNetwork()

new_model_file = model_dir + "render_sbml_pink_green.xml"
print("new model file: ", new_model_file)

sl.addRenderInformation()

sl.writeSBMLFile(new_model_file)

sl_apply = SBMLlayout(new_model_file)

# Read in and Draw Pink and Green
sl_apply.drawNetwork()

sl_apply.setNodeEdgeColor("S1", "black")
sl_apply.setNodeEdgeColor("S2", "black")

sl_apply.setReactionColor("_J0", "orange")

# Add edge color and change reaction color
sl_apply.drawNetwork()

local_model_file = model_dir + "render_had_local_already.xml"

sl_apply.addRenderInformation()

sl_apply.writeSBMLFile(local_model_file)

sl_local = SBMLlayout(local_model_file)
示例#2
0
sl._describeModel()

sl.drawNetwork()
#r = Render(model_file, sl.layout_number)
#r._describeRenderInfo()

#print("render: ", type(r))
#print("num layouts: ", r.layout_plugin.getNumLayouts())

#sl._applyRenderInformation(None)

#a0e0a030

reactionIds = sl.getReactionIds()

sl.setNodeColor("all", "#0000ff30")
sl.setReactionColor("all", "blue")

sl.setNodeEdgeColor("F", "blue")
sl.setNodeFillColor("F", "lightgreen")
sl.setNodeFontFamily("ABCDEFG", "Elephant")
sl.setNodeFontColor("ABCDEFG", "green")
sl.setNodeEdgeColor("ABCDEFG", "blue")

for reactionId in reactionIds:
    sl.setReactionCurveWidth(reactionId, 1)
    sl.setReactionFillColor(reactionId, "red")

sl.drawNetwork(save_file_name="C:\\tmp\\larger_pathway_set_changes_tight.png",
               bbox_inches="tight")
示例#3
0
sl.getArrowheadVert(1, 1)

centroid = sl.getNodeCentroid("X0")
print("centroid: ", centroid)

centroid = sl.getReactionCentroid("_J0")
print("rxn centroid: ", centroid)
#centroid = sl.getReactionCentroid("J0")
#print("rxn centroid: ", centroid)

print("X0", sl.getNodeColor("X0"))
#print("X", sl.getNodeColor("X"))

sl.setNodeColor("all", "lightpink")
sl.setNodeEdgeColor("all", "purple")
sl.setNodeEdgeColor("X0", "green")
sl.setNodeFillColor("X0", "yellow")
sl.setNodeEdgeWidth("all", 2)
sl.setNodeEdgeWidth("X1", 5)
sl.setNodeEdgeWidth(["A", "B", "C"], 3)

sl.setReactionCurveWidth("_J0", 3)
sl.setReactionColor("all", "purple")
sl.setReactionColor("_J0", "green")

# KeyError in setter
#sl.setReactionColor("_J", "green")
# ValueError in matplotlib
#sl.setReactionColor("_J1", "greene")
示例#4
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"))
示例#5
0
model_file_name = "model.xml"

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",
示例#6
0
layout.regenerateLayout()
layout.regenerateLayout()
layout.regenerateLayout()
layout.regenerateLayout()
[layout.setCompartmentEdgeColor(i, 'grey') for i in layout.getCompartmentIds()]
[layout.setCompartmentLineWidth(i, 10) for i in layout.getCompartmentIds()]
[layout.setNodeEdgeWidth(i, 10) for i in layout.getNodeIds()]
[layout.setNodeFontSize(i, 40) for i in layout.getNodeIds()]
[
    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('compartment_network.png')

# layout.regenerateLayout()
# layout.regenerateLayout()
# layout.regenerateLayout()
# layout.regenerateLayout()
# layout.regenerateLayout()
# layout.drawNetwork('compartment_network.png')
#
# layout.writeSBMLFile('2CompartmentModelWithLayout.xml')
#
# from libsbml_draw.model.sbml_layout import SBMLlayout
#
# # Create a SBMLlayout object.
# layout = SBMLlayout('2CompartmentModel.xml')