micom.solution

A community solution object.

Attributes

good

Solver states that permit returning the solution.

DIRECTION

Classes

CommunitySolution

An FBA solution for an entire community.

Functions

_group_taxa(values, ids, taxa[, what])

Format a list of values by id and taxa.

add_pfba_objective(community[, atol, rtol])

Add pFBA objective.

solve(community[, fluxes, pfba, raise_error, atol, rtol])

Get all fluxes stratified by taxa.

reset_solver(community)

Reset the solver.

optimize_with_retry(com[, message])

Try to reset the solver.

crossover(community, sol[, fluxes])

Get the crossover solution.

optimize_with_fraction(com, fraction[, growth_rate, ...])

Optimize with a constrained community growth rate.

Module Contents

micom.solution.good[source]

Solver states that permit returning the solution.

micom.solution.DIRECTION[source]
micom.solution._group_taxa(values, ids, taxa, what='reaction')[source]

Format a list of values by id and taxa.

class micom.solution.CommunitySolution(community, slim=False, reactions=None, metabolites=None)[source]

Bases: cobra.core.Solution

An FBA solution for an entire community.

objective_value

The (optimal) value for the objective function.

Type:

float

members[source]

Contains basic info about the individual compartments/members of the community such as id, abundance and growth rates. Will also include one row for the external medium (without abundance and growth rate).

Type:

pandas.Series

growth_rate[source]

The overall growth rate for the community normalized to 1 gDW.

Type:

float

status

The solver status related to the solution.

Type:

str

strategy[source]

The optimization strategy used to obtain the solution (may be empty).

Type:

str

fluxes

Contains the reaction fluxes (primal values of variables) stratified by compartment. Columns denote individual fluxes and rows denote compartments: one for every taxon plus one for the external medium. Fluxes will be NA if the reaction does not exist in the organism.

Type:

pandas.DataFrame

reduced_costs

Contains reaction reduced costs (dual values of variables) stratified by taxa. Columns denote individual fluxes and rows denote taxa. Reduced costs will be NA if the reaction does not exist in the organism.

Type:

pandas.Series

shadow_prices

Contains metabolite shadow prices (dual values of constraints) stratified by taxa. Columns denote individual metabolites and rows denote taxa. Shadow prices will be NA if the metabolite does not exist in the organism.

Type:

pandas.Series

rids[source]
mids[source]
gcs[source]
strategy[source]
members[source]
name = 'compartments'[source]
growth_rate[source]
_repr_html_()[source]

Return a rich HTML representation of the solution.

__repr__()[source]

Convert CommunitySolution instance to string representation.

micom.solution.add_pfba_objective(community, atol=1e-06, rtol=1e-06)[source]

Add pFBA objective.

Add objective to minimize the summed flux of all reactions to the current objective. This one will work with any objective (even non-linear ones).

See also

pfba

Parameters:

community (micom.Community) – The community to add the objective to.

micom.solution.solve(community, fluxes=True, pfba=True, raise_error=False, atol=1e-06, rtol=1e-06)[source]

Get all fluxes stratified by taxa.

micom.solution.reset_solver(community)[source]

Reset the solver.

micom.solution.optimize_with_retry(com, message='could not get optimum.')[source]

Try to reset the solver.

micom.solution.crossover(community, sol, fluxes=False)[source]

Get the crossover solution.

micom.solution.optimize_with_fraction(com, fraction, growth_rate=None, fluxes=False)[source]

Optimize with a constrained community growth rate.