In [1]:
import logging

In [2]:
logging.basicConfig(level="DEBUG")

In [3]:
from cobra.test import create_test_model


DEBUG:optlang.util:Gurobi python bindings found at /home/moritz/.virtualenvs/cobra/lib/python3.5/site-packages/gurobipy
DEBUG:optlang.util:GLPK python bindings found at /home/moritz/.virtualenvs/cobra/lib/python3.5/site-packages/swiglpk
DEBUG:optlang.util:Mosek python bindings not available.
DEBUG:optlang.util:CPLEX python bindings found at /home/moritz/.virtualenvs/cobra/lib/python3.5/site-packages/cplex
DEBUG:optlang.util:Scipy solver not available
DEBUG:pip._internal.utils.misc:lzma module is not available
DEBUG:pip._internal.vcs:Registered VCS backend: git
DEBUG:pip._internal.vcs:Registered VCS backend: hg
DEBUG:pip._internal.vcs:Registered VCS backend: svn
DEBUG:pip._internal.vcs:Registered VCS backend: bzr

In [4]:
from cobra.flux_analysis import single_gene_deletion

In [5]:
model = create_test_model("textbook")

In [6]:
genes = ['b0008', 'b0114', 'b2276', 'b1779']

In [7]:
model.solver = "cplex"

In [8]:
logging.getLogger().setLevel(logging.DEBUG)

In [9]:
%time single_gene_deletion(model, method="room", gene_list=genes, processes=1)


WARNING:root:Warning:  No solution found from 6 MIP starts.

CPU times: user 21.4 s, sys: 84.2 ms, total: 21.5 s
Wall time: 3.23 s
Out[9]:
growth status
ids
(b1779) 45.0 optimal
(b0008) 0.0 optimal
(b0114) 27.0 optimal
(b2276) 46.0 optimal

In [10]:
model.solver = "gurobi"

In [11]:
%time single_gene_deletion(model, method="room", gene_list=genes, processes=1)


CPU times: user 1.97 s, sys: 4.23 ms, total: 1.98 s
Wall time: 1.97 s
Out[11]:
growth status
ids
(b1779) 45.0 optimal
(b0008) 0.0 optimal
(b0114) 27.0 optimal
(b2276) 46.0 optimal

In [13]:
model.solver = "glpk"

In [14]:
model.solver.configuration.timeout = 20

In [15]:
%time single_gene_deletion(model, method="room", gene_list=genes, processes=1)


DEBUG:optlang.glpk_interface:Status undefined. GLPK status code returned by glp_simplex was 1
CPU times: user 1min 21s, sys: 53.1 ms, total: 1min 21s
Wall time: 1min 21s
Out[15]:
growth status
ids
(b1779) 45.0 optimal
(b0008) 0.0 optimal
(b0114) NaN time_limit
(b2276) NaN time_limit