Node

Read the node information.

SBMLDiagrams.load.getNodeIdList(self)

Returns the list of node ids.

Returns:

id_list-list of ids.

id-str-node id.

SBMLDiagrams.load.getNodeAliasNum(self, id)

Get the number of alias nodes with a given node id.

Args:

id: str-the id of the node.

Returns:

num_alias: int-the number of alias nodes with the given node id.

SBMLDiagrams.load.isFloatingNode(self, id, alias=0)

Returns True if the given node is a floating node.

Args:

id: str-the id of the node.

alias: int-alias node index: 0 to number of alias nodes -1.

Returns:

floating_node: bool-floating node (True) or not (False).

SBMLDiagrams.load.getNodePosition(self, id, alias=0)

Get the position of a node with a given node id.

Args:

id: str-the id of the node.

alias: int-alias node index: 0 to number of alias nodes -1.

Returns:

position: a Point object with attributes x and y representing the x/y position of the top-left hand corner of the node.

Examples:

p = sd.getNodePosition(‘ATP’)

print(‘x = ‘, p.x, ‘y = ‘, p.y)

SBMLDiagrams.load.getNodeCenter(self, id, alias=0)

Get the center point of a node with a given node id.

Args:

id: str-the id of the node.

alias: int-alias node index: 0 to number of alias nodes -1.

Returns:

position-a Point object with x and y coordinates of the center of the node.

Examples:

p = sd.getNodeCenter(‘ATP’)

print(p.x, p.y)

SBMLDiagrams.load.getNodeSize(self, id, alias=0)

Get the size of a node with a given node id.

Args:

id: str-the id of the node.

alias: int-alias node index: 0 to number of alias nodes -1.

Returns:

size: a Point object with attributes x and y representing the width and height of the node.

Examples:

p = sd.getNodeSize(‘ATP’)

print (‘Width = ‘, p.x, ‘Height = ‘, p.y)

SBMLDiagrams.load.getNodeShape(self, id, alias=0)

Get the shape index and the shape of a node with a given node id.

Args:

id: str-the id of the node.

alias: int-alias node index: 0 to number of alias nodes -1.

Returns:

shape: tuple (shape_name, vertex_positions)

shape_name: str-the name of the node shape.

vertex_positions: list-the vertex positions if any.

SBMLDiagrams.load.getNodeTextPosition(self, id, alias=0)

Get the text position of a node with a given node id.

Args:

id: str-the id of node.

alias: int-alias node index: 0 to number of alias nodes -1.

Returns:

txt_position: a Point object with attributes x and y representing the x/y position of the top-left hand corner of the node text.

Examples:

p = sd.getNodeTextPosition(‘ATP’)

print (‘x = ‘, p.x, ‘y = ‘, p.y)

SBMLDiagrams.load.getNodeTextSize(self, id, alias=0)

Get the text size of a node with a given node id.

Args:

id: str-the id of the node.

alias: int-alias node index: 0 to number of alias nodes -1.

Returns:

size: a Point object with attributes x and y representing the width and height of the node text.

Examples:

p = sd.getNodeTextSize(‘ATP’)

print (‘Width = ‘, p.x, ‘Height = ‘, p.y)

SBMLDiagrams.load.getNodeFillColor(self, id, alias=0)

Get the fill color of a node with a given node id.

Args:

id: str-the id of the node.

alias: int-alias node index: 0 to number of alias nodes -1.

Returns:

fill_color: list-[rgba 1*4 matrix, html_name str (if any, otherwise ‘’), hex str (8 digits)];

or list-[str-gradient_type, list-gradient_info, list-stop_info], where gradient_type can be ‘linearGradient’ or ‘radialGradient’, while gradient_info and stop_info refers to setNodeFillLinearGradient() and setNodeFillRadialGradient.

SBMLDiagrams.load.getNodeBorderColor(self, id, alias=0)

Get the border color of a node with a given node id.

Args:

id: str-the id of the node.

alias: int-alias node index: 0 to number of alias nodes -1.

Returns:

border_color: list-[rgba 1*4 matrix, html_name str (if any, otherwise ‘’), hex str (8 digits)].

