cobramod.visualization.force_graph ================================== .. py:module:: cobramod.visualization.force_graph .. autoapi-nested-parse:: .. versionadded:: 1.3.0 This module contains the logic to create a three-dimensional representation from a :py:class:`cobra.core.Group` or a :py:class:`cobra.Reaction` using `3d-force-graph `_ . Classes ------- .. autoapisummary:: cobramod.visualization.force_graph.Nodes cobramod.visualization.force_graph.Links cobramod.visualization.force_graph.GraphData cobramod.visualization.force_graph.ForceGraphIntegration Module Contents --------------- .. py:class:: Nodes .. py:attribute:: id :type: str .. py:attribute:: group :type: Literal['metabolite', 'reaction'] .. py:method:: to_json() .. py:class:: Links(source, target, value) .. py:attribute:: value :type: float .. py:property:: source :type: str .. py:property:: target :type: str .. py:method:: to_json() .. py:class:: GraphData .. py:attribute:: nodes :type: set[Nodes] .. py:attribute:: links :type: set[Links] .. py:method:: to_json() .. py:method:: to_dict() .. py:class:: ForceGraphIntegration Bases: :py:obj:`anywidget.AnyWidget` .. versionadded:: 1.3.0 Widget for displaying a :py:class:`cobra.core.group.Group` or :py:class:`cobra.Reaction` as a force directed graph. .. py:property:: model :type: Optional[Union[Type[cobra.core.Group], Type[cobra.Reaction]]] The Model to be represented. It can ether be a :py:class:`cobra.core.group.Group` or :py:class:`cobra.Reaction`. It is set to None upon initialization. .. py:property:: solution :type: Optional[Union[Type[cobra.Solution], dict[str, float]]] 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. .. py:method:: 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. :param file: The path where the layout is to be saved. .. py:method:: load_layout(file) Method to restore the layout that was saved using :py:meth:`~cobramod.visualization.force_graph.ForceGraphIntegration.save_layout`. :param file: Path to the file containing the saved layout.