In [1]:
from cameo import load_model
model = load_model("iJR904")


Analyse the model

Analysis packages provide a way to analyse the model given the constraints.


In [2]:
from cameo.flux_analysis import analysis

In [3]:
help(analysis)


Help on module cameo.flux_analysis.analysis in cameo.flux_analysis:

NAME
    cameo.flux_analysis.analysis

FILE
    /Users/joao/Documents/repos/cameo/cameo/flux_analysis/analysis.py

DESCRIPTION
    # Copyright 2014 Novo Nordisk Foundation Center for Biosustainability, DTU.
    #
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #     http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.

FUNCTIONS
    fbid(model, knockouts, view=<cameo.parallel.SequentialView object>, method='fva')
        Flux balance impact degree by Zhao et al 2013
        
        :param model: wild-type model
        :param knockouts: list of reaction knockouts
        :param method: the method to compute the perturbation. default is "fva" - Flux Variability Analysis.
            It can also be computed with "em" - Elementary modes
        :return: perturbation
    
    flux_variability_analysis(model, reactions=None, fraction_of_optimum=0.0, remove_cycles=True, view=None)
        Flux variability analysis.
        
        Parameters
        ----------
        model: SolverBasedModel
        reactions: None or iterable
            The list of reaction whose lower and upper bounds should be determined.
            If `None`, all reactions in `model` will be assessed.
        view: SequentialView or MultiprocessingView or ipython.cluster.DirectView
            A parallelization view.
        
        Returns
        -------
        pandas.DataFrame
            Pandas DataFrame containing the results of the flux variability analysis.
    
    phenotypic_phase_plane(model, variables=[], objective=None, points=20, view=None)
        Phenotypic phase plane analysis.
        
        Parameters
        ----------
        model: SolverBasedModel
        variables: str or reaction or iterable
            A reaction ID, reaction, or list of reactions to be varied.
        objective: str or reaction or optlang.Objective
            An objective to be minimized/maximized for
        points: int or iterable
            Number of points to be interspersed between the variable bounds.
            A list of same same dimensions as `variables` can be used to specify
            variable specific numbers of points.
        view: SequentialView or MultiprocessingView or ipython.cluster.DirectView
            A parallelization view.
        
        Returns
        -------
        PhenotypicPhasePlaneResult
            The phenotypic phase plane.

DATA
    __all__ = ['flux_variability_analysis', 'phenotypic_phase_plane', 'fbi...


Flux Variability Analysis


In [4]:
analysis.flux_variability_analysis(model, reactions=[model.reactions.PGI, model.reactions.EX_glc_lp_e_rp_], 
                                   fraction_of_optimum=0.9)


Out[4]:
lower_bound upper_bound
EX_glc_lp_e_rp_ -10.000000 -9.036715
PGI -10.370635 9.855789

In [5]:
analysis.flux_variability_analysis(model, reactions=[model.reactions.PGI, model.reactions.EX_glc_lp_e_rp_], 
                                   fraction_of_optimum=0.5)


Out[5]:
lower_bound upper_bound
EX_glc_lp_e_rp_ -10.000000 -5.183575
PGI -25.388083 9.919883

Phenotpic Phase Plane


In [6]:
model.reactions.EX_o2_lp_e_rp_.lower_bound = -10
result = analysis.phenotypic_phase_plane(model, 
                                         variables=[model.reactions.BiomassEcoli],
                                         objective=model.reactions.EX_succ_lp_e_rp_,
                                         points=10)

In [12]:
result.plot(height=400)



In [8]:
result.data_frame


Out[8]:
BiomassEcoli objective_lower_bound objective_upper_bound
0 0.000000 0 1.714286e+01
1 0.068018 0 1.610254e+01
2 0.136037 0 1.482955e+01
3 0.204055 0 1.355656e+01
4 0.272074 0 1.228016e+01
5 0.340092 0 1.100302e+01
6 0.408111 0 9.725871e+00
7 0.476129 0 8.448724e+00
8 0.544148 0 5.501101e+00
9 0.612166 0 -2.684313e-13