{ "cells": [ { "cell_type": "markdown", "id": "f2d7b3c9", "metadata": {}, "source": [ "# COBRApy: Constraint-based metabolic modeling in Python\n", "\n", "
\n", "\"COBRApy\n", "
\n", "\n", "[**COBRApy**](https://cobrapy.readthedocs.io/en/latest/) is a python package for large-scale analysis of metabolic systems. It offers tools for frequently used COBRA procedures, including flux balance assessment, flux variability studies, and gene removal evaluations." ] }, { "cell_type": "code", "execution_count": 1, "id": "a1684e94", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " \n", " \n", " \n", "
\n", " \n", " \n", " \n", " \n", "
Installed version:v0.9.2-beta.1 (latest: v0.9.1-alpha.3)
Available backends:CVXPY v1.3.2, PICOS v2.4.17
Default backend (corneto.K):CVXPY
Installed solvers:CBC, CLARABEL, COPT, CPLEX, CVXOPT, DIFFCP, ECOS, ECOS_BB, GLPK, GLPK_MI, GUROBI, MOSEK, OSQP, PROXQP, SCIP, SCIPY, SCS
Graphviz version:v0.20.1
Repository:https://github.com/saezlab/corneto
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import corneto as cn\n", "\n", "cn.info()" ] }, { "cell_type": "markdown", "id": "ef4a003b", "metadata": {}, "source": [ "Genome scale metabolic networks can be customized with COBRApy, and imported to CORNETO for more advanced analysis that require modified versions of methods implemented in the package." ] }, { "cell_type": "code", "execution_count": 2, "id": "f186d84b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Set parameter Username\n", "Academic license - for non-commercial use only - expires 2023-11-09\n" ] }, { "data": { "text/plain": [ "(72, 95)" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from cobra.io import load_model\n", "\n", "model = load_model(\"textbook\")\n", "len(model.metabolites), len(model.reactions)" ] }, { "cell_type": "code", "execution_count": 3, "id": "ce7a1ba5", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(72, 95)" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "G = cn.Graph.from_cobra_model(model)\n", "G.shape" ] }, { "cell_type": "code", "execution_count": 7, "id": "8807da24", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "((frozenset({'acald_c', 'coa_c', 'nad_c'}),\n", " frozenset({'accoa_c', 'h_c', 'nadh_c'})),\n", " {'__edge_type': 'directed',\n", " 'id': 'ACALD',\n", " '__source_attr': {'acald_c': {'__value': -1.0},\n", " 'coa_c': {'__value': -1.0},\n", " 'nad_c': {'__value': -1.0}},\n", " '__target_attr': {'accoa_c': {'__value': 1.0},\n", " 'h_c': {'__value': 1.0},\n", " 'nadh_c': {'__value': 1.0}},\n", " 'default_lb': -1000.0,\n", " 'default_ub': 1000.0})" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "G.get_edge(0), G.get_attr_edge(0)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.10.10" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 5 }