cameo vs. cobrapy¶
Importing a model¶
cobrapy (load a model in SBML format):
from cobra.io import read_sbml_model
model = read_sbml_model('path/to/model.xml')
cameo (load models from different formats):
from cameo import load_model
# read SBML model
model = load_model('path/to/model.xml')
# ... or read a pickled model
model = load_model('path/to/model.pickle')
# ... or just import a model by ID from http://darwin.di.uminho.pt/models
iAF1260 = load_model('iAF1260')
Solving models¶
cobrapy:
solution = model.optimize()
if solution.status == 'optimal':
# proceed
try:
solution = model.solve()
except cameo.exceptions.SolverError:
print "A non-optimal solution was returned by the solver"
else:
# proceed
It is important to note that cameo models maintain optimize to maintain compatibility with cobrapy but we discourage its use.