Reaction¶
Read the reaction information.¶
-
SBMLDiagrams.load.getReactionIdList(self)¶ Returns the list of reaction ids.
- Returns:
id_list-list of ids.
id-str-reaction id.
-
SBMLDiagrams.load.getReactionCenterPosition(self, id)¶ Get the center position of a reaction with a given reaction id.
- Args:
id: str-the id of the reaction.
- Returns:
center_position: a Point object with attributes x and y representing the x/y position of the current center of the reaction.
- Examples:
p = sd.getReactionCenterPosition(‘reaction_id’)
print (‘x = ‘, p.x, ‘y = ‘, p.y)
-
SBMLDiagrams.load.getReactionBezierHandles(self, id)¶ Get the bezier handle positions of a reaction with a given reaction id.
- Args:
id: str-the id of the reaction.
- Returns:
handle_positions: list-position of the handles: [center handle, reactant handles, product handles].
position: a Point object with attributes x and y representing the x/y position.
-
SBMLDiagrams.load.getReactionFillColor(self, id)¶ Get the fill color of a reaction with with a given reaction id.
- Args:
id: str-the id of the reaction.
- Returns:
fill_color: list-[rgba 1*4 matrix, html_name str (if any, otherwise ‘’), hex str (8 digits)].
-
SBMLDiagrams.load.getReactionLineThickness(self, id)¶ Get the line thickness of a reaction with a given reaction id.
- Args:
id: str-the id of the reaction.
- Returns:
line_thickness: float-reaction border line width.
-
SBMLDiagrams.load.getReactionDashStyle(self, id)¶ Get the dash information with a given reaction id.
- Args:
id: str-the id of the reaction.
- Returns:
dash: list - [] means solid; [a,b] means drawing a a-point line and following a b-point gap and etc; [a,b,c,d] means drawing a a-point line and following a b-point gap, and then drawing a c-point line followed by a d-point gap.
-
SBMLDiagrams.load.getReactionArrowHeadSize(self, id)¶ Get the arrow head size of reactions with a given reaction id.
- Args:
id: str-the id of the reaction.
- Returns:
arrow_head_size: a Point object with attributes x and y representing the width and height of the arrow head.
- Examples:
p = sd.getReactionArrowHeadSize(‘reaction_id’)
print (‘Width = ‘, p.x, ‘Height = ‘, p.y)
-
SBMLDiagrams.load.getReactionArrowHeadFillColor(self, id)¶ Get the fill color of the reaction arrow head with a given reaction id.
- Args:
id: str-the id of the reaction.
- Returns:
fill_color: list-[rgba 1*4 matrix, html_name str (if any, otherwise ‘’), hex str (8 digits)]
-
SBMLDiagrams.load.getReactionArrowHeadShape(self, id)¶ Get the shape of the reaction arrow head with a given reaction id.
- Args:
id: str-the id of the reaction.
- Returns:
shape: tuple (shape_type_list, shape_info_list)
shape_type_list: list of str-the name of the arrow head shape.
shape_info_list: list-the shape information corresponding to the list of shape_type_list.
-
SBMLDiagrams.load.getReactionModifierNum(self, id)¶ Get the number of modifiers of reactions with a given reaction id.
- Args:
id: str-the id of the reaction.
- Returns:
modifier_num: int-number of modifiers.
-
SBMLDiagrams.load.getReactionModifierHeadSize(self, id, mod_idx=0)¶ Get the modifier head size of reactions with a given reaction id.
- Args:
id: str-the id of the reaction.
mod_idx: int-index of the modifier: 0 to number of modifiers -1.
- Returns:
head_size: a Point object with attributes x and y representing the width and height of the modifier head.
- Examples:
p = sd.getReactionModifierHeadSize(‘reaction_id’)
print (‘Width = ‘, p.x, ‘Height = ‘, p.y)
-
SBMLDiagrams.load.getReactionModifierHeadFillColor(self, id, mod_idx=0)¶ Get the fill color of the reaction modifier head with a given reaction id.
- Args:
id: str-the id of the reaction.
mod_idx: int-index of the modifier: 0 to number of modifiers -1.
- Returns:
fill_color: list-[rgba 1*4 matrix, html_name str (if any, otherwise ‘’), hex str (8 digits)]
-
SBMLDiagrams.load.getReactionModifierHeadShape(self, id, mod_idx=0)¶ Get the shape of the reaction modifier head with a given reaction id.
- Args:
id: str-the id of the reaction.
mod_idx: int-index of the modifier: 0 to number of modifiers -1.
- Returns:
shape: tuple (shape_type_list, shape_info_list)
shape_type_list: list of str-the name of the modifier head shape.
shape_info_list: list-the shape information corresponding to the list of shape_type_list.
Edit the reaction information.¶
-
SBMLDiagrams.load.setReactionToStraightLine(self, id)¶ For a reaction of given id, use straight lines to represent the reaction. The default reaction line style is to use Bezier curves.
- Args:
id: str-reaction id.
-
SBMLDiagrams.load.setReactionCenterPosition(self, id, position)¶ Set the reaction center position for a reaction with a given reaction id.
- Args:
id: str-reaction id.
position: list or point.Point()
list- 1*2 matrix-[position_x, position_y].
point.Point()- a Point object with attributes x and y representing the x/y position.
-
SBMLDiagrams.load.setReactionBezierHandles(self, id, position)¶ Set the reaction bezier handle positions for a given reaction.
- Args:
id: str-reaction id.
position: list-position of the handles: [center handle, reactant handle1, …, product handle1, …].
center handle/reactant handle1/product handle1: 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.
- Examples:
setReactionBezierHandles (‘J1’, [point.Point(550,150),point.Point(530,155),point.Point(600,120)])
setReactionBezierHandles(“J3”, [[550,150],[530,155],[600,120]])
-
SBMLDiagrams.load.setReactionDefaultCenterAndHandlePositions(self, id)¶ Set detault center and handle positions. The default center is the centroid of the reaction, and the default handle positions are middle points of nodes (species) and the centroid.
- Args:
id: str-reaction id.
-
SBMLDiagrams.load.setReactionFillColor(self, id, fill_color, opacity=1.0)¶ Set the reaction fill color.
- Args:
id: str-reaction 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.).
- Examples:
setReactionFillColor (‘J1’, “BurlyWood”)
-
SBMLDiagrams.load.setReactionLineThickness(self, id, line_thickness)¶ Set the reaction line thickness.
- Args:
id: str-reaction id.
line_thickness: float-reaction border line width.
-
SBMLDiagrams.load.setReactionDashStyle(self, id, dash=[])¶ Set the reaction dash information with a certain reaction id.
- Args:
id: str-reaction id.
dash: list-[] means solid; [a,b] means drawing a a-point line and following a b-point gap and etc; [a,b,c,d] means drawing a a-point line and following a b-point gap, and then drawing a c-point line followed by a d-point gap.
- Examples:
To produce a dash such as - - - -, use setReactionDashStyle (‘J1’, [5,5,5,5]).
-
SBMLDiagrams.load.setReactionArrowHeadSize(self, id, size)¶ Set the reaction arrow head size with a certain reaction id.
- Args:
id: str-reaction id.
size: list or point.Point()
list- 1*2 matrix-size of the arrow head [width, height].
point.Point()- a Point object with attributes x and y representing the width and height of the arrow head.
- Examples:
setReactionArrowHeadSize(“r_0”, [12., 12.])
-
SBMLDiagrams.load.setReactionArrowHeadFillColor(self, id, fill_color, opacity=1.0)¶ Set the reaction arrow head fill color with a certain reaction id.
- Args:
id: str-reaction 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.).
- Examples:
setReactionArrowHeadFillColor (‘J1’, “BurlyWood”)
-
SBMLDiagrams.load.setReactionArrowHeadShape(self, id, shape_type_list, shape_info_list)¶ Set shape(s) to a reaction arrow head by the shape info.
- Args:
id: str-node id.
shape_type_list: list-list of shape_type.
shape_type: str-polygon, ellipse, rectangle.
shape_info_list: list-list of shape_info.
shape_info: list-
if polygon: [[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.
if ellipse: [[cx, cy], [rx, ry]], where each number is a floating number from 0 to 100. c represent the center of the ellipse, and r represents its radii.
if rectangle: []
-
SBMLDiagrams.load.setReactionModifierHeadSize(self, id, size, mod_idx=0)¶ Set the reaction modifier head size with a certain reaction id.
- Args:
id: str-reaction id.
size: list or point.Point()
list- 1*2 matrix-size of the modifier head [width, height].
point.Point()- a Point object with attributes x and y representing the width and height of the modifier head.
mod_idx: int-the index of the modifier: 0 to number of modifiers -1.
- Examples:
setReactionModifierHeadSize(“r_0”, [12., 12.])
-
SBMLDiagrams.load.setReactionModifierHeadFillColor(self, id, fill_color, opacity=1.0, mod_idx=0)¶ Set the reaction modifier head fill color with a certain reaction id.
- Args:
id: str-reaction 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.).
mod_idx: int-the index of the modifier: 0 to number of modifiers -1.
- Examples:
setReactionModifierHeadFillColor (‘J1’, “BurlyWood”)
-
SBMLDiagrams.load.setReactionModifierHeadShape(self, id, shape_type_list, shape_info_list, mod_idx=0)¶ Set shape(s) to a reaction modifier head by the shape info.
- Args:
id: str-node id.
shape_type_list: list-list of shape_type.
shape_type: str-polygon, ellipse, rectangle.
shape_info_list: list-list of shape_info.
shape_info: list-
if polygon: [[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.
if ellipse: [[cx, cy], [rx, ry]], where each number is a floating number from 0 to 100. c represent the center of the ellipse, and r represents its radii.
if rectangle: []
mod_idx: int-the index of the modifier: 0 to number of modifiers -1.