Ejemplo n.º 1
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")
Ejemplo n.º 2
0
#model_file = Path(pkg_resources.resource_filename("libsbml_draw", "model_files/model.xml"))

print("model file: \n", model_file)

sl = SBMLlayout(model_file)

sl._describeModel()

## Draw Original copasi.xml
sl.drawNetwork()

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

sl.setNodeFontStyle("S1", "italic")
sl.setNodeColor("S1", "lightpink")
sl.setNodeColor("S2", "lightgreen")

sl.setNodeFontColor("S1", "white")
sl.setNodeFontStyle("S1", "italic")

sl.setReactionColor("_J0", "blue")
sl.setReactionCurveWidth("_J0", 1)

# 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()
Ejemplo n.º 3
0
# describe network
print("num nodes: ", sl.getNumberOfNodes())
print("num reactions: ", sl.getNumberOfReactions())

# create network
sl._createNetwork()

# draw network
sl.drawNetwork()

# print node id's
print("node ids: ", sl.getNodeIds())

if "copasi" in model_file:
    # set node properties
    sl.setNodeColor("S1", "pink")
    sl.setNodeColor("S2", "green")
    sl.setNodeColor("S1", "Verdana")
    sl.setNodeColor("S1", "white")
    sl.setNodeFontsize("S1", 18)
    sl.setNodeFontstyle("S1", "italic")

    sl.setNodeFontsize("S2", 24)
    sl.setNodeFontstyle("S2", "oblique")
    sl.setNodeFontcolor("S2", "yellow")

# print reaction id's
print("reaction ids: ", sl.getReactionIds())

#sl.setReactionColor("_J0", "orange")
#sl.setReactionCurveWidth("_J0", 5)
Ejemplo n.º 4
0
from pathlib import Path
import pkg_resources

from libsbml_draw.model.sbml_layout import SBMLlayout

model_file_name = "model.xml"

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

s = SBMLlayout(str(model_file))

# s._describeModel()

s.setNodeFontSize('all', 15)
s.setReactionCurveWidth('all', 3)
s.setNodeColor('all', 'red')
s.setNodeFontColor('all', 'white')

s.drawNetwork()

s.regenerateLayout()

s.drawNetwork()
Ejemplo n.º 5
0
sl2.drawNetwork()

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")
Ejemplo n.º 6
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.lockNode("X0")
sl.lockNode("A")

sl.aliasNode("B")

sl.setNodeColor("B_1", "#00ff0030")
sl.setNodeColor("A", "#00ff0030")

sl.lockNode("B_1")
sl.lockNode("D")
sl.unlockNode("X0")
sl.unlockNode("A")


def test_node_locking():
    assert sl.getIsNodeLocked("D") == True
    assert sl.getIsNodeLocked("B_1") == True
    assert sl.getIsNodeLocked("X0") == False
    assert sl.getIsNodeLocked("A") == False
    assert sl.getIsNodeLocked("C") == False
Ejemplo n.º 7
0
layout.regenerateLayout()
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.