sl.writeSBMLFile("ftest_layout_override.xml")


# This will write if allowed, and when it is read back in, it displays as
# a single blob of garbage because everything is plotted with the same centers
# sl.writeSBMLFile("test_layout_override.xml")
# slr = SBMLlayout("test_layout_override.xml", autoComputeLayout=False)

slr = SBMLlayout(str(model_file), autoComputeLayout=False)

slr._describeModel()

slr.drawNetwork()

assert slr.getNodeTextAnchor("MKK_P") == "center"
# bottom means top in this situation
assert slr.getNodeVTextAnchor("MAPK") == "bottom"

assert slr.getNodeFontSize("MKK") == 11

assert slr.getNodeEdgeColor("MKKK") == "#969696"

assert slr.getNodeFillColor("MAPK_P") == "#c9e0fb"

assert slr.getReactionEdgeColor("J1") == [('MKKK_P', 'SUBSTRATE', '#ff9900'),
                                          ('MKKK', 'PRODUCT', '#ff9900')]

assert slr.getReactionFillColor("J2") == [('MKK', 'SUBSTRATE', '#ff9900'),
                                          ('MKK_P', 'PRODUCT', '#ff9900'),
                                          ('MKKK_P', 'ACTIVATOR', '#ff9900')]
Пример #2
0
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"

assert sl.getNodeEdgeColor("glycerate_3_phosphate") == "#969696"

sl.writeSBMLFile("glycolysis_original.xml")

slr = SBMLlayout("glycolysis_original.xml")

slr.drawNetwork()

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

assert slr.getReactionCurveWidth("J9") == [('ATP', 'SUBSTRATE', 2.0),
                                           ('ADP', 'PRODUCT', 2.0)]

assert slr.getReactionEdgeColor("J10") == [('External_acetaldehyde',
                                            'SUBSTRATE', '#ff9900'),
                                           ('Sink', 'PRODUCT', '#ff9900')]

assert slr.getReactionFillColor("J0") == [('External_glucose', 'SUBSTRATE',
                                           '#ff9900'),
                                          ('Glucose', 'PRODUCT', '#ff9900')]
Пример #3
0
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")

print("reaction edge: ", sl.getReactionEdgeColor("_J0"))
print("reaction fill: ", sl.getReactionFillColor("_J0"))

sl.drawNetwork()

sl.showLayoutAlgorithmOptions()

#sl.setLayoutAlgorithm_grav(20)

sl.setLayoutAlgorithmOptions(k=40, grav=20)

#sl.setLayoutAlgorithmOptions(mag=1)

sl.showLayoutAlgorithmOptions()

sl.regenerateLayout()
Пример #4
0
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")


slr =  SBMLlayout("ftest_larger_pathway.xml")

slr.drawNetwork()

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

assert sl.getReactionCurveWidth("_J2") == [('C', 'SUBSTRATE', 3.0), 
                                           ('ABCDEFG', 'PRODUCT', 3.0)]

assert sl.getReactionEdgeColor("_J1") == [('B', 'SUBSTRATE', '#000000a0'), 
                                          ('C', 'PRODUCT', '#000000a0'), 
                                          ('D', 'PRODUCT', '#000000a0')]


Пример #5
0
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"))
print("_J3 fill color: ", sl.getReactionFillColor("_J3"))

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

print("A: fill color: ", sl.getNodeFillColor("A"))
print("B: edge color: ", sl.getNodeEdgeColor("B"))
print("C: edge width: ", sl.getNodeEdgeWidth("C"))

print("X0: text anchor: ", sl.getNodeTextAnchor("X0"))
print("A: text anchor: ", sl.getNodeTextAnchor("A"))
print("B: vtext anchor: ", sl.getNodeVTextAnchor("B"))
Пример #6
0
assert sl.getNodeEdgeColor("A") == "#0000ff"
assert sl.getNodeFillColor("A") == "#c9e0fb"

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

assert sl.getNodeFontWeight("B") == "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")

assert sl.getReactionEdgeColor("_J0")[0] == ('X0', 'SUBSTRATE', '#0000ff')
assert sl.getReactionEdgeColor("_J0")[1] == ('A', 'PRODUCT', '#ff0000ff')

assert sl.getReactionEdgeColor("_J1")[0] == ("A", "SUBSTRATE", "#ff00ffff")
assert sl.getReactionEdgeColor("_J1")[1] == ("B", "PRODUCT", "#0000ff")

assert sl.getReactionEdgeColor("_J2")[0] == ('B', 'SUBSTRATE', '#0000ff')
assert sl.getReactionEdgeColor("_J2")[1] == ('D', 'PRODUCT', '#ff00ffff')

assert sl.getReactionEdgeColor("_J5")[0] == ('D', 'SUBSTRATE', '#00ff00ff')
assert sl.getReactionEdgeColor("_J5")[1] == ('X1', 'PRODUCT', '#0000ff')

assert sl.getReactionEdgeColor("_J3")[0] == ('A', 'SUBSTRATE', '#0000ff')
assert sl.getReactionEdgeColor("_J3")[1] == ('C', 'PRODUCT', '#ffff00ff')

assert sl.getReactionEdgeColor("_J4")[0] == ('C', 'SUBSTRATE', '#00ffffff')