SBMLDiagrams.load.getNodeBorderWidth(self, id, alias=0)

Get the border width of a node with a given node id.

Args:

id: str-the id of the node.

alias: int-alias node index: 0 to number of alias nodes -1.

Returns:

border_width: float-node border line width.

SBMLDiagrams.load.getNodeTextContent(self, id, alias=0)

Get the text content of a node with a given node id.

Args:

id: str-the id of the node.

alias: int-alias node index: 0 to number of alias nodes -1.

Returns:

txt_content: str-the content of the node text.

SBMLDiagrams.load.getNodeTextFontColor(self, id, alias=0)

Get the text font color of a node with a given node id.

Args:

id: str-the id of the node.

alias: int-alias node index: 0 to number of alias nodes -1.

Returns:

txt_font_color: list-[rgba 1*4 matrix, html_name str (if any, otherwise ‘’), hex str (8 digits)].

SBMLDiagrams.load.getNodeTextLineWidth(self, id, alias=0)

Get the text line width of a node with a given node id.

Args:

id: int-the id of the node.

alias: int-alias node index: 0 to number of alias nodes -1.

Returns:

txt_line_width: float-node text line width.

SBMLDiagrams.load.getNodeTextFontSize(self, id, alias=0)

Get the text font size of a node with a given node id.

Args:

id: str-the id of the node.

alias: int-alias node index: 0 to number of alias nodes -1.

Returns:

txt_font_size: float.

SBMLDiagrams.load.getNodeTextAnchor(self, id, alias=0)

Get the horizontal anchor of a node text with a given node id.

Args:

id: str-the id of the node.

alias: int-alias node index: 0 to number of alias nodes -1.

Returns:

txt_anchor: str-the horizantal anchor of the node text, which can be “start”, “middle” and “end”.

SBMLDiagrams.load.getNodeTextVAnchor(self, id, alias=0)

Get the vertical anchor of a node text with a given node id.

Args:

id: str-the id of the node.

alias: int-alias node index: 0 to number of alias nodes -1.

Returns:

txt_anchor: str-the vertical anchor of the node text, which can be “top”, “middle”, “baseline” and “bottom”.

Edit the node information.

SBMLDiagrams.load.setFloatingBoundaryNode(self, id, floating_node, alias=0)

Set a node to be floating node (True) or boundary node (False).

Args:

id: str-node id.

floating_node: bool-floating node (True) or not (False).

alias: int-alias node index: 0 to number of alias node -1.

SBMLDiagrams.load.setNodePosition(self, id, position, alias=0)

Set the x,y coordinates of the node position.

Args:

id: str-node id.

position: list or point.Point()

list- [position_x, position_y], the coordinate represents the top-left hand corner of the node.

point.Point()- a Point object with attributes x and y representing the x/y position of the top-left hand corner of the node.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeAndTextPosition(self, id, position, alias=0)

Set the x,y coordinates of the node position and node text position if they are consistent. Please only use this function if you want to design the node position and node text position to be the same, otherwise use setNodePosition() and setNodeTextPosition() separately to set the position of the node and the node text.

Args:

id: str-node id.

position: list or point.Point()

list- [position_x, position_y], the coordinate represents the top-left hand corner of the node and the node text.

point.Point()- a Point object with attributes x and y representing the x/y position of the top-left hand corner of the node and the node text.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeSize(self, id, size, alias=0)

Set the node size.

Args:

id: str-node id.

size: list or point.Point()

list- 1*2 matrix-size of the node [width, height].

point.Point()- a Point object with attributes x and y representing the width and height of the node.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeAndTextSize(self, id, size, alias=0)

Set the node and node text size if there are consistent.

Args:

id: str-node id.

size: list or point.Point()

list- 1*2 matrix-size of the node and text [width, height].

point.Point()- a Point object with attributes x and y representing the width and height of the node and node text.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeShape(self, id, shape, alias=0)

Set the node shape by shape index or name string.

Args:

id: str-node id.

shape: int or str int-0:text_only, 1:rectangle, 2:ellipse, 3:hexagon, 4:line, or 5:triangle; 6:upTriangle, 7:downTriangle, 8:leftTriangle, 9: rightTriangle.

