cameo.network_analysis package

Submodules

cameo.network_analysis.networkx_based module

cameo.network_analysis.networkx_based.model_to_network(model, *args, **kwargs)[source]

Convert a model into a networkx graph.

Calls reactions_to_network with model.reactions.

Parameters

model (cobra.Model) – The model.

Returns

Return type

networkx.MultiDiGraph

cameo.network_analysis.networkx_based.reactions_to_network(reactions, max_distance=0.3)[source]

Convert a list of reactions into a networkx graph.

Parameters
  • reactions (list) – The list of reactions.

  • max_distance (float, optional) – A threshold on the normalized distance between two compounds. If distance is above this threshold, no edge between those compounds will be created.

Returns

Return type

networkx.MultiDiGraph

See also

distance_based_on_molecular_formula

cameo.network_analysis.networkx_based.remove_highly_connected_nodes(network, max_degree=10, ignore=[])[source]

Remove highly connected nodes (changes network in place).

Parameters
  • network (networkx graph) –

  • max_degree (int (default 10)) – Remove nodes with degree > max_degree

  • ignore (list) – List of nodes to ignore.

Returns

Return type

None

cameo.network_analysis.util module

cameo.network_analysis.util.distance_based_on_molecular_formula(metabolite1, metabolite2, normalize=True)[source]

Calculate the distance of two metabolites bases on the molecular formula

Parameters
  • metabolite1 (Metabolite) – The first metabolite.

  • metabolite2 (Metabolite) – The second metabolite.

  • normalize (bool, optional) – If the distance should be normalized by the total number of elements in both metabolites (defaults to True).

Returns

The distance between metabolite1 and metabolite2.

Return type

float

Module contents