#model_file_name = "complicated_nodes-L3V1.xml"
model_file_name = "complicated_nodes.xml"

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

# https://stackoverflow.com/questions/33635439/matplotlib-patch-size-in-points

#print("validate: ", SBMLlayout._validate_sbml_filename(str(model_file)))


sl = SBMLlayout(str(model_file))


sl._describeModel()

#sl.drawNetwork("complicated_nodes.png", figsize=(6,6))
#sl.drawNetwork("complicated_nodes.png", figsize=(8,8))
sl.drawNetwork("complicated_nodes.png")

#sl.setNodeFontSize("all", 6)

#sl.drawNetwork()


#for node in sl.getNodeIds():
#    centroid = sl.getNodeCentroid(node)
#    print("centroid: ", centroid[0], ", ", centroid[1])
#    print("width: ", sl.getNodeWidth(node))
#    print("height: ", sl.getNodeHeight(node))
Example #2
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))

sl = SBMLlayout(str(model_file))

sl._describeModel()

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

sl.drawNetwork()

sl._describeReaction(0)

sl.setNodeEdgeWidth("all", 2)

out_file = "model_out.xml"
sl.writeSBMLFile("model_out.xml")

sl2 = SBMLlayout(out_file)

print("sl2 layoutSpecified: ", sl2._SBMLlayout__layoutSpecified)