{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Build Metabolic Model" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import modelseedpy\n", "from modelseedpy import MSBuilder, MSGenome" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "genome = MSGenome.from_fasta('GCF_000005845.2_ASM584v2_protein.faa', split=' ')" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of features: 4285\n" ] } ], "source": [ "print('Number of features:', len(genome.features))" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
IDCoreModelTemplateV2
Memory address0x07fcbc3ca95e0
Number of metabolites161
Number of species187
Number of reactions197
Number of biomasses2
Number of roles20552
Number of complexes9423
" ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from modelseedpy.helpers import get_template\n", "from modelseedpy.core.mstemplate import MSTemplateBuilder\n", "template = MSTemplateBuilder.from_dict(get_template('template_core')).build()\n", "template" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Nameecoli.core
Memory address0x07fcbc00f94c0
Number of metabolites148
Number of reactions155
Number of groups0
Objective expression1.0*bio1 - 1.0*bio1_reverse_b18f7
Compartmentsc0, e0
" ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "model = MSBuilder.build_metabolic_model('ecoli.core', genome, gapfill_media=None, template=template, allow_all_non_grp_reactions=True, annotate_with_rast=True)\n", "model" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "

Objective

1.0 bio1 = 0.05181669326590254

Uptake

\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
MetaboliteReactionFluxC-NumberC-Flux
cpd00007_e0EX_cpd00007_e04.04900.00%
cpd00009_e0EX_cpd00009_e00.218400.00%
cpd00027_e0EX_cpd00027_e016100.00%

Secretion

\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
MetaboliteReactionFluxC-NumberC-Flux
cpd00001_e0EX_cpd00001_e0-4.65600.00%
cpd00011_e0EX_cpd00011_e0-3.6841100.00%
cpd00067_e0EX_cpd00067_e0-0.73700.00%
cpd11416_c0SK_cpd11416_c0-0.0518200.00%
" ], "text/plain": [ "" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "model.objective = 'bio1'\n", "model.medium = {\n", " 'EX_cpd00067_e0': 1000,\n", " 'EX_cpd00027_e0': 1,\n", " 'EX_cpd00007_e0': 1000,\n", " 'EX_cpd00001_e0': 1000,\n", " 'EX_cpd00009_e0': 1000,\n", "}\n", "model.summary()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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.9.12" } }, "nbformat": 4, "nbformat_minor": 4 }