gxformat2.cytoscape package#

Submodules#

gxformat2.cytoscape.models module#

Pydantic models for Cytoscape.js workflow visualization elements.

class gxformat2.cytoscape.models.CytoscapeEdge(*, group: Literal['edges'] = 'edges', data: CytoscapeEdgeData)[source]#

Bases: BaseModel

A Cytoscape.js edge element.

data: CytoscapeEdgeData#
group: Literal['edges']#
model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class gxformat2.cytoscape.models.CytoscapeEdgeData(*, id: str, source: str, target: str, input: str, output: str | None = None)[source]#

Bases: BaseModel

Data payload for a Cytoscape edge (step connection).

id: str#
input: str#
model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

output: str | None#
source: str#
target: str#
class gxformat2.cytoscape.models.CytoscapeElements(*, nodes: list[CytoscapeNode] = <factory>, edges: list[CytoscapeEdge] = <factory>, layout: CytoscapeLayout | None = None)[source]#

Bases: BaseModel

Complete set of Cytoscape.js elements for a workflow visualization.

edges: list[CytoscapeEdge]#
layout: CytoscapeLayout | None#
model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

nodes: list[CytoscapeNode]#
to_dict() dict[source]#

Serialize as {"elements": [...], "layout": {...}} wrapper.

Used by the CLI when --layout is non-default so the layout hint travels alongside the elements.

to_list() list[dict][source]#

Serialize to the flat list-of-dicts format Cytoscape.js expects.

class gxformat2.cytoscape.models.CytoscapeLayout(*, name: str)[source]#

Bases: BaseModel

Layout hint emitted on non-default layouts.

model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str#
class gxformat2.cytoscape.models.CytoscapeNode(*, group: Literal['nodes'] = 'nodes', data: CytoscapeNodeData, classes: list[str] = <factory>, position: CytoscapePosition | None = None)[source]#

Bases: BaseModel

A Cytoscape.js node element.

classes: list[str]#
data: CytoscapeNodeData#
group: Literal['nodes']#
model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

position: CytoscapePosition | None#
class gxformat2.cytoscape.models.CytoscapeNodeData(*, id: str, label: str, doc: str | None = None, tool_id: str | None = None, step_type: str = 'tool', repo_link: str | None = None)[source]#

Bases: BaseModel

Data payload for a Cytoscape node (input or step).

doc: str | None#
id: str#
label: str#
model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

step_type: str#
tool_id: str | None#
class gxformat2.cytoscape.models.CytoscapePosition(*, x: int = 0, y: int = 0)[source]#

Bases: BaseModel

Cytoscape node position (x/y coordinates).

model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

x: int#
y: int#

Module contents#

Cytoscape.js visualization for Galaxy workflows.

class gxformat2.cytoscape.CytoscapeEdge(*, group: Literal['edges'] = 'edges', data: CytoscapeEdgeData)[source]#

Bases: BaseModel

A Cytoscape.js edge element.

data: CytoscapeEdgeData#
group: Literal['edges']#
model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class gxformat2.cytoscape.CytoscapeEdgeData(*, id: str, source: str, target: str, input: str, output: str | None = None)[source]#

Bases: BaseModel

Data payload for a Cytoscape edge (step connection).

id: str#
input: str#
model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

output: str | None#
source: str#
target: str#
class gxformat2.cytoscape.CytoscapeElements(*, nodes: list[CytoscapeNode] = <factory>, edges: list[CytoscapeEdge] = <factory>, layout: CytoscapeLayout | None = None)[source]#

Bases: BaseModel

Complete set of Cytoscape.js elements for a workflow visualization.

edges: list[CytoscapeEdge]#
layout: CytoscapeLayout | None#
model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

nodes: list[CytoscapeNode]#
to_dict() dict[source]#

Serialize as {"elements": [...], "layout": {...}} wrapper.

Used by the CLI when --layout is non-default so the layout hint travels alongside the elements.

to_list() list[dict][source]#

Serialize to the flat list-of-dicts format Cytoscape.js expects.

class gxformat2.cytoscape.CytoscapeLayout(*, name: str)[source]#

Bases: BaseModel

Layout hint emitted on non-default layouts.

model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str#
class gxformat2.cytoscape.CytoscapeNode(*, group: Literal['nodes'] = 'nodes', data: CytoscapeNodeData, classes: list[str] = <factory>, position: CytoscapePosition | None = None)[source]#

Bases: BaseModel

A Cytoscape.js node element.

classes: list[str]#
data: CytoscapeNodeData#
group: Literal['nodes']#
model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

position: CytoscapePosition | None#
class gxformat2.cytoscape.CytoscapeNodeData(*, id: str, label: str, doc: str | None = None, tool_id: str | None = None, step_type: str = 'tool', repo_link: str | None = None)[source]#

Bases: BaseModel

Data payload for a Cytoscape node (input or step).

doc: str | None#
id: str#
label: str#
model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

step_type: str#
tool_id: str | None#
class gxformat2.cytoscape.CytoscapePosition(*, x: int = 0, y: int = 0)[source]#

Bases: BaseModel

Cytoscape node position (x/y coordinates).

model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

x: int#
y: int#
gxformat2.cytoscape.bakes_coordinates(layout: str) bool[source]#

Layouts that bake coordinates into data.position.

All other layouts are hint-only and rely on the runtime renderer.

gxformat2.cytoscape.cytoscape_elements(workflow: dict[str, Any] | str | Path | GalaxyWorkflow | NormalizedFormat2, *, layout: str = 'preset') CytoscapeElements[source]#

Build Cytoscape visualization elements from a Galaxy workflow.

Accepts anything normalized_format2() supports, plus an already normalized NormalizedFormat2 instance.

layout selects the placement strategy (default preset); see _layout.py and the cross-language spec for details.

gxformat2.cytoscape.is_layout_name(value: str) bool[source]#

Return True if value is one of the supported Cytoscape layout names.

gxformat2.cytoscape.main(argv=None)[source]#

Entry point for building Cytoscape visualizations of Galaxy workflows.

gxformat2.cytoscape.render_html(elements: CytoscapeElements, layout: str = 'preset') str[source]#

Return a standalone HTML page visualizing the workflow with Cytoscape.js.

The returned string is a complete HTML document suitable for writing to a file or embedding in a Jupyter notebook.

gxformat2.cytoscape.to_cytoscape(workflow_path: str, output_path=None, layout: str = 'preset')[source]#

Produce cytoscape output for supplied workflow path.

gxformat2.cytoscape.topological_positions(elements: CytoscapeElements) dict[str, CytoscapePosition][source]#

Compute positions per the topological layering spec.

Returns a mapping keyed by node data.id.