str-“text_only”, “rectangle”, “ellipse”, “hexagon”, “line”, or “triangle”; “upTriangle”, “downTriangle”, “leftTriangle”, “rightTriangle”.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeArbitraryPolygonShape(self, id, shape_name, shape_info, alias=0)

Set an arbitrary polygon shape to a node by shape name and shape info.

Args:

id: str-node id.

shape_name: str-name of the arbitrary polygon shape.

shape_info: list-[[x1,y1],[x2,y2],[x3,y3],etc], where x,y are floating numbers from 0 to 100. x represents the percentage of width, and y represents the percentage of height.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeTextPosition(self, id, txt_position, alias=0)

Set the x,y coordinates of the node text position.

Args:

id: str-node id.

txt_position: list or point.Point()

list- [txt_position_x, txt_position_y], the coordinate represents the top-left hand corner of the node text.

point.Point()- a Point object with attributes x and y representing the x/y position of the top-left hand corner of the node text.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.moveNodeTextPosition(self, id, rel_position, alias=0)

Move the x,y coordinates of the node text position relative to its original position.

Args:

id: str-node id.

rel_position: list or point.Point()

list- [rel_position_x, rel_position_y], the relative coordinates moving away from the original node text position.

point.Point()- a Point object with attributes x and y representing the relative coordinates moving away from the original node text position.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeTextPositionCenter(self, id, alias=0)

Set the node text position to the center of the node.

Args:

id: str-node id.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeTextPositionLeftCenter(self, id, alias=0)

Set the node text position to the left center of the node.

Args:

id: str-node id.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeTextPositionRightCenter(self, id, alias=0)

Set the node text position to the right center of the node.

Args:

id: str-node id.

alias: int- alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeTextPositionUpperCenter(self, id, alias=0)

Set the node text position to the upper center of the node.

Args:

id: str-node id.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeTextPositionLowerCenter(self, id, alias=0)

Set the node text position to the lower center of the node.

Args:

id: str-node id.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeTextPositionUpperLeft(self, id, alias=0)

Set the node text position to the upper left of the node.

Args:

id: str-node id.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeTextPositionUpperRight(self, id, alias=0)

Set the node text position to the upper right of the node.

Args:

id: str-node id.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeTextPositionLowerLeft(self, id, alias=0)

Set the node text position to the lower left of the node.

Args:

id: str-node id.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeTextPositionLowerRight(self, id, alias=0)

Set the node text position to the lower right of the node.

Args:

id: str-node id.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeTextSize(self, id, txt_size, alias=0)

Set the node text size with given node id.

Args:

id: str-node id.

txt_size: list or point.Point()

list- 1*2 matrix-size of the node text [width, height].

point.Point()- a Point object with attributes x and y representing the width and height of bounding box that enclosed the node text. The text font size wil be adjusted to fill the given bounding box.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeFillColor(self, id, fill_color, opacity=1.0, alias=0)

Set the node fill color with given node id.

Args:

id: str-node id.

fill_color: list-decimal_rgb 1*3 matrix/str-html_name/str-hex_string (6-digit).

opacity: float-value is between [0,1], default is fully opaque (opacity = 1.).

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeFillLinearGradient(self, id, gradient_info, stop_info, alias=0)

Set the node fill linear gradient with given node id.

Args:

id: str-node id.

gradient_info: list - [[x1,y1],[x2,y2]], where x,y are floating numbers from 0 to 100. x represents the percentage of width, and y represents the percentage of height.

stop_info: list - [[x1,[r1,g1,b1,a1]],[x2,[r2,g2,b2,a2]],etc], where x is floating number from 0 to 100.

or list - [[x1, html_name_str, opacity], [x2, html_name_str, opacity], etc], where opacity: float-value is between [0,1], default is fully opaque (opacity = 1.).

alias: int-alias node index: 0 to number of alias nodes -1.

Examples:

setNodeFillLinearGradient(“ADH1”, [[0.0, 50.], [100.0, 50.0]], [[0.0, [255, 255, 255, 255]], [100.0, [192, 192, 192, 255]]])

