{ "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": [ { "name": "stderr", "output_type": "stream", "text": [ "DEBUG:optlang.util:Gurobi python bindings found at /home/moritz/.virtualenvs/cobra/lib/python3.5/site-packages/gurobipy\n", "DEBUG:optlang.util:GLPK python bindings found at /home/moritz/.virtualenvs/cobra/lib/python3.5/site-packages/swiglpk\n", "DEBUG:optlang.util:Mosek python bindings not available.\n", "DEBUG:optlang.util:CPLEX python bindings found at /home/moritz/.virtualenvs/cobra/lib/python3.5/site-packages/cplex\n", "DEBUG:optlang.util:Scipy solver not available\n", "DEBUG:pip._internal.utils.misc:lzma module is not available\n", "DEBUG:pip._internal.vcs:Registered VCS backend: git\n", "DEBUG:pip._internal.vcs:Registered VCS backend: hg\n", "DEBUG:pip._internal.vcs:Registered VCS backend: svn\n", "DEBUG:pip._internal.vcs:Registered VCS backend: bzr\n" ] } ], "source": [ "from cobra.test import create_test_model" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "from cobra.flux_analysis import single_gene_deletion" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "model = create_test_model(\"textbook\")" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "genes = ['b0008', 'b0114', 'b2276', 'b1779']" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "model.solver = \"cplex\"" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "logging.getLogger().setLevel(logging.DEBUG)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 308 ms, sys: 0 ns, total: 308 ms\n", "Wall time: 307 ms\n" ] }, { "data": { "text/html": [ "
\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", "
growthstatus
ids
(b1779)5.034815e+00optimal
(b2276)5.475871e+00optimal
(b0114)1.224159e+00optimal
(b0008)3.028591e-15optimal
\n", "
" ], "text/plain": [ " growth status\n", "ids \n", "(b1779) 5.034815e+00 optimal\n", "(b2276) 5.475871e+00 optimal\n", "(b0114) 1.224159e+00 optimal\n", "(b0008) 3.028591e-15 optimal" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%time single_gene_deletion(model, method=\"linear room\", gene_list=genes, processes=1)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "model.solver = \"gurobi\"" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 271 ms, sys: 0 ns, total: 271 ms\n", "Wall time: 265 ms\n" ] }, { "data": { "text/html": [ "
\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", "
growthstatus
ids
(b1779)5.034815optimal
(b2276)5.475871optimal
(b0114)1.224159optimal
(b0008)0.000000optimal
\n", "
" ], "text/plain": [ " growth status\n", "ids \n", "(b1779) 5.034815 optimal\n", "(b2276) 5.475871 optimal\n", "(b0114) 1.224159 optimal\n", "(b0008) 0.000000 optimal" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%time single_gene_deletion(model, method=\"linear room\", gene_list=genes, processes=1)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "model.solver = \"glpk\"" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "model.solver.configuration.timeout = 20" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "DEBUG:optlang.glpk_interface:Status undefined. GLPK status code returned by glp_simplex was 1\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 205 ms, sys: 4.99 ms, total: 210 ms\n", "Wall time: 203 ms\n" ] }, { "data": { "text/html": [ "
\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", "
growthstatus
ids
(b1779)5.034815e+00optimal
(b2276)5.475871e+00optimal
(b0114)1.224159e+00optimal
(b0008)-5.857507e-17optimal
\n", "
" ], "text/plain": [ " growth status\n", "ids \n", "(b1779) 5.034815e+00 optimal\n", "(b2276) 5.475871e+00 optimal\n", "(b0114) 1.224159e+00 optimal\n", "(b0008) -5.857507e-17 optimal" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%time single_gene_deletion(model, method=\"linear room\", gene_list=genes, processes=1)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.5.5" } }, "nbformat": 4, "nbformat_minor": 2 }