else: model_dir = "/Users/natalieh/repos/libsbml-draw/model_files/" model_file = "/Users/natalieh/repos/libsbml-draw/model_files/copasi.xml" #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"
Gradient colours are cool. Would like to see them. Font size should scale with scaling factor ''' layout = SBMLlayout('Kholodenko2000.xml') # print(layout.getNumberOfRoles()) layout.regenerateLayout() [layout.setCompartmentEdgeColor(i, 'grey') for i in layout.getCompartmentIds()] [layout.setNodeEdgeWidth(i, 10) for i in layout.getNodeIds()] [layout.setNodeFontSize(i, 40) for i in layout.getNodeIds()] [layout.setCompartmentLineWidth(i, 25) for i in layout.getCompartmentIds()] # [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('Kholodenko2000Layout.png', scaling_factor=1.5) # 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
sl = SBMLlayout(model_file) 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",
if platform.system() == "Windows": model_dir = "C:\\Users\\nrhaw\\Documents\\repos\\libsbml-draw\\model_files\\" elif platform.system() == "Linux": model_dir = "/home/radix/repos/libsbml-draw/model_files/" else: model_dir = "/Users/natalieh/repos/libsbml-draw/model_files/" model_file = model_dir + file_name print("model file: \n", model_file) sl = SBMLlayout(model_file) sl._describeModel() my_fig = sl.drawNetwork() color1 = ["S6", "S7", "S5", "S4", "S8"] color2 = ["S0", "S1", "S2", "S3", "S9", "S10", "S11"] for node in color1: sl.setNodeFillColor(node, "lightblue") for node in color2: sl.setNodeFillColor(node, "lightgreen") for reaction in sl.getReactionIds(): sl.setReactionCurveWidth(reaction, 2) sl.drawNetwork()