{
"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",
" | ID | \n",
" CoreModelTemplateV2 | \n",
"
\n",
" | Memory address | \n",
" 0x07fcbc3ca95e0 | \n",
"
\n",
" | Number of metabolites | \n",
" 161 | \n",
"
\n",
" | Number of species | \n",
" 187 | \n",
"
\n",
" | Number of reactions | \n",
" 197 | \n",
"
\n",
" | Number of biomasses | \n",
" 2 | \n",
"
\n",
" | Number of roles | \n",
" 20552 | \n",
"
\n",
" | Number of complexes | \n",
" 9423 | \n",
"
\n",
"
"
],
"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",
" | Name | \n",
" ecoli.core | \n",
"
\n",
" | Memory address | \n",
" 0x07fcbc00f94c0 | \n",
"
\n",
" | Number of metabolites | \n",
" 148 | \n",
"
\n",
" | Number of reactions | \n",
" 155 | \n",
"
\n",
" | Number of groups | \n",
" 0 | \n",
"
\n",
" | Objective expression | \n",
" 1.0*bio1 - 1.0*bio1_reverse_b18f7 | \n",
"
\n",
" | Compartments | \n",
" c0, e0 | \n",
"
\n",
"
"
],
"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",
" | Metabolite | \n",
" Reaction | \n",
" Flux | \n",
" C-Number | \n",
" C-Flux | \n",
"
\n",
" \n",
" \n",
" \n",
" | cpd00007_e0 | \n",
" EX_cpd00007_e0 | \n",
" 4.049 | \n",
" 0 | \n",
" 0.00% | \n",
"
\n",
" \n",
" | cpd00009_e0 | \n",
" EX_cpd00009_e0 | \n",
" 0.2184 | \n",
" 0 | \n",
" 0.00% | \n",
"
\n",
" \n",
" | cpd00027_e0 | \n",
" EX_cpd00027_e0 | \n",
" 1 | \n",
" 6 | \n",
" 100.00% | \n",
"
\n",
" \n",
"
Secretion
\n",
" \n",
" \n",
" | Metabolite | \n",
" Reaction | \n",
" Flux | \n",
" C-Number | \n",
" C-Flux | \n",
"
\n",
" \n",
" \n",
" \n",
" | cpd00001_e0 | \n",
" EX_cpd00001_e0 | \n",
" -4.656 | \n",
" 0 | \n",
" 0.00% | \n",
"
\n",
" \n",
" | cpd00011_e0 | \n",
" EX_cpd00011_e0 | \n",
" -3.684 | \n",
" 1 | \n",
" 100.00% | \n",
"
\n",
" \n",
" | cpd00067_e0 | \n",
" EX_cpd00067_e0 | \n",
" -0.737 | \n",
" 0 | \n",
" 0.00% | \n",
"
\n",
" \n",
" | cpd11416_c0 | \n",
" SK_cpd11416_c0 | \n",
" -0.05182 | \n",
" 0 | \n",
" 0.00% | \n",
"
\n",
" \n",
"
"
],
"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
}