# 2.1.1.2. wc_analysis.model package¶

## 2.1.1.2.2. wc_analysis.model.fba module¶

Analyze FBA model

Author

Arthur Goldberg <athur.p.goldberg@mssm.edu>

Author

Jonathan Karr <karr@mssm.edu>

Date

2018-11-26

2018, Karr Lab

MIT

class wc_analysis.model.fba.FbaModelAnalysis(model, knowledge_base=None, out_path=None, options=None)[source]

Statically analyze an FBA submodel

• Find reaction gaps

submodel[source]

dFBA submodel

Type

wc_lang.Submodel

get_dead_end_species(submodel, inactive_reactions)[source]

Find the dead end species in a reaction network

Given a set of inactive reactions in submodel, determine species that are not consumed by any reaction, or are not produced by any reaction. Costs $$O(n*p)$$, where $$n$$ is the number of reactions in submodel and $$p$$ is the maximum number of participants in a reaction.

Parameters
• submodel (wc_lang.Submodel) – dFBA submodel

• inactive_reactions (set of wc_lang.Reaction) – the inactive reactions in submodel

Returns

• set of wc_lang.Species: the species that are not consumed

• set of wc_lang.Species: the species that are not produced

Return type

tuple

get_digraph(submodel)[source]

Create a NetworkX network representing the reaction network in submodel

To leverage the algorithms in NetworkX, map a reaction network on to a NetworkX directed graph. The digraph is bipartite, with Reaction and Species nodes. A reaction is represented a Reaction node, with an edge from each reactant Species node to the Reaction node, and an edge from the Reaction node to each product Species node.

Parameters

submodel (wc_lang.Submodel) – dFBA submodel

Returns

a NetworkX directed graph representing submodel’s reaction network

Return type

networkx.DiGraph

get_inactive_rxns(submodel, dead_end_species)[source]

Find the inactive reactions in a reaction network

Given the dead end species in a reaction network, find the reactions that must eventually become inactive. Reactions that consume species which are not produced must become inactive. And reactions that produce species which are not consumed must become inactive to prevent the copy numbers of those species from growing without bound. Costs $$O(n*p)$$, where $$n$$ is the number of reactions in submodel and $$p$$ is the maximum number of participants in a reaction.

Parameters
• submodel (wc_lang.Submodel) – dFBA submodel

• dead_end_species (tuple) –

• set of wc_lang.Species: the Species that are not consumed by any Reaction in submodel

• set of wc_lang.Species: the Species that are not produced by any Reaction in submodel

Returns

the inactive reactions in submodel’s reaction network

Return type

set of wc_lang.Reaction

get_rxn_gaps(submodel)[source]

Identify gaps in a dFBA submodel’s reaction network

Species that are not consumed or not produced indicate gaps in the reaction network. These can be found by a static analysis of the model. Reactions that use species that are not produced or produce species that are not consumed must eventually have zero flux. A reaction network can be reduced to a minimal network of reactions that can all have positive fluxes.

Algorithm:

all_gap_species = get_gap_species([])
delta_gap_species = all_gap_species
while delta_gap_species:
all_gap_reactions = get_gap_reactions(all_gap_species)
tmp_gap_species = all_gap_species
all_gap_species = get_gap_species(all_gap_reactions)
delta_gap_species = all_gap_species - tmp_gap_species
return (all_gap_species, all_gap_reactions)

Parameters

submodel (wc_lang.Submodel) – dFBA submodel

Returns

wc_lang.Species not in the minimal reaction network * set of wc_lang.Reaction: wc_lang.Reactions not in the minimal reaction network

Return type

• set of wc_lang.Species

path_bounds_analysis(submodel)[source]

Perform path bounds analysis on submodel

To be adequately constrained, a dFBA metabolic model should have the property that each path from an extracellular species to a component in the objective function contains at least one reaction constrained by a finite flux upper bound.

Analyze the reaction network in submodel and return all paths from extracellular species to objective function components that lack a finite flux upper bound.

Parameters

submodel (wc_lang.Submodel) – dFBA submodel

Returns

paths from extracellular species to objective function components that lack a finite flux upper bound. Keys in the dict are the ids of extracellular species; the corresponding values contain the unbounded paths for the extracellular species, as returned by unbounded_paths.

Return type

dict of list of list of object

run(model, knowledge_base=None, out_path=None, options=None)[source]
Parameters
• model (wc_lang.Model) – model

• knowledge_base (wc_kb.KnowledgeBase, optional) – knowledge base

• out_path (str, optional) – path to save analyses

• options (dict, optional) – options

unbounded_paths(rxn_network, ex_species, obj_fn_species, min_non_finite_ub=1000.0)[source]

Find the unbounded paths from an extracellular species to some objective function species

Return all paths in a reaction network that lack a finite flux upper bound and go from ex_species to an objective function component.

Parameters
• rxn_network (networkx.DiGraph) – a NetworkX directed graph representing a reaction network, created by get_digraph

• ex_species (wc_lang.Species) – an extracellular Species that is a node in rxn_network

• obj_fn_species (list of wc_lang.Species) – objective function Species that are also nodes in rxn_network

• finite_upper_bound_limit (float, optional) – the maximum value of a finite flux upper bound

• min_non_finite_ub (float, optional) – flux upper bounds less than min_non_finite_ub are considered finite

Returns

a list of the reaction paths from ex_species to objective function components that lack a finite flux upper bound. A path is a list of Species, Reaction, Species, …, Species, starting with ex_species and ending with an objective function component.

Return type

list of list of object

Raises

ValueError – if ex_species is not an instance of wc_lang.Species or obj_fn_species is not a list of instances of wc_lang.Species