SBGN
momapy.sbgn
SBGN (Systems Biology Graphical Notation) subpackage.
Abstract bases live here; concrete classes for each sublanguage are in the
pd (Process Description) and af (Activity Flow) subpackages.
Modules:
| Name | Description |
|---|---|
af |
SBGN Activity Flow (AF) subpackage facade. |
elements |
Abstract base classes and mixins for SBGN model and layout elements. |
io |
Input/output module for SBGN maps. |
layout |
Abstract base class for SBGN layouts. |
map |
Abstract base class for SBGN maps. |
model |
Abstract base class for SBGN models. |
pd |
SBGN Process Description (PD) subpackage facade. |
styling |
Styling module for SBGN maps. |
utils |
Utility functions for SBGN map manipulation. |
Classes:
| Name | Description |
|---|---|
SBGNAuxiliaryUnit |
Abstract base class for SBGN auxiliary units. |
SBGNDoubleHeadedArc |
Abstract base class for SBGN double-headed arcs. |
SBGNLayout |
Base class for SBGN layouts. |
SBGNMap |
Abstract base class for SBGN maps. |
SBGNModel |
Abstract base class for SBGN models. |
SBGNModelElement |
Abstract base class for SBGN model elements. |
SBGNNode |
Abstract base class for SBGN nodes. |
SBGNRole |
Abstract base class for SBGN roles. |
SBGNSingleHeadedArc |
Abstract base class for SBGN single-headed arcs. |
SBGNAuxiliaryUnit
dataclass
Bases: SBGNModelElement
Abstract base class for SBGN auxiliary units.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_
|
str
|
The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element |
'ca1586d0-8475-44af-b510-1317ae5c311b'
|
Methods:
| Name | Description |
|---|---|
descendants |
Return every |
descendants
descendants() -> list[ModelElement]
Return every ModelElement reachable from self, excluding self.
This reflectively walks the dataclass field-graph (i.e. reference
reachability) across scalar ModelElement fields and
frozenset/tuple containers, deduplicating by object identity. A
model element referenced by several parents therefore appears once.
Note the deliberate contrast with
LayoutElement.descendants,
which instead walks the explicit children() tree (visual
containment): there a layout element contained under two parents is
reached through each, with no identity dedup.
Returns:
| Type | Description |
|---|---|
list[ModelElement]
|
The list of reachable |
list[ModelElement]
|
order, without |
Source code in src/momapy/core/elements.py
SBGNDoubleHeadedArc
dataclass
SBGNDoubleHeadedArc(*, id_: str = make_uuid4_as_str(), layout_elements: tuple[LayoutElement, ...] = tuple(), group_fill: NoneValueType | Color | None = None, group_fill_rule: FillRule | None = None, group_filter: NoneValueType | Filter | None = None, group_font_family: str | None = None, group_font_size: float | None = None, group_font_style: FontStyle | None = None, group_font_weight: FontWeight | float | None = None, group_stroke: NoneValueType | Color | None = None, group_stroke_dasharray: NoneValueType | tuple[float, ...] | None = None, group_stroke_dashoffset: NoneValueType | float | None = None, group_stroke_width: NoneValueType | float | None = None, group_text_anchor: TextAnchor | None = None, group_transform: NoneValueType | tuple[Transformation, ...] | None = None, end_shorten: float = 0.0, fill: NoneValueType | Color | None = None, filter_: NoneValueType | Filter | None = None, path_fill: NoneValueType | Color | None = NoneValue, path_filter: NoneValueType | Filter | None = None, path_stroke: NoneValueType | Color | None = black, path_stroke_dasharray: NoneValueType | tuple[float, ...] | None = None, path_stroke_dashoffset: NoneValueType | float | None = None, path_stroke_width: float | None = 1.25, path_transform: NoneValueType | tuple[Transformation, ...] | None = None, stroke: NoneValueType | Color | None = None, stroke_dasharray: NoneValueType | tuple[float, ...] | None = None, stroke_dashoffset: NoneValueType | float | None = None, stroke_width: NoneValueType | float | None = None, segments: tuple[Segment | QuadraticBezierCurve | CubicBezierCurve | EllipticalArc, ...] = tuple(), source: LayoutElement | None = None, start_shorten: float = 0.0, target: LayoutElement | None = None, transform: NoneValueType | tuple[Transformation, ...] | None = None, end_arrowhead_fill: NoneValueType | Color | None = white, end_arrowhead_filter: NoneValueType | Filter | None = None, end_arrowhead_stroke: NoneValueType | Color | None = black, end_arrowhead_stroke_dasharray: NoneValueType | tuple[float, ...] | None = None, end_arrowhead_stroke_dashoffset: NoneValueType | float | None = None, end_arrowhead_stroke_width: float | None = 1.25, end_arrowhead_transform: NoneValueType | tuple[Transformation, ...] | None = None, start_arrowhead_fill: NoneValueType | Color | None = white, start_arrowhead_filter: NoneValueType | Filter | None = None, start_arrowhead_stroke: NoneValueType | Color | None = black, start_arrowhead_stroke_dasharray: NoneValueType | tuple[float, ...] | None = None, start_arrowhead_stroke_dashoffset: NoneValueType | float | None = None, start_arrowhead_stroke_width: float | None = 1.25, start_arrowhead_transform: NoneValueType | tuple[Transformation, ...] | None = None)
Bases: DoubleHeadedArc
Abstract base class for SBGN double-headed arcs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_
|
str
|
The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element |
'9f61ffce-9ea1-4ca2-8f92-f3e12ff5fdd8'
|
layout_elements
|
tuple[LayoutElement, ...]
|
The sub-layout elements of the group layout. These are part of the children of the group layout |
<dynamic>
|
group_fill
|
NoneValueType | Color | None
|
The fill color of the group layout |
None
|
group_fill_rule
|
FillRule | None
|
The fill rule of the group layout |
None
|
group_filter
|
NoneValueType | Filter | None
|
The filter of the group layout |
None
|
group_font_family
|
str | None
|
The font family of the group layout |
None
|
group_font_size
|
float | None
|
The font size of the group layout |
None
|
group_font_style
|
FontStyle | None
|
The font style of the group layout |
None
|
group_font_weight
|
FontWeight | float | None
|
The font weight of the group layout |
None
|
group_stroke
|
NoneValueType | Color | None
|
The stroke color of the group layout |
None
|
group_stroke_dasharray
|
NoneValueType | tuple[float, ...] | None
|
The stroke dasharray of the group layout |
None
|
group_stroke_dashoffset
|
NoneValueType | float | None
|
The stroke dashoffset of the group layout |
None
|
group_stroke_width
|
NoneValueType | float | None
|
The stroke width of the group layout |
None
|
group_text_anchor
|
TextAnchor | None
|
The text anchor of the group layout |
None
|
group_transform
|
NoneValueType | tuple[Transformation, ...] | None
|
The transform of the group layout |
None
|
end_shorten
|
float
|
The length the end of the arc will be shorten by |
0.0
|
fill
|
NoneValueType | Color | None
|
The fill color of the arc |
None
|
filter_
|
NoneValueType | Filter | None
|
The filter of the arc |
None
|
path_fill
|
NoneValueType | Color | None
|
The path fill color of the arc |
<momapy.drawing.NoneValueType object at 0x7fb1b7eb96a0>
|
path_filter
|
NoneValueType | Filter | None
|
The path filter of the arc |
None
|
path_stroke
|
NoneValueType | Color | None
|
The path stroke color of the arc |
Color(red=0, green=0, blue=0, alpha=1.0)
|
path_stroke_dasharray
|
NoneValueType | tuple[float, ...] | None
|
The path stroke dasharray of the arc |
None
|
path_stroke_dashoffset
|
NoneValueType | float | None
|
The path stroke dashoffset of the arc |
None
|
path_stroke_width
|
float | None
|
The path stroke width of the arc |
1.25
|
path_transform
|
NoneValueType | tuple[Transformation, ...] | None
|
The path transform of the arc |
None
|
stroke
|
NoneValueType | Color | None
|
The stroke color of the arc |
None
|
stroke_dasharray
|
NoneValueType | tuple[float, ...] | None
|
The stroke dasharray of the arc |
None
|
stroke_dashoffset
|
NoneValueType | float | None
|
The stroke dashoffset of the arc |
None
|
stroke_width
|
NoneValueType | float | None
|
The stroke width of the arc |
None
|
segments
|
tuple[Segment | QuadraticBezierCurve | CubicBezierCurve | EllipticalArc, ...]
|
The path segments of the arc |
<dynamic>
|
source
|
LayoutElement | None
|
The source of the arc |
None
|
start_shorten
|
float
|
The length the start of the arc will be shorten by |
0.0
|
target
|
LayoutElement | None
|
The target of the arc |
None
|
transform
|
NoneValueType | tuple[Transformation, ...] | None
|
The transform of the arc |
None
|
end_arrowhead_fill
|
NoneValueType | Color | None
|
The end arrowhead fill color of the arc |
Color(red=255, green=255, blue=255, alpha=1.0)
|
end_arrowhead_filter
|
NoneValueType | Filter | None
|
The end arrowhead filter of the arc |
None
|
end_arrowhead_stroke
|
NoneValueType | Color | None
|
The end arrowhead stroke color of the arc |
Color(red=0, green=0, blue=0, alpha=1.0)
|
end_arrowhead_stroke_dasharray
|
NoneValueType | tuple[float, ...] | None
|
The end arrowhead stroke dasharray of the arc |
None
|
end_arrowhead_stroke_dashoffset
|
NoneValueType | float | None
|
The end arrowhead stroke dashoffset of the arc |
None
|
end_arrowhead_stroke_width
|
float | None
|
The end arrowhead stroke width of the arc |
1.25
|
end_arrowhead_transform
|
NoneValueType | tuple[Transformation, ...] | None
|
The end arrowhead transform of the arc |
None
|
start_arrowhead_fill
|
NoneValueType | Color | None
|
The start arrowhead fill color of the arc |
Color(red=255, green=255, blue=255, alpha=1.0)
|
start_arrowhead_filter
|
NoneValueType | Filter | None
|
The start arrowhead filter of the arc |
None
|
start_arrowhead_stroke
|
NoneValueType | Color | None
|
The start arrowhead stroke color of the arc |
Color(red=0, green=0, blue=0, alpha=1.0)
|
start_arrowhead_stroke_dasharray
|
NoneValueType | tuple[float, ...] | None
|
The start arrowhead stroke dasharray of the arc |
None
|
start_arrowhead_stroke_dashoffset
|
NoneValueType | float | None
|
The start arrowhead stroke dashoffset of the arc |
None
|
start_arrowhead_stroke_width
|
float | None
|
The start arrowhead stroke width of the arc |
1.25
|
start_arrowhead_transform
|
NoneValueType | tuple[Transformation, ...] | None
|
The start arrowhead transform of the arc |
None
|
Methods:
| Name | Description |
|---|---|
anchor_point |
Return an anchor point of the layout element. |
bbox |
Compute and return the bounding box of the group layout element. |
childless |
Return a copy of the arc with no children. |
children |
Return the children of the group layout. |
contains |
Return |
descendants |
Return the descendants of the layout element. |
drawing_elements |
Return the drawing elements of the group layout. |
end_arrowhead_base |
Return the base anchor point of the double-headed arc end arrowhead. |
end_arrowhead_bbox |
Return the bounding box of the double-headed arc end arrowhead. |
end_arrowhead_border |
Return the point at the intersection of the drawing elements of the double-headed arc end arrowhead and the line going through the center of these drawing elements and the given point. |
end_arrowhead_drawing_elements |
Return the drawing elements of the double-headed arc end arrowhead. |
end_arrowhead_length |
Return the length of the double-headed arc end arrowhead. |
end_arrowhead_tip |
Return the tip anchor point of the double-headed arc end arrowhead. |
end_point |
Return the ending point of the arc. |
equals |
Return |
flattened |
Return a list containing copy of the layout element with no children and all its descendants with no children. |
fraction |
Return the position and angle on the arc at a given fraction (of the total arc length). |
length |
Return the total length of the arc path. |
own_bbox |
Compute and return the bounding box of the self drawing element of the group layout. |
own_children |
Return the self children of the arc. |
own_drawing_elements |
Return the self drawing elements of the double-headed arc. These include the drawing elements of the arc path, the start arrowhead, and the end arrowhead. |
own_to_geometry |
Return a list of geometry primitives from the self drawing elements. |
path_drawing_elements |
Return the drawing elements of the double-headed arc path. |
points |
Return the points of the arc path. |
start_arrowhead_base |
Return the base anchor point of the double-headed arc start arrowhead. |
start_arrowhead_bbox |
Return the bounding box of the double-headed arc start arrowhead. |
start_arrowhead_border |
Return the point at the intersection of the drawing elements of the double-headed arc start arrowhead and the line going through the center of these drawing elements and the given point. |
start_arrowhead_drawing_elements |
Return the drawing elements of the double-headed arc start arrowhead. |
start_arrowhead_length |
Return the length of the double-headed arc start arrowhead. |
start_arrowhead_tip |
Return the tip anchor point of the double-headed arc start arrowhead. |
start_point |
Return the starting point of the arc. |
to_geometry |
Return a list of geometry primitives from the drawing elements. |
anchor_point
anchor_point(anchor_name: str) -> Point
bbox
bbox() -> Bbox
Compute and return the bounding box of the group layout element.
Source code in src/momapy/core/layout.py
childless
children
children() -> list[LayoutElement]
Return the children of the group layout.
These are the self children of the group layout (returned by the own_children method) and the other children of the group layout (given by the layout_elements attribute).
Source code in src/momapy/core/layout.py
contains
contains(other: LayoutElement) -> bool
Return True if another layout element is a descendant of the layout element, False otherwise.
descendants
descendants() -> list[LayoutElement]
Return the descendants of the layout element.
This walks the explicit children() tree (i.e. visual
containment) depth-first, returning every layout element in the
contained subtree (without self).
Note the deliberate contrast with
ModelElement.descendants
and Model.descendants,
which reflectively walk the dataclass field-graph (i.e. reference
reachability) and deduplicate by object identity. A model element
referenced by several parents therefore appears once across the
model graph, whereas layout descendants are strictly the contained
subtree and a layout element contained under two parents is reached
through each.
Returns:
| Type | Description |
|---|---|
list[LayoutElement]
|
The list of descendant layout elements in visit order. |
Source code in src/momapy/core/elements.py
drawing_elements
drawing_elements() -> list[DrawingElement]
Return the drawing elements of the group layout.
The returned drawing elements are a group drawing element formed of the self drawing elements of the group layout and the drawing elements of its children.
Source code in src/momapy/core/layout.py
end_arrowhead_base
end_arrowhead_base() -> Point
Return the base anchor point of the double-headed arc end arrowhead.
Source code in src/momapy/core/layout.py
end_arrowhead_bbox
end_arrowhead_bbox() -> Bbox
end_arrowhead_border
Return the point at the intersection of the drawing elements of the double-headed arc end arrowhead and the line going through the center of these drawing elements and the given point.
When there are multiple intersection points, the one closest to the given point is returned.
Source code in src/momapy/core/layout.py
end_arrowhead_drawing_elements
end_arrowhead_drawing_elements() -> list[DrawingElement]
Return the drawing elements of the double-headed arc end arrowhead.
Source code in src/momapy/core/layout.py
end_arrowhead_length
Return the length of the double-headed arc end arrowhead.
Source code in src/momapy/core/layout.py
end_arrowhead_tip
end_arrowhead_tip() -> Point
Return the tip anchor point of the double-headed arc end arrowhead.
Source code in src/momapy/core/layout.py
end_point
end_point() -> Point
Return the ending point of the arc.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the arc has no segments. |
equals
equals(other: LayoutElement, flattened: bool = False, unordered: bool = False) -> bool
Return True if the layout element is equal to another layout element, False otherwise.
Source code in src/momapy/core/elements.py
flattened
flattened() -> list[LayoutElement]
Return a list containing copy of the layout element with no children and all its descendants with no children.
Source code in src/momapy/core/elements.py
fraction
fraction(fraction: float) -> tuple[Point, float]
Return the position and angle on the arc at a given fraction (of the total arc length).
Raises:
| Type | Description |
|---|---|
ValueError
|
If the arc has no segments. |
Source code in src/momapy/core/layout.py
length
own_bbox
own_bbox() -> Bbox
Compute and return the bounding box of the self drawing element of the group layout.
Source code in src/momapy/core/layout.py
own_children
own_children() -> list[LayoutElement]
own_drawing_elements
own_drawing_elements() -> list[DrawingElement]
Return the self drawing elements of the double-headed arc. These include the drawing elements of the arc path, the start arrowhead, and the end arrowhead.
Source code in src/momapy/core/layout.py
own_to_geometry
own_to_geometry() -> list[Segment | QuadraticBezierCurve | CubicBezierCurve | EllipticalArc]
Return a list of geometry primitives from the self drawing elements.
Source code in src/momapy/core/layout.py
path_drawing_elements
path_drawing_elements() -> list[Path]
Return the drawing elements of the double-headed arc path.
Source code in src/momapy/core/layout.py
points
points() -> list[Point]
Return the points of the arc path.
An arc with no segments has no points and returns an empty list.
Source code in src/momapy/core/layout.py
start_arrowhead_base
start_arrowhead_base() -> Point
Return the base anchor point of the double-headed arc start arrowhead.
Source code in src/momapy/core/layout.py
start_arrowhead_bbox
start_arrowhead_bbox() -> Bbox
Return the bounding box of the double-headed arc start arrowhead.
start_arrowhead_border
Return the point at the intersection of the drawing elements of the double-headed arc start arrowhead and the line going through the center of these drawing elements and the given point.
When there are multiple intersection points, the one closest to the given point is returned.
Source code in src/momapy/core/layout.py
start_arrowhead_drawing_elements
start_arrowhead_drawing_elements() -> list[DrawingElement]
Return the drawing elements of the double-headed arc start arrowhead.
Source code in src/momapy/core/layout.py
start_arrowhead_length
Return the length of the double-headed arc start arrowhead.
Source code in src/momapy/core/layout.py
start_arrowhead_tip
start_arrowhead_tip() -> Point
Return the tip anchor point of the double-headed arc start arrowhead.
Source code in src/momapy/core/layout.py
start_point
start_point() -> Point
Return the starting point of the arc.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the arc has no segments. |
to_geometry
to_geometry() -> list[Segment | QuadraticBezierCurve | CubicBezierCurve | EllipticalArc]
Return a list of geometry primitives from the drawing elements.
SBGNLayout
dataclass
SBGNLayout(*, id_: str = make_uuid4_as_str(), layout_elements: tuple[LayoutElement, ...] = tuple(), group_fill: NoneValueType | Color | None = None, group_fill_rule: FillRule | None = None, group_filter: NoneValueType | Filter | None = None, group_font_family: str | None = None, group_font_size: float | None = None, group_font_style: FontStyle | None = None, group_font_weight: FontWeight | float | None = None, group_stroke: NoneValueType | Color | None = None, group_stroke_dasharray: NoneValueType | tuple[float, ...] | None = None, group_stroke_dashoffset: NoneValueType | float | None = None, group_stroke_width: NoneValueType | float | None = None, group_text_anchor: TextAnchor | None = None, group_transform: NoneValueType | tuple[Transformation, ...] | None = None, fill: NoneValueType | Color | None = white, filter_: NoneValueType | Filter | None = None, height: float, label: TextLayout | None = None, position: Point, stroke: NoneValueType | Color | None = None, stroke_dasharray: NoneValueType | tuple[float, ...] | None = None, stroke_dashoffset: NoneValueType | float | None = None, stroke_width: NoneValueType | float | None = None, transform: NoneValueType | tuple[Transformation, ...] | None = None, width: float)
Bases: Layout
Base class for SBGN layouts.
SBGN layouts define the visual representation of SBGN models, including the positions and styles of glyphs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_
|
str
|
The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element |
'8ccd4512-a554-429e-b2a2-8ea3c066be05'
|
layout_elements
|
tuple[LayoutElement, ...]
|
The sub-layout elements of the group layout. These are part of the children of the group layout |
<dynamic>
|
group_fill
|
NoneValueType | Color | None
|
The fill color of the group layout |
None
|
group_fill_rule
|
FillRule | None
|
The fill rule of the group layout |
None
|
group_filter
|
NoneValueType | Filter | None
|
The filter of the group layout |
None
|
group_font_family
|
str | None
|
The font family of the group layout |
None
|
group_font_size
|
float | None
|
The font size of the group layout |
None
|
group_font_style
|
FontStyle | None
|
The font style of the group layout |
None
|
group_font_weight
|
FontWeight | float | None
|
The font weight of the group layout |
None
|
group_stroke
|
NoneValueType | Color | None
|
The stroke color of the group layout |
None
|
group_stroke_dasharray
|
NoneValueType | tuple[float, ...] | None
|
The stroke dasharray of the group layout |
None
|
group_stroke_dashoffset
|
NoneValueType | float | None
|
The stroke dashoffset of the group layout |
None
|
group_stroke_width
|
NoneValueType | float | None
|
The stroke width of the group layout |
None
|
group_text_anchor
|
TextAnchor | None
|
The text anchor of the group layout |
None
|
group_transform
|
NoneValueType | tuple[Transformation, ...] | None
|
The transform of the group layout |
None
|
fill
|
NoneValueType | Color | None
|
The fill color of the node |
Color(red=255, green=255, blue=255, alpha=1.0)
|
filter_
|
NoneValueType | Filter | None
|
The filter of the node |
None
|
height
|
float
|
The height of the node |
required |
label
|
TextLayout | None
|
The label of the node |
None
|
position
|
Point
|
The position of the node |
required |
stroke
|
NoneValueType | Color | None
|
The stroke color of the node |
None
|
stroke_dasharray
|
NoneValueType | tuple[float, ...] | None
|
The stroke dasharray of the node |
None
|
stroke_dashoffset
|
NoneValueType | float | None
|
The stroke dashoffset of the node |
None
|
stroke_width
|
NoneValueType | float | None
|
The stroke width of the node |
None
|
transform
|
NoneValueType | tuple[Transformation, ...] | None
|
The transform of the node |
None
|
width
|
float
|
The width of the node |
required |
Methods:
| Name | Description |
|---|---|
anchor_point |
Return an anchor point of the layout element. |
angle |
Return the point on the border of the node that intersects the drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal. |
bbox |
Compute and return the bounding box of the group layout element. |
border |
Return the point on the border of the node that intersects the drawing elements of the node with the line formed of the center anchor point of the node and the given point. |
center |
Return the center anchor of the node. |
childless |
Return a copy of the node with no children. |
children |
Return the children of the group layout. |
contains |
Return |
descendants |
Return the descendants of the layout element. |
drawing_elements |
Return the drawing elements of the group layout. |
east |
Return the east anchor of the node. |
east_north_east |
Return the east north east anchor of the node. |
east_south_east |
Return the east south east anchor of the node. |
equals |
Return |
flattened |
Return a list containing copy of the layout element with no children and all its descendants with no children. |
is_sublayout |
Return |
label_center |
Return the label center anchor of the node. |
north |
Return the north anchor of the node. |
north_east |
Return the north east anchor of the node. |
north_north_east |
Return the north north east anchor of the node. |
north_north_west |
Return the north north west anchor of the node. |
north_west |
Return the north west anchor of the node. |
own_angle |
Return the point on the border of the node that intersects the self drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal. |
own_bbox |
Compute and return the bounding box of the self drawing element of the group layout. |
own_border |
Return the point on the border of the node that intersects the self drawing elements of the node with the line formed of the center anchor point of the node and the given point. |
own_children |
Return the self children of the node. A node has unique child that is its label. |
own_drawing_elements |
Return the node's own drawing elements. |
own_to_geometry |
Return a list of geometry primitives from the self drawing elements. |
size |
Return the size of the node. |
south |
Return the south anchor of the node. |
south_east |
Return the south east anchor of the node. |
south_south_east |
Return the south south east anchor of the node. |
south_south_west |
Return the south south west anchor of the node. |
south_west |
Return the south west anchor of the node. |
to_geometry |
Return a list of geometry primitives from the drawing elements. |
west |
Return the west anchor of the node. |
west_north_west |
Return the west north west anchor of the node. |
west_south_west |
Return the west south west anchor of the node. |
Attributes:
| Name | Type | Description |
|---|---|---|
x |
float
|
Return the x coordinate of the node. |
y |
float
|
Return the y coordinate of the node. |
anchor_point
anchor_point(anchor_name: str) -> Point
angle
angle(angle: float, unit: Literal['degrees', 'radians'] = 'degrees') -> Point | None
Return the point on the border of the node that intersects the drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal.
Source code in src/momapy/core/layout.py
bbox
bbox() -> Bbox
Compute and return the bounding box of the group layout element.
Source code in src/momapy/core/layout.py
border
Return the point on the border of the node that intersects the drawing elements of the node with the line formed of the center anchor point of the node and the given point.
When there are multiple intersection points, the one closest to the given point is returned.
Source code in src/momapy/core/layout.py
center
center() -> Point
childless
children
children() -> list[LayoutElement]
Return the children of the group layout.
These are the self children of the group layout (returned by the own_children method) and the other children of the group layout (given by the layout_elements attribute).
Source code in src/momapy/core/layout.py
contains
contains(other: LayoutElement) -> bool
Return True if another layout element is a descendant of the layout element, False otherwise.
descendants
descendants() -> list[LayoutElement]
Return the descendants of the layout element.
This walks the explicit children() tree (i.e. visual
containment) depth-first, returning every layout element in the
contained subtree (without self).
Note the deliberate contrast with
ModelElement.descendants
and Model.descendants,
which reflectively walk the dataclass field-graph (i.e. reference
reachability) and deduplicate by object identity. A model element
referenced by several parents therefore appears once across the
model graph, whereas layout descendants are strictly the contained
subtree and a layout element contained under two parents is reached
through each.
Returns:
| Type | Description |
|---|---|
list[LayoutElement]
|
The list of descendant layout elements in visit order. |
Source code in src/momapy/core/elements.py
drawing_elements
drawing_elements() -> list[DrawingElement]
Return the drawing elements of the group layout.
The returned drawing elements are a group drawing element formed of the self drawing elements of the group layout and the drawing elements of its children.
Source code in src/momapy/core/layout.py
east
east() -> Point
east_north_east
east_north_east() -> Point
Return the east north east anchor of the node.
Source code in src/momapy/core/layout.py
east_south_east
east_south_east() -> Point
Return the east south east anchor of the node.
Source code in src/momapy/core/layout.py
equals
equals(other: LayoutElement, flattened: bool = False, unordered: bool = False) -> bool
Return True if the layout element is equal to another layout element, False otherwise.
Source code in src/momapy/core/elements.py
flattened
flattened() -> list[LayoutElement]
Return a list containing copy of the layout element with no children and all its descendants with no children.
Source code in src/momapy/core/elements.py
is_sublayout
is_sublayout(other: Layout, flattened: bool = False, unordered: bool = False) -> bool
Return True if the layout is a sublayout of another given layout, False otherwise.
Source code in src/momapy/core/layout.py
label_center
label_center() -> Point
north
north() -> Point
north_east
north_east() -> Point
Return the north east anchor of the node.
Source code in src/momapy/core/layout.py
north_north_east
north_north_east() -> Point
Return the north north east anchor of the node.
Source code in src/momapy/core/layout.py
north_north_west
north_north_west() -> Point
Return the north north west anchor of the node.
Source code in src/momapy/core/layout.py
north_west
north_west() -> Point
Return the north west anchor of the node.
Source code in src/momapy/core/layout.py
own_angle
own_angle(angle: float, unit: Literal['degrees', 'radians'] = 'degrees') -> Point | None
Return the point on the border of the node that intersects the self drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal.
Source code in src/momapy/core/layout.py
own_bbox
own_bbox() -> Bbox
Compute and return the bounding box of the self drawing element of the group layout.
Source code in src/momapy/core/layout.py
own_border
Return the point on the border of the node that intersects the self drawing elements of the node with the line formed of the center anchor point of the node and the given point.
When there are multiple intersection points, the one closest to the given point is returned.
Source code in src/momapy/core/layout.py
own_children
own_children() -> list[LayoutElement]
Return the self children of the node. A node has unique child that is its label.
own_drawing_elements
own_drawing_elements() -> list[DrawingElement]
Return the node's own drawing elements.
Source code in src/momapy/core/layout.py
own_to_geometry
own_to_geometry() -> list[Segment | QuadraticBezierCurve | CubicBezierCurve | EllipticalArc]
Return a list of geometry primitives from the self drawing elements.
Source code in src/momapy/core/layout.py
size
south
south() -> Point
south_east
south_east() -> Point
Return the south east anchor of the node.
Source code in src/momapy/core/layout.py
south_south_east
south_south_east() -> Point
Return the south south east anchor of the node.
Source code in src/momapy/core/layout.py
south_south_west
south_south_west() -> Point
Return the south south west anchor of the node.
Source code in src/momapy/core/layout.py
south_west
south_west() -> Point
Return the south west anchor of the node.
Source code in src/momapy/core/layout.py
to_geometry
to_geometry() -> list[Segment | QuadraticBezierCurve | CubicBezierCurve | EllipticalArc]
Return a list of geometry primitives from the drawing elements.
west
west() -> Point
west_north_west
west_north_west() -> Point
Return the west north west anchor of the node.
Source code in src/momapy/core/layout.py
west_south_west
west_south_west() -> Point
Return the west south west anchor of the node.
Source code in src/momapy/core/layout.py
SBGNMap
dataclass
SBGNMap(*, id_: str = make_uuid4_as_str(), model: SBGNModel | None = None, layout: SBGNLayout | None = None, layout_model_mapping: LayoutModelMapping | None = None)
Bases: Map
Abstract base class for SBGN maps.
SBGN maps combine a model and its visual layout into a complete diagram representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_
|
str
|
The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element |
'5b61ad97-5448-4e41-8ab2-76556fb65eba'
|
model
|
SBGNModel | None
|
The model of the map |
None
|
layout
|
SBGNLayout | None
|
The layout of the map |
None
|
layout_model_mapping
|
LayoutModelMapping | None
|
The layout model mapping of the map |
None
|
Methods:
| Name | Description |
|---|---|
get_mapping |
Return the model element or layout elements mapped to |
is_submap |
Return |
get_mapping
get_mapping(map_element: MapElement) -> ModelElement | list[LayoutElement | frozenset[LayoutElement]] | None
Return the model element or layout elements mapped to map_element.
The lookup is bidirectional: a layout key (a singleton or frozenset)
resolves to its model element, and a model element resolves to the
list of layout keys mapped to it. Forwards to
layout_model_mapping.get_mapping.
Returns None when the map has no layout_model_mapping (for
example a layout-less map such as one read from SBML).
Source code in src/momapy/core/map.py
is_submap
is_submap(other: Map) -> bool
Return True if the Map is a submap of another given map, False otherwise.
A complete map is never a submap of an incomplete one: if either self
or other has a None model, layout, or layout-model mapping, this
returns False.
Source code in src/momapy/core/map.py
SBGNModel
dataclass
Bases: Model
Abstract base class for SBGN models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_
|
str
|
The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element |
'667520f3-11b4-472b-8eda-feed44da5aeb'
|
Methods:
| Name | Description |
|---|---|
descendants |
Return every |
is_submodel |
Return whether this model is a submodel of another model. |
descendants
descendants() -> list[ModelElement]
Return every ModelElement reachable from this Model.
This reflectively walks the dataclass field-graph (i.e. reference
reachability) across scalar ModelElement fields and
frozenset/tuple containers of the Model, deduplicating by
object identity. The Model itself is not a ModelElement and is
not included.
This mirrors
ModelElement.descendants
and contrasts with
LayoutElement.descendants,
which walks the explicit children() tree (visual containment)
rather than reference reachability.
Returns:
| Type | Description |
|---|---|
list[ModelElement]
|
The list of reachable |
list[ModelElement]
|
order. |
Source code in src/momapy/core/model.py
is_submodel
abstractmethod
is_submodel(other: Model) -> bool
Return whether this model is a submodel of another model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
Model
|
The model to test against. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
Source code in src/momapy/core/model.py
SBGNModelElement
dataclass
Bases: ModelElement
Abstract base class for SBGN model elements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_
|
str
|
The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element |
'2ac09973-bd0a-4feb-9c58-c6b8b90e28b6'
|
Methods:
| Name | Description |
|---|---|
descendants |
Return every |
descendants
descendants() -> list[ModelElement]
Return every ModelElement reachable from self, excluding self.
This reflectively walks the dataclass field-graph (i.e. reference
reachability) across scalar ModelElement fields and
frozenset/tuple containers, deduplicating by object identity. A
model element referenced by several parents therefore appears once.
Note the deliberate contrast with
LayoutElement.descendants,
which instead walks the explicit children() tree (visual
containment): there a layout element contained under two parents is
reached through each, with no identity dedup.
Returns:
| Type | Description |
|---|---|
list[ModelElement]
|
The list of reachable |
list[ModelElement]
|
order, without |
Source code in src/momapy/core/elements.py
SBGNNode
dataclass
SBGNNode(*, id_: str = make_uuid4_as_str(), layout_elements: tuple[LayoutElement, ...] = tuple(), group_fill: NoneValueType | Color | None = None, group_fill_rule: FillRule | None = None, group_filter: NoneValueType | Filter | None = None, group_font_family: str | None = None, group_font_size: float | None = None, group_font_style: FontStyle | None = None, group_font_weight: FontWeight | float | None = None, group_stroke: NoneValueType | Color | None = None, group_stroke_dasharray: NoneValueType | tuple[float, ...] | None = None, group_stroke_dashoffset: NoneValueType | float | None = None, group_stroke_width: NoneValueType | float | None = None, group_text_anchor: TextAnchor | None = None, group_transform: NoneValueType | tuple[Transformation, ...] | None = None, fill: NoneValueType | Color | None = white, filter_: NoneValueType | Filter | None = None, height: float, label: TextLayout | None = None, position: Point, stroke: NoneValueType | Color | None = black, stroke_dasharray: NoneValueType | tuple[float, ...] | None = None, stroke_dashoffset: NoneValueType | float | None = None, stroke_width: float | None = 1.25, transform: NoneValueType | tuple[Transformation, ...] | None = None, width: float)
Bases: Node
Abstract base class for SBGN nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_
|
str
|
The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element |
'e7f2edc3-a4b8-425b-9a50-5be6d3910b12'
|
layout_elements
|
tuple[LayoutElement, ...]
|
The sub-layout elements of the group layout. These are part of the children of the group layout |
<dynamic>
|
group_fill
|
NoneValueType | Color | None
|
The fill color of the group layout |
None
|
group_fill_rule
|
FillRule | None
|
The fill rule of the group layout |
None
|
group_filter
|
NoneValueType | Filter | None
|
The filter of the group layout |
None
|
group_font_family
|
str | None
|
The font family of the group layout |
None
|
group_font_size
|
float | None
|
The font size of the group layout |
None
|
group_font_style
|
FontStyle | None
|
The font style of the group layout |
None
|
group_font_weight
|
FontWeight | float | None
|
The font weight of the group layout |
None
|
group_stroke
|
NoneValueType | Color | None
|
The stroke color of the group layout |
None
|
group_stroke_dasharray
|
NoneValueType | tuple[float, ...] | None
|
The stroke dasharray of the group layout |
None
|
group_stroke_dashoffset
|
NoneValueType | float | None
|
The stroke dashoffset of the group layout |
None
|
group_stroke_width
|
NoneValueType | float | None
|
The stroke width of the group layout |
None
|
group_text_anchor
|
TextAnchor | None
|
The text anchor of the group layout |
None
|
group_transform
|
NoneValueType | tuple[Transformation, ...] | None
|
The transform of the group layout |
None
|
fill
|
NoneValueType | Color | None
|
The fill color of the node |
Color(red=255, green=255, blue=255, alpha=1.0)
|
filter_
|
NoneValueType | Filter | None
|
The filter of the node |
None
|
height
|
float
|
The height of the node |
required |
label
|
TextLayout | None
|
The label of the node |
None
|
position
|
Point
|
The position of the node |
required |
stroke
|
NoneValueType | Color | None
|
The stroke color of the node |
Color(red=0, green=0, blue=0, alpha=1.0)
|
stroke_dasharray
|
NoneValueType | tuple[float, ...] | None
|
The stroke dasharray of the node |
None
|
stroke_dashoffset
|
NoneValueType | float | None
|
The stroke dashoffset of the node |
None
|
stroke_width
|
float | None
|
The stroke width of the node |
1.25
|
transform
|
NoneValueType | tuple[Transformation, ...] | None
|
The transform of the node |
None
|
width
|
float
|
The width of the node |
required |
Methods:
| Name | Description |
|---|---|
anchor_point |
Return an anchor point of the layout element. |
angle |
Return the point on the border of the node that intersects the drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal. |
bbox |
Compute and return the bounding box of the group layout element. |
border |
Return the point on the border of the node that intersects the drawing elements of the node with the line formed of the center anchor point of the node and the given point. |
center |
Return the center anchor of the node. |
childless |
Return a copy of the node with no children. |
children |
Return the children of the group layout. |
contains |
Return |
descendants |
Return the descendants of the layout element. |
drawing_elements |
Return the drawing elements of the group layout. |
east |
Return the east anchor of the node. |
east_north_east |
Return the east north east anchor of the node. |
east_south_east |
Return the east south east anchor of the node. |
equals |
Return |
flattened |
Return a list containing copy of the layout element with no children and all its descendants with no children. |
label_center |
Return the label center anchor of the node. |
north |
Return the north anchor of the node. |
north_east |
Return the north east anchor of the node. |
north_north_east |
Return the north north east anchor of the node. |
north_north_west |
Return the north north west anchor of the node. |
north_west |
Return the north west anchor of the node. |
own_angle |
Return the point on the border of the node that intersects the self drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal. |
own_bbox |
Compute and return the bounding box of the self drawing element of the group layout. |
own_border |
Return the point on the border of the node that intersects the self drawing elements of the node with the line formed of the center anchor point of the node and the given point. |
own_children |
Return the self children of the node. A node has unique child that is its label. |
own_drawing_elements |
Return the node's own drawing elements. |
own_to_geometry |
Return a list of geometry primitives from the self drawing elements. |
size |
Return the size of the node. |
south |
Return the south anchor of the node. |
south_east |
Return the south east anchor of the node. |
south_south_east |
Return the south south east anchor of the node. |
south_south_west |
Return the south south west anchor of the node. |
south_west |
Return the south west anchor of the node. |
to_geometry |
Return a list of geometry primitives from the drawing elements. |
west |
Return the west anchor of the node. |
west_north_west |
Return the west north west anchor of the node. |
west_south_west |
Return the west south west anchor of the node. |
Attributes:
| Name | Type | Description |
|---|---|---|
x |
float
|
Return the x coordinate of the node. |
y |
float
|
Return the y coordinate of the node. |
anchor_point
anchor_point(anchor_name: str) -> Point
angle
angle(angle: float, unit: Literal['degrees', 'radians'] = 'degrees') -> Point | None
Return the point on the border of the node that intersects the drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal.
Source code in src/momapy/core/layout.py
bbox
bbox() -> Bbox
Compute and return the bounding box of the group layout element.
Source code in src/momapy/core/layout.py
border
Return the point on the border of the node that intersects the drawing elements of the node with the line formed of the center anchor point of the node and the given point.
When there are multiple intersection points, the one closest to the given point is returned.
Source code in src/momapy/core/layout.py
center
center() -> Point
childless
children
children() -> list[LayoutElement]
Return the children of the group layout.
These are the self children of the group layout (returned by the own_children method) and the other children of the group layout (given by the layout_elements attribute).
Source code in src/momapy/core/layout.py
contains
contains(other: LayoutElement) -> bool
Return True if another layout element is a descendant of the layout element, False otherwise.
descendants
descendants() -> list[LayoutElement]
Return the descendants of the layout element.
This walks the explicit children() tree (i.e. visual
containment) depth-first, returning every layout element in the
contained subtree (without self).
Note the deliberate contrast with
ModelElement.descendants
and Model.descendants,
which reflectively walk the dataclass field-graph (i.e. reference
reachability) and deduplicate by object identity. A model element
referenced by several parents therefore appears once across the
model graph, whereas layout descendants are strictly the contained
subtree and a layout element contained under two parents is reached
through each.
Returns:
| Type | Description |
|---|---|
list[LayoutElement]
|
The list of descendant layout elements in visit order. |
Source code in src/momapy/core/elements.py
drawing_elements
drawing_elements() -> list[DrawingElement]
Return the drawing elements of the group layout.
The returned drawing elements are a group drawing element formed of the self drawing elements of the group layout and the drawing elements of its children.
Source code in src/momapy/core/layout.py
east
east() -> Point
east_north_east
east_north_east() -> Point
Return the east north east anchor of the node.
Source code in src/momapy/core/layout.py
east_south_east
east_south_east() -> Point
Return the east south east anchor of the node.
Source code in src/momapy/core/layout.py
equals
equals(other: LayoutElement, flattened: bool = False, unordered: bool = False) -> bool
Return True if the layout element is equal to another layout element, False otherwise.
Source code in src/momapy/core/elements.py
flattened
flattened() -> list[LayoutElement]
Return a list containing copy of the layout element with no children and all its descendants with no children.
Source code in src/momapy/core/elements.py
label_center
label_center() -> Point
north
north() -> Point
north_east
north_east() -> Point
Return the north east anchor of the node.
Source code in src/momapy/core/layout.py
north_north_east
north_north_east() -> Point
Return the north north east anchor of the node.
Source code in src/momapy/core/layout.py
north_north_west
north_north_west() -> Point
Return the north north west anchor of the node.
Source code in src/momapy/core/layout.py
north_west
north_west() -> Point
Return the north west anchor of the node.
Source code in src/momapy/core/layout.py
own_angle
own_angle(angle: float, unit: Literal['degrees', 'radians'] = 'degrees') -> Point | None
Return the point on the border of the node that intersects the self drawing elements of the node with the line passing through the center anchor point of the node and at a given angle from the horizontal.
Source code in src/momapy/core/layout.py
own_bbox
own_bbox() -> Bbox
Compute and return the bounding box of the self drawing element of the group layout.
Source code in src/momapy/core/layout.py
own_border
Return the point on the border of the node that intersects the self drawing elements of the node with the line formed of the center anchor point of the node and the given point.
When there are multiple intersection points, the one closest to the given point is returned.
Source code in src/momapy/core/layout.py
own_children
own_children() -> list[LayoutElement]
Return the self children of the node. A node has unique child that is its label.
own_drawing_elements
own_drawing_elements() -> list[DrawingElement]
Return the node's own drawing elements.
Source code in src/momapy/core/layout.py
own_to_geometry
own_to_geometry() -> list[Segment | QuadraticBezierCurve | CubicBezierCurve | EllipticalArc]
Return a list of geometry primitives from the self drawing elements.
Source code in src/momapy/core/layout.py
size
south
south() -> Point
south_east
south_east() -> Point
Return the south east anchor of the node.
Source code in src/momapy/core/layout.py
south_south_east
south_south_east() -> Point
Return the south south east anchor of the node.
Source code in src/momapy/core/layout.py
south_south_west
south_south_west() -> Point
Return the south south west anchor of the node.
Source code in src/momapy/core/layout.py
south_west
south_west() -> Point
Return the south west anchor of the node.
Source code in src/momapy/core/layout.py
to_geometry
to_geometry() -> list[Segment | QuadraticBezierCurve | CubicBezierCurve | EllipticalArc]
Return a list of geometry primitives from the drawing elements.
west
west() -> Point
west_north_west
west_north_west() -> Point
Return the west north west anchor of the node.
Source code in src/momapy/core/layout.py
west_south_west
west_south_west() -> Point
Return the west south west anchor of the node.
Source code in src/momapy/core/layout.py
SBGNRole
dataclass
SBGNRole(*, id_: str = make_uuid4_as_str(), referred_element: SBGNModelElement)
Bases: SBGNModelElement
Abstract base class for SBGN roles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_
|
str
|
The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element |
'3058a96a-4f26-4363-b709-c74c38730179'
|
referred_element
|
SBGNModelElement
|
The SBGN model element this role refers to. |
required |
Methods:
| Name | Description |
|---|---|
descendants |
Return every |
descendants
descendants() -> list[ModelElement]
Return every ModelElement reachable from self, excluding self.
This reflectively walks the dataclass field-graph (i.e. reference
reachability) across scalar ModelElement fields and
frozenset/tuple containers, deduplicating by object identity. A
model element referenced by several parents therefore appears once.
Note the deliberate contrast with
LayoutElement.descendants,
which instead walks the explicit children() tree (visual
containment): there a layout element contained under two parents is
reached through each, with no identity dedup.
Returns:
| Type | Description |
|---|---|
list[ModelElement]
|
The list of reachable |
list[ModelElement]
|
order, without |
Source code in src/momapy/core/elements.py
SBGNSingleHeadedArc
dataclass
SBGNSingleHeadedArc(*, id_: str = make_uuid4_as_str(), layout_elements: tuple[LayoutElement, ...] = tuple(), group_fill: NoneValueType | Color | None = None, group_fill_rule: FillRule | None = None, group_filter: NoneValueType | Filter | None = None, group_font_family: str | None = None, group_font_size: float | None = None, group_font_style: FontStyle | None = None, group_font_weight: FontWeight | float | None = None, group_stroke: NoneValueType | Color | None = None, group_stroke_dasharray: NoneValueType | tuple[float, ...] | None = None, group_stroke_dashoffset: NoneValueType | float | None = None, group_stroke_width: NoneValueType | float | None = None, group_text_anchor: TextAnchor | None = None, group_transform: NoneValueType | tuple[Transformation, ...] | None = None, end_shorten: float = 0.0, fill: NoneValueType | Color | None = None, filter_: NoneValueType | Filter | None = None, path_fill: NoneValueType | Color | None = NoneValue, path_filter: NoneValueType | Filter | None = None, path_stroke: NoneValueType | Color | None = black, path_stroke_dasharray: NoneValueType | tuple[float, ...] | None = None, path_stroke_dashoffset: NoneValueType | float | None = None, path_stroke_width: float | None = 1.25, path_transform: NoneValueType | tuple[Transformation, ...] | None = None, stroke: NoneValueType | Color | None = None, stroke_dasharray: NoneValueType | tuple[float, ...] | None = None, stroke_dashoffset: NoneValueType | float | None = None, stroke_width: NoneValueType | float | None = None, segments: tuple[Segment | QuadraticBezierCurve | CubicBezierCurve | EllipticalArc, ...] = tuple(), source: LayoutElement | None = None, start_shorten: float = 0.0, target: LayoutElement | None = None, transform: NoneValueType | tuple[Transformation, ...] | None = None, arrowhead_fill: NoneValueType | Color | None = white, arrowhead_filter: NoneValueType | Filter | None = None, arrowhead_stroke: NoneValueType | Color | None = black, arrowhead_stroke_dasharray: NoneValueType | tuple[float, ...] | None = None, arrowhead_stroke_dashoffset: NoneValueType | float | None = None, arrowhead_stroke_width: float | None = 1.25, arrowhead_transform: NoneValueType | tuple[Transformation, ...] | None = None)
Bases: SingleHeadedArc
Abstract base class for SBGN single-headed arcs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_
|
str
|
The id of the map element. This id is purely for the user to keep track of the element, it does not need to be unique and is not part of the identity of the element, i.e., it is not considered when testing for equality between two map elements or when hashing the map element |
'1cc0c605-fdad-406e-b486-bbd9bef48a20'
|
layout_elements
|
tuple[LayoutElement, ...]
|
The sub-layout elements of the group layout. These are part of the children of the group layout |
<dynamic>
|
group_fill
|
NoneValueType | Color | None
|
The fill color of the group layout |
None
|
group_fill_rule
|
FillRule | None
|
The fill rule of the group layout |
None
|
group_filter
|
NoneValueType | Filter | None
|
The filter of the group layout |
None
|
group_font_family
|
str | None
|
The font family of the group layout |
None
|
group_font_size
|
float | None
|
The font size of the group layout |
None
|
group_font_style
|
FontStyle | None
|
The font style of the group layout |
None
|
group_font_weight
|
FontWeight | float | None
|
The font weight of the group layout |
None
|
group_stroke
|
NoneValueType | Color | None
|
The stroke color of the group layout |
None
|
group_stroke_dasharray
|
NoneValueType | tuple[float, ...] | None
|
The stroke dasharray of the group layout |
None
|
group_stroke_dashoffset
|
NoneValueType | float | None
|
The stroke dashoffset of the group layout |
None
|
group_stroke_width
|
NoneValueType | float | None
|
The stroke width of the group layout |
None
|
group_text_anchor
|
TextAnchor | None
|
The text anchor of the group layout |
None
|
group_transform
|
NoneValueType | tuple[Transformation, ...] | None
|
The transform of the group layout |
None
|
end_shorten
|
float
|
The length the end of the arc will be shorten by |
0.0
|
fill
|
NoneValueType | Color | None
|
The fill color of the arc |
None
|
filter_
|
NoneValueType | Filter | None
|
The filter of the arc |
None
|
path_fill
|
NoneValueType | Color | None
|
The path fill color of the arc |
<momapy.drawing.NoneValueType object at 0x7fb1b7eb96a0>
|
path_filter
|
NoneValueType | Filter | None
|
The path filter of the arc |
None
|
path_stroke
|
NoneValueType | Color | None
|
The path stroke color of the arc |
Color(red=0, green=0, blue=0, alpha=1.0)
|
path_stroke_dasharray
|
NoneValueType | tuple[float, ...] | None
|
The path stroke dasharray of the arc |
None
|
path_stroke_dashoffset
|
NoneValueType | float | None
|
The path stroke dashoffset of the arc |
None
|
path_stroke_width
|
float | None
|
The path stroke width of the arc |
1.25
|
path_transform
|
NoneValueType | tuple[Transformation, ...] | None
|
The path transform of the arc |
None
|
stroke
|
NoneValueType | Color | None
|
The stroke color of the arc |
None
|
stroke_dasharray
|
NoneValueType | tuple[float, ...] | None
|
The stroke dasharray of the arc |
None
|
stroke_dashoffset
|
NoneValueType | float | None
|
The stroke dashoffset of the arc |
None
|
stroke_width
|
NoneValueType | float | None
|
The stroke width of the arc |
None
|
segments
|
tuple[Segment | QuadraticBezierCurve | CubicBezierCurve | EllipticalArc, ...]
|
The path segments of the arc |
<dynamic>
|
source
|
LayoutElement | None
|
The source of the arc |
None
|
start_shorten
|
float
|
The length the start of the arc will be shorten by |
0.0
|
target
|
LayoutElement | None
|
The target of the arc |
None
|
transform
|
NoneValueType | tuple[Transformation, ...] | None
|
The transform of the arc |
None
|
arrowhead_fill
|
NoneValueType | Color | None
|
The arrowhead fill color of the arc |
Color(red=255, green=255, blue=255, alpha=1.0)
|
arrowhead_filter
|
NoneValueType | Filter | None
|
The arrowhead filter of the arc |
None
|
arrowhead_stroke
|
NoneValueType | Color | None
|
The arrowhead stroke color of the arc |
Color(red=0, green=0, blue=0, alpha=1.0)
|
arrowhead_stroke_dasharray
|
NoneValueType | tuple[float, ...] | None
|
The arrowhead stroke dasharray of the arc |
None
|
arrowhead_stroke_dashoffset
|
NoneValueType | float | None
|
The arrowhead stroke dashoffset of the arc |
None
|
arrowhead_stroke_width
|
float | None
|
The arrowhead stroke width of the arc |
1.25
|
arrowhead_transform
|
NoneValueType | tuple[Transformation, ...] | None
|
The arrowhead transform of the arc |
None
|
Methods:
| Name | Description |
|---|---|
anchor_point |
Return an anchor point of the layout element. |
arrowhead_base |
Return the arrowhead base anchor point of the single-headed arc. |
arrowhead_bbox |
Return the bounding box of the single-headed arc arrowhead. |
arrowhead_border |
Return the point at the intersection of the drawing elements of the single-headed arc arrowhead and the line going through the center of these drawing elements and the given point. |
arrowhead_drawing_elements |
Return the drawing elements of the single-headed arc arrowhead. |
arrowhead_length |
Return the length of the single-headed arc arrowhead. |
arrowhead_tip |
Return the arrowhead tip anchor point of the single-headed arc. |
bbox |
Compute and return the bounding box of the group layout element. |
childless |
Return a copy of the arc with no children. |
children |
Return the children of the group layout. |
contains |
Return |
descendants |
Return the descendants of the layout element. |
drawing_elements |
Return the drawing elements of the group layout. |
end_point |
Return the ending point of the arc. |
equals |
Return |
flattened |
Return a list containing copy of the layout element with no children and all its descendants with no children. |
fraction |
Return the position and angle on the arc at a given fraction (of the total arc length). |
length |
Return the total length of the arc path. |
own_bbox |
Compute and return the bounding box of the self drawing element of the group layout. |
own_children |
Return the self children of the arc. |
own_drawing_elements |
Return the self drawing elements of the single-headed arc. |
own_to_geometry |
Return a list of geometry primitives from the self drawing elements. |
path_drawing_elements |
Return the drawing elements of the single-headed arc path. |
points |
Return the points of the arc path. |
start_point |
Return the starting point of the arc. |
to_geometry |
Return a list of geometry primitives from the drawing elements. |
anchor_point
anchor_point(anchor_name: str) -> Point
arrowhead_base
arrowhead_base() -> Point
Return the arrowhead base anchor point of the single-headed arc.
Source code in src/momapy/core/layout.py
arrowhead_bbox
arrowhead_bbox() -> Bbox
arrowhead_border
Return the point at the intersection of the drawing elements of the single-headed arc arrowhead and the line going through the center of these drawing elements and the given point.
When there are multiple intersection points, the one closest to the given point is returned.
Source code in src/momapy/core/layout.py
arrowhead_drawing_elements
arrowhead_drawing_elements() -> list[DrawingElement]
Return the drawing elements of the single-headed arc arrowhead.
Source code in src/momapy/core/layout.py
arrowhead_length
Return the length of the single-headed arc arrowhead.
Source code in src/momapy/core/layout.py
arrowhead_tip
arrowhead_tip() -> Point
Return the arrowhead tip anchor point of the single-headed arc.
Source code in src/momapy/core/layout.py
bbox
bbox() -> Bbox
Compute and return the bounding box of the group layout element.
Source code in src/momapy/core/layout.py
childless
children
children() -> list[LayoutElement]
Return the children of the group layout.
These are the self children of the group layout (returned by the own_children method) and the other children of the group layout (given by the layout_elements attribute).
Source code in src/momapy/core/layout.py
contains
contains(other: LayoutElement) -> bool
Return True if another layout element is a descendant of the layout element, False otherwise.
descendants
descendants() -> list[LayoutElement]
Return the descendants of the layout element.
This walks the explicit children() tree (i.e. visual
containment) depth-first, returning every layout element in the
contained subtree (without self).
Note the deliberate contrast with
ModelElement.descendants
and Model.descendants,
which reflectively walk the dataclass field-graph (i.e. reference
reachability) and deduplicate by object identity. A model element
referenced by several parents therefore appears once across the
model graph, whereas layout descendants are strictly the contained
subtree and a layout element contained under two parents is reached
through each.
Returns:
| Type | Description |
|---|---|
list[LayoutElement]
|
The list of descendant layout elements in visit order. |
Source code in src/momapy/core/elements.py
drawing_elements
drawing_elements() -> list[DrawingElement]
Return the drawing elements of the group layout.
The returned drawing elements are a group drawing element formed of the self drawing elements of the group layout and the drawing elements of its children.
Source code in src/momapy/core/layout.py
end_point
end_point() -> Point
Return the ending point of the arc.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the arc has no segments. |
equals
equals(other: LayoutElement, flattened: bool = False, unordered: bool = False) -> bool
Return True if the layout element is equal to another layout element, False otherwise.
Source code in src/momapy/core/elements.py
flattened
flattened() -> list[LayoutElement]
Return a list containing copy of the layout element with no children and all its descendants with no children.
Source code in src/momapy/core/elements.py
fraction
fraction(fraction: float) -> tuple[Point, float]
Return the position and angle on the arc at a given fraction (of the total arc length).
Raises:
| Type | Description |
|---|---|
ValueError
|
If the arc has no segments. |
Source code in src/momapy/core/layout.py
length
own_bbox
own_bbox() -> Bbox
Compute and return the bounding box of the self drawing element of the group layout.
Source code in src/momapy/core/layout.py
own_children
own_children() -> list[LayoutElement]
own_drawing_elements
own_drawing_elements() -> list[DrawingElement]
Return the self drawing elements of the single-headed arc.
Source code in src/momapy/core/layout.py
own_to_geometry
own_to_geometry() -> list[Segment | QuadraticBezierCurve | CubicBezierCurve | EllipticalArc]
Return a list of geometry primitives from the self drawing elements.
Source code in src/momapy/core/layout.py
path_drawing_elements
path_drawing_elements() -> list[Path]
Return the drawing elements of the single-headed arc path.
Source code in src/momapy/core/layout.py
points
points() -> list[Point]
Return the points of the arc path.
An arc with no segments has no points and returns an empty list.
Source code in src/momapy/core/layout.py
start_point
start_point() -> Point
Return the starting point of the arc.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the arc has no segments. |
to_geometry
to_geometry() -> list[Segment | QuadraticBezierCurve | CubicBezierCurve | EllipticalArc]
Return a list of geometry primitives from the drawing elements.