コード例 #1
0
    pkg_resources.resource_filename("libsbml_draw",
                                    "model/data/" + model_file_name))

sl = SBMLlayout(str(model_file))

sl._describeModel()

sl.drawNetwork()

sl.setCompartmentEdgeColor("vol1", "#0000ff")
sl.setCompartmentFillColor("vol1", "#ff000010")
sl.setCompartmentLineWidth("vol1", 5)

assert sl.getCompartmentEdgeColor("vol1") == "#0000ffff"
assert sl.getCompartmentFillColor("vol1") == "#ff000010"
assert sl.getCompartmentLineWidth("vol1") == 5

sl.drawNetwork("simple_render_local.png")

sl.writeSBMLFile("simple_render_local_out.xml")

slr = SBMLlayout("simple_render_local_out.xml")

slr.drawNetwork()

model_file_name = "simple-L2-render-global.xml"
#model_file_name = "simple-L2-render-global-L3V1.xml"

model_file = Path(
    pkg_resources.resource_filename("libsbml_draw",
                                    "model/data/" + model_file_name))
コード例 #2
0
for node in sll._SBMLlayout__network.nodes.values():
    print("Node shape points: ", node.shape, len(node.polygon_points),
          len(node.polygon_codes))
    for point in node.polygon_points:
        print("point: ", point)
    for code in node.polygon_codes:
        print("code: ", code)

sll.drawNetwork()

sll.writeSBMLFile("simple_local_out.xml")

print(sll.getCompartmentEdgeColor("vol1"))
print(sll.getCompartmentFillColor("vol1"))
print(sll.getCompartmentLineWidth("vol1"))

# check libsbml API

doc = libsbml.readSBMLFromFile(str(model_file))

model = doc.getModel()

numCompartments = model.getNumCompartments()

print("numCompartments: ", numCompartments)

for index in range(numCompartments):
    compartment = model.getCompartment(index)
    print("id, name: ", compartment.getId(), ", ",
          compartment.getElementName())