|
78 | 78 | "model = cobra.io.load_model(\"iYS1720\")\n",
|
79 | 79 | "\n",
|
80 | 80 | "for metabolite in model.metabolites:\n",
|
81 |
| - " metabolite.id = \"test_\" + metabolite.id\n", |
| 81 | + " metabolite.id = f\"test_{metabolite.id}\"\n", |
82 | 82 | "\n",
|
83 | 83 | "try:\n",
|
84 | 84 | " model.metabolites.get_by_id(model.metabolites[0].id)\n",
|
|
289 | 289 | "cell_type": "markdown",
|
290 | 290 | "metadata": {},
|
291 | 291 | "source": [
|
292 |
| - "With optlang solvers, the LP formulation of a model is obtained by it's string representation. All solvers behave the same way." |
| 292 | + "With optlang solvers, the LP formulation of a model is obtained by its string representation. All solvers behave the same way." |
293 | 293 | ]
|
294 | 294 | },
|
295 | 295 | {
|
|
302 | 302 | " out.write(str(model.solver))"
|
303 | 303 | ]
|
304 | 304 | },
|
305 |
| - { |
306 |
| - "cell_type": "markdown", |
307 |
| - "metadata": {}, |
308 |
| - "source": [ |
309 |
| - "### For cobrapy's internal solvers" |
310 |
| - ] |
311 |
| - }, |
312 |
| - { |
313 |
| - "cell_type": "markdown", |
314 |
| - "metadata": {}, |
315 |
| - "source": [ |
316 |
| - "With the internal solvers, we first create the problem and use functions bundled with the solver. \n", |
317 |
| - "\n", |
318 |
| - "Please note that unlike the LP file format, the MPS file format does not specify objective direction and is always a minimization. Some (but not all) solvers will rewrite the maximization as a minimization." |
319 |
| - ] |
320 |
| - }, |
321 |
| - { |
322 |
| - "cell_type": "code", |
323 |
| - "execution_count": 8, |
324 |
| - "metadata": {}, |
325 |
| - "outputs": [], |
326 |
| - "source": [ |
327 |
| - "model = cobra.io.load_model(\"iYS1720\")\n", |
328 |
| - "\n", |
329 |
| - "# glpk through cglpk\n", |
330 |
| - "glpk = cobra.solvers.cglpk.create_problem(model)\n", |
331 |
| - "glpk.write(\"test.lp\")\n", |
332 |
| - "glpk.write(\"test.mps\") # will not rewrite objective\n", |
333 |
| - "# cplex\n", |
334 |
| - "cplex = cobra.solvers.cplex_solver.create_problem(model)\n", |
335 |
| - "cplex.write(\"test.lp\")\n", |
336 |
| - "cplex.write(\"test.mps\") # rewrites objective" |
337 |
| - ] |
338 |
| - }, |
339 | 305 | {
|
340 | 306 | "cell_type": "markdown",
|
341 | 307 | "metadata": {},
|
|
0 commit comments