setNodeFillLinearGradient(“ADH1”, [[0.0, 50.], [100.0, 50.0]], [[0.0, “red”, 1.0], [100.0, “blue”, 1.0]])

SBMLDiagrams.load.setNodeFillRadialGradient(self, id, gradient_info, stop_info, alias=0)

Set the node fill radial gradient.

Args:

id: str-node id.

gradient_info: list - [[x1,y1],[r]], where x,y,r are floating numbers from 0 to 100. x represents the center with percentage of width and height; r represents the radius.

stop_info: list - [[x1,[r1,g1,b1,a1]],[x2,[r2,g2,b2,a2]],etc], where x is floating number from 0 to 100.

or list - [[x1, html_name_str, opacity], [x2, html_name_str, opacity], etc], where opacity: float-value is between [0,1], default is fully opaque (opacity = 1.).

alias: int-alias node index: 0 to number of alias nodes -1.

Examples:

df.setNodeFillRadialGradient(“Species_1”, [[50.0, 50.0], [50.]], [[0.0, [255, 255, 255, 255]], [100.0, [0, 0, 0, 255]]])

df.setNodeFillRadialGradient(“Species_1”, [[50.0, 50.0], [50.]], [[0.0, “red”, 1.0], [100.0, “blue”, 1.0]])

SBMLDiagrams.load.setNodeBorderColor(self, id, border_color, opacity=1.0, alias=0)

Set the node border color of a node with a given id.

Args:

id: str-node id.

border_color: list-decimal_rgb 1*3 matrix/str-html_name/str-hex_string (6-digit).

opacity: float-value is between [0,1], default is fully opaque (opacity = 1.).

alias: int-alias node index: 0 to number of alias nodes -1.

Examples:

la.setNodeBorderColor (‘node1’, ‘CornflowerBlue’)

SBMLDiagrams.load.setNodeBorderWidth(self, id, border_width, alias=0)

Set the node border width for a node of given id.

Args:

id: str-node id.

border_width: float-node border line width.

alias: int-alias node index: 0 to number of alias nodes -1.

Examples:

la.setNodeBorderWidth (‘node4’, 3)

SBMLDiagrams.load.setNodeTextContent(self, id, txt_content, alias=0)

Set the node text content for a node of given id.

Args:

id: str-node id.

txt_content: str-node text content.

alias: int-alias node index: 0 to number of alias nodes -1.

Examples:

la.setNodeTextContent (‘node4’, ‘N4’)

SBMLDiagrams.load.setNodeTextFontColor(self, id, txt_font_color, opacity=1.0, alias=0)

Set the node text font color for a node of given id.

Args:

id: str-node id.

txt_font_color: list-decimal_rgb 1*3 matrix/str-html_name/str-hex_string (6-digit).

opacity: float-value is between [0,1], default is fully opaque (opacity = 1.).

alias: int-alias node index: 0 to number of alias nodes -1.

Examples:

la.setNodeTextFontColor (‘node1’, ‘CornflowerBlue’)

SBMLDiagrams.load.setNodeTextLineWidth(self, id, txt_line_width, alias=0)

Set the node text line width for a node of given id.

Args:

id: str-node id.

txt_line_width: float-node text line width.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeTextFontSize(self, id, txt_font_size, alias=0)

Set the node text font size for a node of given id.

Args:

id: str-node id.

txt_font_size: float-node text font size, the units for size are assumed to be in points.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeTextAnchor(self, id, txt_anchor, alias=0)

Set the horizontal anchor for a node text of given id.

Args:

id: str-node id.

txt_anchor: str-node text horizontal anchor, which can be “start”, “middle” and “end”.

alias: int-alias node index: 0 to number of alias nodes -1.

SBMLDiagrams.load.setNodeTextVAnchor(self, id, txt_vanchor, alias=0)

Set the vertical anchor for a node text of given id.

Args:

id: str-node id.

txt_vanchor: str-node text vertical anchor, which can be which can be “top”, “middle”, “baseline” and “bottom”.

alias: int-alias node index: 0 to number of alias nodes -1.