Example #1
0
#model_file = "C:\\tmp\\model.xml"
#model_file = "C:\\tmp\\copasi.xml"
#model_file = "C:\\tmp\\render_sbml.xml"
#model_file = "C:\\tmp\\largerpathway.xml"
model_file = "C:\\tmp\\simple-L2-render-global.xml"

# read model
sl = SBMLlayout(model_file)

# generate layout
if not sl.layoutSpecified:
    sl._randomizeLayout()
    sl._doLayoutAlgorithm()

# 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")
Example #2
0
from pathlib import Path
import pkg_resources

from libsbml_draw.model.sbml_layout import SBMLlayout

model_file_name = "GlycolysisOriginal.xml"

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

sl = SBMLlayout(str(model_file))

sl._describeModel()

assert sl.getNumberOfNodes() == 23
assert sl.getNumberOfReactions() == 11

sl.drawNetwork("GlycolysisOriginal.png")

assert sl.getNodeEdgeWidth("External_glucose") == 3
assert sl.getNodeEdgeWidth("Glucose") == 1
# in this case, bottom means top
assert sl.getNodeVTextAnchor("pyruvate") == "bottom"
assert sl.getNodeVTextAnchor("ADP") == "bottom"

assert sl.getNodeFillColor("NAD") == "#7fff55"
assert sl.getNodeFillColor("NADH") == "#d4ffaa"

assert sl.getNodeFillColor("ATP") == "#ff7faa"
assert sl.getNodeFillColor("ADP") == "#ffd4d4"
Example #3
0
import pkg_resources

from libsbml_draw.model.sbml_layout import SBMLlayout

MODEL_FILE_NAME = "largerpathway.xml"

MODEL_FILE = Path(pkg_resources.resource_filename(
        "libsbml_draw",
        "model/data/" + MODEL_FILE_NAME))


sl = SBMLlayout(str(MODEL_FILE))

sl._describeModel()

assert sl.getNumberOfNodes() == 6
assert sl.getNumberOfReactions() == 5

assert sl.getNodeFontSize("ABCDEFG") == 12
assert sl.getNodeFontWeight("F") == "normal"

assert sl.getNodeFillColor("E") == "#a0e0a030"

sl.drawNetwork("larger_pathway.png")

# sl.setReactionCurveWidth("all", 12)

sl.drawNetwork()


sl.writeSBMLFile("ftest_larger_pathway.xml")
Example #4
0
  Node9 = 0;
  Node10 = 0;
  Node11 = 0;
  Node12 = 0;
  Node13 = 0;
  Node14 = 0;
end
''')

from libsbml_draw.model.sbml_layout import SBMLlayout

sl = SBMLlayout(r.getSBML())

sl._describeModel()

sl.drawNetwork()

assert sl.getNumberOfNodes() == 12
assert sl.getNumberOfReactions() == 8

slsl = SBMLlayout()

slsl.loadSBMLString(r.getSBML())

slsl._describeModel()

slsl.drawNetwork()

assert slsl.getNumberOfNodes() == 12
assert slsl.getNumberOfReactions() == 8
sl.setNodeColor("B_1", "#00ff0030")
sl.setNodeColor("A", "#00ff0030")
                
sl.lockNode("B_1")
sl.lockNode("D")
sl.unlockNode("X0")
sl.unlockNode("A")
sl.regenerateLayout()

sl.drawNetwork()


sl.writeSBMLFile("ftest_no_layout_alias.xml")

sl2 = SBMLlayout("ftest_no_layout_alias.xml", applyRender=applyRender)

sl2._describeModel()

sl2.drawNetwork()

assert sl2.getNumberOfNodes() == 7
assert sl2.getNumberOfReactions() == 6


#print("node ids: ", sl2.getNodeIds())
#for node in sl2._SBMLlayout__network.nodes.values():
#    print(node.id, node.name)