7.1.1.4.1.4. cobramod.visualization.force_graph

Added in version 1.3.0.

This module contains the logic to create a three-dimensional representation from a cobra.core.Group or a cobra.Reaction using 3d-force-graph .

7.1.1.4.1.4.1. Classes

Nodes

Links

GraphData

ForceGraphIntegration

Added in version 1.3.0.

7.1.1.4.1.4.2. Module Contents

class cobramod.visualization.force_graph.Nodes
id: str
group: Literal['metabolite', 'reaction']
to_json()
Return type:

str

Parameters:
value: float
property source: str
Return type:

str

property target: str
Return type:

str

to_json()
Return type:

str

class cobramod.visualization.force_graph.GraphData
nodes: set[Nodes]
to_json()
Return type:

str

to_dict()
Return type:

dict

class cobramod.visualization.force_graph.ForceGraphIntegration

Bases: anywidget.AnyWidget

Added in version 1.3.0.

Widget for displaying a cobra.core.group.Group or cobra.Reaction as a force directed graph.

property model: Type[cobra.core.Group] | Type[cobra.Reaction] | None

The Model to be represented. It can ether be a cobra.core.group.Group or cobra.Reaction. It is set to None upon initialization.

Return type:

Optional[Union[Type[cobra.core.Group], Type[cobra.Reaction]]]

property solution: Type[cobra.Solution] | dict[str, float] | None

The flux values to be taken into account when creating the graph. These scale the stoichiometry of the respective reaction. If a reaction is not found in this object, a flux of 1 is assumed. The flux values can either be passed as cobra.Solution or as dict, where the key is the reaction ID and the value is the flux value. It is set to None upon initialization.

Return type:

Optional[Union[Type[cobra.Solution], dict[str, float]]]

save_layout(file)

Method to save the layout of the current display. The resulting file is a CSV containing the ID of the metabolite and its X, Y and Z position in the other columns.

Parameters:

file (Union[str, pathlib.Path]) – The path where the layout is to be saved.

load_layout(file)

Method to restore the layout that was saved using save_layout().

Parameters:

file (Union[str, pathlib.Path]) – Path to the file containing the saved layout.