6.1.1.5.1.3. pytfa.redgem.network_expansion

Model class

6.1.1.5.1.3.1. Module Contents

6.1.1.5.1.3.1.1. Classes

NetworkExpansion

class redgem.NetworkExpansion(gem, core_subsystems, extracellular_system, cofactors, small_metabolites, inorganics, d, n)
extract_subsystem_reactions(self, subsystem)

Extracts all reactions of a subsystem and stores them and their id in the corresponding dictionary.

Parameters

subsystem – Name of the subsystem

Returns

Extracted reactions

extract_subsystem_metabolites(self, subsystem)

Extracts all metabolites of a subsystem and stores them and their id in the corresponding dictionary.

Parameters

subsystem – Name of the subsystem

Returns

Extracted metabolites

create_new_stoichiometric_matrix(self)

Extracts the new graph without the small metabolites, inorganics and cofactor pairs.

Returns

Networkx graph of the new network

breadth_search_subsystems_paths_length_d(self, subsystem_i, subsystem_j, d)

Breadth first search from each metabolite in subsystem i with special stop conditions during exploration for paths of length d.

This function explores the graph through allowed paths only : this path can’t go through subsystem i or j but must start in i and end in j. The length of each path found is d.

Parameters
  • subsystem_i – Source subsystem

  • subsystem_j – Destination subsystem

  • d – Path length desired

Returns

None

is_node_allowed(self, node, i, explored, subsystem_i, subsystem_j, d)

Checks whether or not a metabolite is allowed for the current path.

The new node is added if it is not already explored, if it is not in the source subsystem, and if it is not in the destination subsystem, except if it is the last round of exploration

Parameters
  • node – Metabolite id

  • i – Current step

  • explored – Explored node for this path

  • subsystem_i – Source subsystem

  • subsystem_j – Destination subsystem

  • d – Path length desired

Returns

Boolean answering the question

retrieve_all_paths(self, dest_node, src_node, ancestors, init_dict=True)

Retrieves all paths between a source metabolite and a destination metabolite after a breadth first search.

This function is a recursive function, which makes use of dynamic programming to reduce its complexity. It uses self._path_dict to store already computed data.

Parameters
  • dest_node – Destination metabolite

  • src_node – Source metabolite

  • ancestors – Dictionary with ancestors found during the search

  • init_dict – Boolean, for function initialisation

Returns

A list of all paths as tuples

retrieve_intermediate_metabolites_and_reactions(self, paths, subsystem_i, subsystem_j, d)

Retrieves and stores intermediate metabolites and reactions (i.e. M_{i,j}, R_{i,j}, M_{i,i} and R_{i,i}).

This function adds all reactions contained in these paths, and all metabolites between

Parameters
  • paths – List of paths between subsystems

  • subsystem_i – Source subsystem

  • subsystem_j – Destination subsystem

  • d – Path length

Returns

None

find_min_distance_between_subsystems(self)

Find minimal distance between each subsystems in both directions

Returns

Dict with distances

breadth_search_extracellular_system_paths(self, subsystem, n)

Breadth first search from each metabolite in the extracellular system with special stop conditions during exploration for paths of length n.

This function explores the graph through allowed paths only : this path can’t go through the extracellular system or the subsystem but must start in the extracellular system and end in the subsystem. The length of each path found is n.

Parameters
  • subsystem – Destination subsystem

  • n – Path length desired

Returns

None

is_node_allowed_extracellular(self, node, i, explored, subsystem, n)

Checks whether or not a metabolite is allowed for the current path.

The new node is added if it is not already explored, if it is not in the extracellular system, and if it is not in the destination subsystem except if it is the last round of exploration

Parameters
  • node – Metabolite id

  • i – Current step

  • explored – Explored node for this path

  • subsystem – Destination subsystem

  • n – Path length desired

Returns

Boolean answering the question

retrieve_intermediate_extracellular_metabolites_and_reactions(self, paths, subsystem, n)

Retrieves and stores intermediate metabolites and reactions for the extracellular system

This function adds all reactions contained in these paths, and all metabolites between

Parameters
  • paths – List of paths

  • subsystem – Destination subsystem

  • n – Path length

Returns

None

run_between_all_subsystems(self)

Retrieve subsystem and intermediate reactions and metabolites.

Returns

None

run_extracellular_system(self)

Retrieve intermediate reactions and metabolites for the extracellular system

Returns

None

extract_sub_network(self)

Extracts the reduced gem.

Returns

None

run(self)

Runs RedGEM.

Returns

None