{ "cells": [ { "cell_type": "markdown", "id": "fb270ec2-29da-4100-9485-39da5cce1663", "metadata": {}, "source": [ "# Reconstructing with BioCyc information and curated files\n", "\n", "In this tutorial we will reconstruct a _Bacillus subtilis_ ME-model from just the input files." ] }, { "cell_type": "markdown", "id": "dbcc45ef-215d-4ee1-8383-bedd2efd084f", "metadata": {}, "source": [ "## Import libraries" ] }, { "cell_type": "code", "execution_count": 1, "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 coralme.builder.main import MEBuilder\n", "import coralme" ] }, { "cell_type": "markdown", "id": "f40390ac-ebd6-4c7c-88dc-fb7d5b276383", "metadata": {}, "source": [ "## Path to configuration files" ] }, { "cell_type": "markdown", "id": "fe8269c7-24de-4f65-b01f-3412883f238e", "metadata": {}, "source": [ "For more information about these files see [Description of inputs](BasicInputs.ipynb). The configuration and layout used here is as shown in [this *B. subtilis* ME-model repository](https://github.com/jdtibochab/coralme-models/tree/main/published/bsubtilis)." ] }, { "cell_type": "code", "execution_count": 2, "id": "d62ee683-429e-481b-87ea-8758c47886bb", "metadata": {}, "outputs": [], "source": [ "organism = './bsubtilis/organism.json'\n", "inputs = './bsubtilis/input.json'" ] }, { "cell_type": "markdown", "id": "962f97bf-a03d-432f-916d-be11877033c4", "metadata": {}, "source": [ "## Create MEBuilder instance" ] }, { "cell_type": "markdown", "id": "f9988c4f-9bc2-4716-b8f9-46b02d533b90", "metadata": {}, "source": [ "For more information about this class see [Architecture of coralME](coralMEArchitecture.ipynb)" ] }, { "cell_type": "code", "execution_count": 3, "id": "f83fbefc-c392-496d-9e1e-7820d1b6d60b", "metadata": { "tags": [] }, "outputs": [], "source": [ "builder = MEBuilder(*[organism, inputs])" ] }, { "cell_type": "markdown", "id": "32472ecb-9d39-477c-a611-3fb43d2e3254", "metadata": {}, "source": [ "## Generate files\n", "\n", "This corresponds to _Synchronyze_ and _Complement_ steps in [Architecture of coralME](coralMEArchitecture.ipynb)" ] }, { "cell_type": "code", "execution_count": 4, "id": "33e8a1a3-3206-4bc9-9407-3c31f5367d29", "metadata": { "ExecuteTime": { "end_time": "2022-12-12T06:30:28.060280Z", "start_time": "2022-12-12T06:30:01.706785Z" }, "scrolled": true, "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Initiating file processing...\n", "~ Processing files for bsubtilis...\n", "Set parameter Username\n", "Academic license - for non-commercial use only - expires 2025-09-03\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "Checking M-model metabolites... : 100.0%|██████████| 990/ 990 [00:00<00:00]\n", "Checking M-model genes... : 100.0%|██████████| 844/ 844 [00:00<00:00]\n", "Checking M-model reactions... : 100.0%|██████████| 1250/ 1250 [00:00<00:00]\n", "Generating complexes dataframe from optional proteins file... : 100.0%|██████████| 4554/ 4554 [00:00<00:00]\n", "Syncing optional genes file... : 100.0%|██████████| 4541/ 4541 [00:00<00:00]\n", "Looking for duplicates within datasets... : 100.0%|██████████| 5/ 5 [00:00<00:00]\n", "Gathering ID occurrences across datasets... : 100.0%|██████████| 10647/10647 [00:00<00:00]\n", "Solving duplicates across datasets... : 0.0%| | 0/ 0 [00:00\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": "markdown", "id": "88421b3b-8b8f-4956-8888-98876d6e1df8", "metadata": {}, "source": [ "## Save as a JSON" ] }, { "cell_type": "code", "execution_count": 7, "id": "4927e5f7-97c0-4504-86cc-d1436d6482fa", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "2024-11-26 17:43:32,509 The metabolite 'pg160_p' must exist in the ME-model to calculate the element contribution.\n", "2024-11-26 17:43:32,510 The metabolite '2agpg160_p' must exist in the ME-model to calculate the element contribution.\n", "2024-11-26 17:43:32,510 The metabolite 'pe160_p' must exist in the ME-model to calculate the element contribution.\n", "2024-11-26 17:43:32,510 The metabolite '2agpe160_p' must exist in the ME-model to calculate the element contribution.\n", "2024-11-26 17:43:32,909 Metabolite '4fe4s_c' does not have a formula. If it is a 'Complex', its formula will be determined from amino acid composition and prosthetic groups stoichiometry. Otherwise, please add it to the M-model.\n", "2024-11-26 17:43:32,910 Metabolite '4fe4s_c' does not have a formula. If it is a 'Complex', its formula will be determined from amino acid composition and prosthetic groups stoichiometry. Otherwise, please add it to the M-model.\n", "2024-11-26 17:43:32,910 Metabolite '2fe2s_c' does not have a formula. If it is a 'Complex', its formula will be determined from amino acid composition and prosthetic groups stoichiometry. Otherwise, please add it to the M-model.\n", "2024-11-26 17:43:32,910 Metabolite '2fe2s_c' does not have a formula. If it is a 'Complex', its formula will be determined from amino acid composition and prosthetic groups stoichiometry. Otherwise, please add it to the M-model.\n", "2024-11-26 17:43:32,910 Metabolite 'hemed_c' does not have a formula. If it is a 'Complex', its formula will be determined from amino acid composition and prosthetic groups stoichiometry. Otherwise, please add it to the M-model.\n", "2024-11-26 17:43:32,911 Metabolite 'hemed_c' does not have a formula. If it is a 'Complex', its formula will be determined from amino acid composition and prosthetic groups stoichiometry. Otherwise, please add it to the M-model.\n", "2024-11-26 17:43:32,911 Metabolite 'fmnh2_c' does not have a formula. If it is a 'Complex', its formula will be determined from amino acid composition and prosthetic groups stoichiometry. Otherwise, please add it to the M-model.\n", "2024-11-26 17:43:32,911 Metabolite 'fmnh2_c' does not have a formula. If it is a 'Complex', its formula will be determined from amino acid composition and prosthetic groups stoichiometry. Otherwise, please add it to the M-model.\n", "2024-11-26 17:43:32,912 Metabolite 'tl_c' does not have a formula. If it is a 'Complex', its formula will be determined from amino acid composition and prosthetic groups stoichiometry. Otherwise, please add it to the M-model.\n", "2024-11-26 17:43:32,912 Metabolite 'tl_c' does not have a formula. If it is a 'Complex', its formula will be determined from amino acid composition and prosthetic groups stoichiometry. Otherwise, please add it to the M-model.\n", "2024-11-26 17:43:32,912 Metabolite 'cs_c' does not have a formula. If it is a 'Complex', its formula will be determined from amino acid composition and prosthetic groups stoichiometry. Otherwise, please add it to the M-model.\n", "2024-11-26 17:43:32,912 Metabolite 'cs_c' does not have a formula. If it is a 'Complex', its formula will be determined from amino acid composition and prosthetic groups stoichiometry. Otherwise, please add it to the M-model.\n", "2024-11-26 17:43:32,913 The metabolite 'adocbl_c' must exist in the ME-model to calculate the element contribution.\n", "2024-11-26 17:43:32,913 The metabolite 'adocbl_c' must exist in the ME-model to calculate the element contribution.\n", "2024-11-26 17:43:32,913 The metabolite 'coo_c' must exist in the ME-model to calculate the element contribution.\n", "2024-11-26 17:43:32,913 The metabolite 'coo_c' must exist in the ME-model to calculate the element contribution.\n", "2024-11-26 17:43:32,913 The metabolite 'cosh_c' must exist in the ME-model to calculate the element contribution.\n", "2024-11-26 17:43:32,914 The metabolite 'cosh_c' must exist in the ME-model to calculate the element contribution.\n", "2024-11-26 17:43:32,914 The metabolite 'lipo_c' must exist in the ME-model to calculate the element contribution.\n", "2024-11-26 17:43:32,914 The metabolite 'lipo_c' must exist in the ME-model to calculate the element contribution.\n", "2024-11-26 17:43:32,914 Metabolite 'lipoyl_c' does not have a formula. If it is a 'Complex', its formula will be determined from amino acid composition and prosthetic groups stoichiometry. Otherwise, please add it to the M-model.\n", "2024-11-26 17:43:32,914 Metabolite 'lipoyl_c' does not have a formula. If it is a 'Complex', its formula will be determined from amino acid composition and prosthetic groups stoichiometry. Otherwise, please add it to the M-model.\n", "2024-11-26 17:43:32,915 The metabolite 'li_c' must exist in the ME-model to calculate the element contribution.\n", "2024-11-26 17:43:32,915 The metabolite 'li_c' must exist in the ME-model to calculate the element contribution.\n", "2024-11-26 17:43:32,915 The metabolite 'cl_c' must exist in the ME-model to calculate the element contribution.\n", "2024-11-26 17:43:32,915 The metabolite 'cl_c' must exist in the ME-model to calculate the element contribution.\n", "2024-11-26 17:43:32,915 The metabolite 'bmocogdp_c' must exist in the ME-model to calculate the element contribution.\n", "2024-11-26 17:43:32,915 The metabolite 'bmocogdp_c' must exist in the ME-model to calculate the element contribution.\n" ] } ], "source": [ "coralme.io.json.save_json_me_model(builder.me_model,\"./bsubtilis/MEModel-step3-bsubtilis-TS.json\")" ] } ], "metadata": { "kernelspec": { "display_name": "coralme-dev", "language": "python", "name": "coralme-dev" }, "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 }