5.1.1.1.5. cobramod.core.pathway

COBRApy Group-child class extension

The new class cobramod.pathway.Pathway" is child derived from :class:`cobra.core.group.Group. It extends some functionalities such as:

  • solution: Obtain the solution for the specific members.

  • visualize: get a escher.Builder for that specific Pathway.

5.1.1.1.5.1. Module Contents

5.1.1.1.5.1.1. Classes

Pathway

A Sub-class from the original COBRApy cobra.Group, which inherits

5.1.1.1.5.1.2. Functions

model_convert(model: cobra.core.model.Model)

Converts all Group objects in the given model to proper cobramod

class cobramod.core.pathway.Pathway(id: str, name: str = '', members: cobra.core.dictlist.DictList = DictList(), kind: str = None)

Bases: cobra.core.group.Group

A Sub-class from the original COBRApy cobra.Group, which inherits all attributes and adds the method solution, to get a Solution for the members of this Class.

Attributes
vertical (bool, optional):

Variable that determines whether the display should be vertical or horizontal using Escher. Defaults to False.

color_negative (str or list of int, optional) :

The color to use as the endpoint for the negative fluxes during the creation of the color gradient. All colors of the CSS standard can be used here or their RGB representation.

color_positive (str or list of int, optional) :

The color to use as the endpoint for the positive fluxes during the creation of the color gradient. All colors of the CSS standard can be used here or their RGB representation.

color_min_max (list of float, optional) :

The maximum and minimum to be taken into account when creating the color gradient. This creates these two values artificially to allow the creation of a data-independent color gradient. Fluxes larger or smaller are ignored accordingly.

color_quantile (bool, optional) :

Attribute that defines whether the color gradient should be determined through quantiles or equally distributed between the maximum and the minimum. Defaults to False which means that the gradations are evenly distributed.

color_n_steps (int, optional) :

The number of steps used when creating the color gradient. Uses the number of fluxes by default. The default value is None.

color_max_steps (int, optional) :

The maximum number of steps to use when creating the color gradient. Default value is 100.

See also

Color names according to the css standard: https://www.w3schools.com/cssref/css_colors.asp

add_members(self, new_members: List[cobra.core.reaction.Reaction])

Add given list of cobra.core.reaction.Reaction into the Pathway.

Parameters

new_members (list) – List of Reactions to add to the class.

Raises

TypeError – If not all members are proper Reaction objects.

solution(self, solution: cobra.core.solution.Solution) cobra.core.solution.Solution

Returns a cobra.Solution with only the members of the pathway.

Parameters

solution (Solution) – Original COBRApy cobra.Solution to filter.

Returns

Filtered solution containing only members of the Pathway

class.

Return type

Solution

modify_graph(self, reaction: str, next_reaction: Union[str, None])

Modifies the order of the graph. This is useful when merging multiple pathways or joining reactions. In the graph, the selected reaction will be forced to show “next_reaction” as its successor.

Parameters
  • reaction (str) – Identifier of the reaction to modify in the graph.

  • next_reaction (str, None) – Identifier of the next reaction. This reaction will take place after “reaction”. If None is passed, then “reaction” will not have successors.

Raises
  • GraphKeyError – If the reaction or the next_reaction does not appear

  • in the graph of the pathway.

visualize(self, solution_fluxes: Union[cobra.core.solution.Solution, Dict[str, float]] = None, filename: pathlib.Path = None) escher.Builder

Returns a escher.Builder, which can be used to create visual representations of the pathway.

Parameters
  • solution_fluxes (Solution, dict) – Series or Dictionary with fluxes. The values will be then showed in the Builder. Defaults to None.

  • filename (Path) – Path for the HTML. Defaults to “pathway.html” in the current working directory.

cobramod.core.pathway.model_convert(model: cobra.core.model.Model)

Converts all Group objects in the given model to proper cobramod cobramod.pathway.Pathway