cytoscape¶
Module for visualization in Cytoscape.
Supports loading of networks, annotations and storing of images.
The visualization talks to a running Cytoscape through
py4cytoscape, which is the optional
cytoscape extra (pip install sbmlutils[cytoscape]). Without it, and without
a running Cytoscape, the functions log a warning and do nothing instead of
raising, so a model creation script which visualizes at the end still finishes.
AnnotationShapeType
¶
Bases: StrEnum
Shape of an annotation on the cytoscape canvas.
AnnotationShape
dataclass
¶
AnnotationShape(
type,
x_pos,
y_pos,
height,
width,
fill_color="#000000",
opacity=100,
border_thickness=1,
border_color="#FFFFFF",
border_opacity=100,
canvas="background",
z_order=0,
)
Shape annotation on the cytoscape canvas.
AnnotationText
dataclass
¶
AnnotationText(
text,
x_pos,
y_pos,
font_size=12,
font_family="Arial",
font_style="bold",
color="#000000",
angle=0,
canvas="background",
)
Text annotation on the cytoscape canvas.
AnnotationBoundedText
dataclass
¶
AnnotationBoundedText(
type,
text,
x_pos,
y_pos,
height,
width,
fill_color="#000000",
opacity=100,
border_thickness=1,
border_color="#FFFFFF",
border_opacity=100,
font_size=12,
font_family="Arial",
font_style="bold",
color="#000000",
angle=0,
canvas="background",
)
Text annotation inside a shape on the cytoscape canvas.
visualize_antimony
¶
Visualize antimony in cytoscape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Path | str
|
antimony string or path to an antimony file. |
required |
delete_session
|
bool
|
close the current Cytoscape session without saving. |
False
|
Returns:
| Type | Description |
|---|---|
int | None
|
The SUID of the imported network, or None if nothing was visualized. |
visualize_sbml
¶
Visualize SBML networks in cytoscape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sbml_path
|
Path
|
path to the SBML file. |
required |
delete_session
|
bool
|
close the current Cytoscape session without saving. |
False
|
Returns:
| Type | Description |
|---|---|
int | None
|
The SUID of the imported network, or None if py4cytoscape is missing or |
int | None
|
Cytoscape could not be reached or rejected the model. |
read_layout_xml
¶
Read the xml layout information from cytoscape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xml_path
|
Path
|
path to the xml file with the layout. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
The positions "x" and "y" indexed by id. |
apply_layout
¶
Apply layout information from Cytoscape to SBML networks.
export_image
¶
Helper for exporting cytoscape images.
format (str): Type of image to export, e.g., PNG (default), JPEG, PDF, SVG, PS (PostScript).