{ "cells": [ { "cell_type": "markdown", "id": "fb270ec2-29da-4100-9485-39da5cce1663", "metadata": {}, "source": [ "# Reconstructing a ME-model from the OSM\n", "\n", "The organism-specific matrix is a XLSX structure that contains all the mappings necessary to build a ME-model (see [Architecture of coralME](coralMEArchitecture.ipynb)).\n", "\n", "In this tutorial we will reconstruct a _Bacillus subtilis_ ME-model from the OSM. This is useful once you have already run builder.generate_files() which performs the _Synchronize_ and _Complement_ steps (see [Architecture of coralME](coralMEArchitecture.ipynb)).\n", "\n", "This way is quicker but make sure not to overwrite your OSM re-running the reconstruction as in Tutorial 1, because all you manual curation will be lost." ] }, { "cell_type": "markdown", "id": "dfdb20cc-d339-4311-a011-2a9d4c0fc1be", "metadata": {}, "source": [ "## Import libraries" ] }, { "cell_type": "code", "execution_count": null, "id": "d048f35f-6a3b-4642-86cd-49e4c4e4a187", "metadata": { "ExecuteTime": { "end_time": "2022-12-12T06:27:35.182100Z", "start_time": "2022-12-12T06:27:35.157355Z" } }, "outputs": [], "source": [ "from IPython.display import display, HTML, Math, Markdown\n", "display(HTML(\"\"))\n", "\n", "from coralme.builder.main import MEBuilder" ] }, { "cell_type": "markdown", "id": "8512306e-8639-4607-91ed-3a4f62af52b6", "metadata": {}, "source": [ "## Path to configuration files" ] }, { "cell_type": "code", "execution_count": null, "id": "d62ee683-429e-481b-87ea-8758c47886bb", "metadata": {}, "outputs": [], "source": [ "organism = './bsubtilis/organism.json'\n", "inputs = './bsubtilis/input.json'" ] }, { "cell_type": "markdown", "id": "ee88533a-eb05-4d5b-84ce-6f816470f363", "metadata": {}, "source": [ "## Create MEBuilder instance\n", "\n", "This time you create it from the yaml configuration file which is already generated and filled. This file condenses the configuration in one place, see an example [here](./bsubtilis/coralme-config.yaml)." ] }, { "cell_type": "code", "execution_count": null, "id": "e1c65f0c-3528-4357-954f-e4fb8b870901", "metadata": { "ExecuteTime": { "end_time": "2022-12-12T06:30:28.060280Z", "start_time": "2022-12-12T06:30:01.706785Z" } }, "outputs": [], "source": [ "builder = MEBuilder(*['./bsubtilis/coralme-config.yaml'])" ] }, { "cell_type": "markdown", "id": "f7dea64e-bca5-471b-8fa3-dda16736e8d7", "metadata": {}, "source": [ "## Build ME-model\n", "\n", "This corresponds to _Build_ in [Architecture of coralME](coralMEArchitecture.ipynb)" ] }, { "cell_type": "code", "execution_count": null, "id": "203989b7-bbd5-4261-8eb5-9cf0436ce366", "metadata": { "ExecuteTime": { "end_time": "2022-12-12T06:28:36.607889Z", "start_time": "2022-12-12T06:27:59.542579Z" }, "tags": [] }, "outputs": [], "source": [ "builder.build_me_model(overwrite=False)" ] }, { "cell_type": "markdown", "id": "d9773386-565c-406b-b10c-cd6f9d79fc25", "metadata": {}, "source": [ "## Troubleshoot ME-model\n", "\n", "This corresponds to _Find gaps_ in [Architecture of coralME](coralMEArchitecture.ipynb)" ] }, { "cell_type": "code", "execution_count": null, "id": "dab0eb6d-2a7e-4d55-8542-32a960aa02b1", "metadata": {}, "outputs": [], "source": [ "builder.troubleshoot(growth_key_and_value = { builder.me_model.mu : 0.001 }, solver=\"qminos\")" ] }, { "cell_type": "markdown", "id": "9cf7ccc4-ad15-45c3-a0e6-a59035dc3b1d", "metadata": {}, "source": [ "
\n", "**Note**: We set 0.001 as a standard value for feasibility checking, but feel free to modify it! Sometimes too high a value could put a significant strain on the model and give too many gaps to start with. Too low a value might not show you all the gaps needed.\n", "
" ] }, { "cell_type": "code", "execution_count": null, "id": "6fb0dc8e-2102-4812-b7f1-68d5d6692c17", "metadata": {}, "outputs": [], "source": [ "import coralme\n", "coralme.io.json.save_json_me_model(builder.me_model,\"./bsubtilis/MEModel-step3-bsubtilis-TS.json\")" ] } ], "metadata": { "kernelspec": { "display_name": "coralme-1.1.6", "language": "python", "name": "coralme-1.1.6" }, "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.12" }, "toc-autonumbering": true, "toc-showcode": true }, "nbformat": 4, "nbformat_minor": 5 }