In [1]:
import cobra
from cobra.io import read_sbml_model
from cobra.test import create_test_model
from cobra import Model
In [2]:
cobra.__path__
Out[2]:
In [3]:
cobra.__version__
Out[3]:
In [4]:
benchmark_results = {}
In [5]:
m = create_test_model('ecoli')
In [17]:
m.solver = 'glpk'
In [18]:
%%timeit -o
m2 = Model()
for r in m.reactions:
m2.add_reaction(r)
Out[18]:
In [19]:
benchmark_results['add_reaction'] = _
In [20]:
%%timeit -o
m2 = Model()
m2.add_reactions(m.reactions)
Out[20]:
In [19]:
benchmark_results['add_reactions'] = _
In [27]:
%%timeit -o
model = read_sbml_model("/Users/niso/Dev/cobrapy-fork/cobra/test/data/iJO1366.xml")
for reaction in model.reactions:
model.remove_reactions([reaction])
Out[27]:
In [28]:
benchmark_results['remove_reaction'] = _
In [29]:
%%timeit -o
model = read_sbml_model("/Users/niso/Dev/cobrapy-fork/cobra/test/data/iJO1366.xml")
model.remove_reactions(model.reactions)
Out[29]:
In [28]:
benchmark_results['remove_reactions'] = _
In [ ]:
%%timeit -o
model = read_sbml_model("/Users/niso/Dev/cobrapy-fork/cobra/test/data/iJO1366.xml")
In [23]:
model = read_sbml_model("/Users/niso/Dev/cobrapy-fork/cobra/test/data/iJO1366.xml")
In [24]:
%%timeit -o
for reaction in model.reactions:
model.objective = reaction
solution = model.solve()
solution.f
Out[24]:
In [25]:
benchmark_results['iteratete_all_reactions_set_objective_solve'] = _
In [13]:
%%timeit -o
model.copy()
Out[13]:
In [14]:
benchmark_results['model_copy'] = _
In [ ]: