{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import logging" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "logging.basicConfig(level=\"DEBUG\")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "from cobra.io import load_model" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "from cobra.flux_analysis import geometric_fba" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:cobra.core.model:The current solver interface glpk doesn't support setting the optimality tolerance.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Scaling...\n", " A: min|aij| = 1.000e+00 max|aij| = 1.000e+00 ratio = 1.000e+00\n", "Problem data seem to be well scaled\n" ] } ], "source": [ "model = load_model(\"textbook\")" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "model.solver = \"cplex\"" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "logging.getLogger().setLevel(logging.DEBUG)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "DEBUG:cobra.flux_analysis.geometric:Iteration: 1; delta: 4e-13; status: optimal.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 481 ms, sys: 0 ns, total: 481 ms\n", "Wall time: 480 ms\n" ] }, { "data": { "text/html": [ "Optimal solution with objective value 0.000
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
fluxesreduced_costs
ACALD0.0000000.0
ACALDt0.0000000.0
ACKr0.0000000.0
ACONTa6.0072500.0
ACONTb6.0072500.0
.........
TALA1.4969840.0
THD20.0000000.0
TKT11.4969840.0
TKT21.1814980.0
TPI7.4773820.0
\n", "

95 rows × 2 columns

\n", "
" ], "text/plain": [ "" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%time geometric_fba(model)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "model.solver = \"gurobi\"" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "DEBUG:cobra.flux_analysis.geometric:Iteration: 1; delta: 6.47e-12; status: optimal.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 504 ms, sys: 2.91 ms, total: 507 ms\n", "Wall time: 505 ms\n" ] }, { "data": { "text/html": [ "Optimal solution with objective value 0.000
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
fluxesreduced_costs
ACALD0.0000000.000000e+00
ACALDt0.0000000.000000e+00
ACKr0.0000000.000000e+00
ACONTa6.0072500.000000e+00
ACONTb6.0072500.000000e+00
.........
TALA1.4969842.220446e-16
THD20.0000002.220446e-16
TKT11.4969840.000000e+00
TKT21.181498-1.110223e-16
TPI7.4773820.000000e+00
\n", "

95 rows × 2 columns

\n", "
" ], "text/plain": [ "" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%time geometric_fba(model)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "model.solver = \"glpk\"" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "DEBUG:optlang.glpk_interface:Status undefined. GLPK status code returned by glp_simplex was 1\n", "DEBUG:cobra.flux_analysis.geometric:Iteration: 1; delta: 2.96e-13; status: optimal.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 263 ms, sys: 3.46 ms, total: 267 ms\n", "Wall time: 263 ms\n" ] }, { "data": { "text/html": [ "Optimal solution with objective value -0.000
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
fluxesreduced_costs
ACALD1.495879e-142.914335e-16
ACALDt1.495879e-140.000000e+00
ACKr1.554312e-151.110223e-16
ACONTa6.007250e+000.000000e+00
ACONTb6.007250e+000.000000e+00
.........
TALA1.496984e+00-1.665335e-15
THD25.789919e-140.000000e+00
TKT11.496984e+001.665335e-16
TKT21.181498e+00-2.220446e-16
TPI7.477382e+000.000000e+00
\n", "

95 rows × 2 columns

\n", "
" ], "text/plain": [ "" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%time geometric_fba(model)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.1" } }, "nbformat": 4, "nbformat_minor": 2 }