{ "cells": [ { "cell_type": "markdown", "id": "45c8dd54-1683-40cc-8b0b-bbef62882a76", "metadata": {}, "source": [ "# Single meal: Baobab, Honey, and Antelope\n", "\n", "Here we will build a medium based on the anticipated metabolites present in the human gut for a meal matched to the Hadza people in Tanzania. Please be aware that this is unlikely to represent the full diversity of the diet of the Hadza.\n", "\n", "The composition of the meal is the following:\n", "\n", "- 200g Baobab\n", "- 50g Baobab seeds (mixed with water)\n", "- 100g of Honey\n", "- 100g of Antelope meat\n", "\n", "This sums up to 1051 kcal.\n", "\n", "We will start by reading individual tables for the specific foods and scale the abundances." ] }, { "cell_type": "code", "execution_count": 86, "id": "be313cb2-1e5d-4766-bba1-7479835c5925", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "\n", "meal = {\n", " \"Baobab pulp\": 200,\n", " \"Baobab seed\": 50,\n", " \"Honey\": 100,\n", " \"Antelope\": 100\n", "}\n", "\n", "foods = []\n", "for food in meal:\n", " mets = pd.read_excel(\"../data/foods_diets.xlsx\", food)\n", " mets[\"amount_g\"] = mets.relative_abundance / mets.relative_abundance.sum() * meal[food]\n", " mets[\"concentration\"] = mets[\"amount_g\"] / mets[\"mw\"] * 1000.0 # to yield mmol/meal\n", " mets[\"flux\"] = mets[\"concentration\"] / 8.0\n", " mets[\"food\"] = food\n", " foods.append(mets)\n", "foods = pd.concat(foods)" ] }, { "cell_type": "markdown", "id": "693840a9-6642-4a73-b2d4-3d028ec49d55", "metadata": {}, "source": [ "Now we combine the data." ] }, { "cell_type": "code", "execution_count": 87, "id": "8b0f6c2a-f57c-4cfb-ac7e-c73ee9c0bb9e", "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
metaboliteflux
04abut0.724400
1Lcystin0.002091
2ab14lac_L0.258269
3acgal1.051659
4acon_C1.122785
\n", "
" ], "text/plain": [ " metabolite flux\n", "0 4abut 0.724400\n", "1 Lcystin 0.002091\n", "2 ab14lac_L 0.258269\n", "3 acgal 1.051659\n", "4 acon_C 1.122785" ] }, "execution_count": 87, "metadata": {}, "output_type": "execute_result" } ], "source": [ "foods.loc[foods.metabolite == \"h2o\", \"flux\"] += 1000.0 / 18.01 * 1000.0 / 8.0 # add 1L water\n", "diet = foods.dropna(subset=[\"metabolite\"]).groupby(\"metabolite\").flux.sum().reset_index()\n", "diet.head()" ] }, { "cell_type": "markdown", "id": "a1221035-cf11-44d8-aee8-784e2d8d4da8", "metadata": {}, "source": [ "## Adjust for intestinal adsorption\n", "\n", "To achieve this we will load the Recon3 human model. AGORA and Recon IDs are very similar so we should be able to match them. We just have to adjust the Recon3 ones a bit. We start by identifying all available exchanges in Recon3 and adjusting the IDs." ] }, { "cell_type": "code", "execution_count": 88, "id": "eea9b19f-530f-48c9-a1d3-636a1cb6b72d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0 5adtststerone\n", "1 5adtststerones\n", "2 5fthf\n", "3 5htrp\n", "4 5mthf\n", "dtype: object" ] }, "execution_count": 88, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from cobra.io import read_sbml_model\n", "import pandas as pd\n", "\n", "recon3 = read_sbml_model(\"../data/Recon3D.xml.gz\")\n", "exchanges = pd.Series([r.id for r in recon3.exchanges])\n", "exchanges = exchanges.str.replace(\"__\", \"_\").str.replace(\"_e$|EX_\", \"\", regex=True)\n", "exchanges.head()" ] }, { "cell_type": "code", "execution_count": 89, "id": "730fbbb8-88bf-4961-a61a-64bb1e910a59", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.2 52\n", "1.0 19\n", "Name: dilution, dtype: int64" ] }, "execution_count": 89, "metadata": {}, "output_type": "execute_result" } ], "source": [ "diet[\"dilution\"] = 1.0\n", "diet.loc[diet.metabolite.isin(exchanges), \"dilution\"] = 0.2\n", "diet[\"flux\"] = diet[\"flux\"] * diet[\"dilution\"] \n", "diet[[\"metabolite\", \"dilution\"]].drop_duplicates().dilution.value_counts()" ] }, { "cell_type": "markdown", "id": "ee3884b4-5592-424a-a157-ee7cce0d9d77", "metadata": {}, "source": [ "## Adding host supplied components\n", "\n", "Finally we add the host metabolites such as primary bile acids and mucins and a minuscule amount of oxygen." ] }, { "cell_type": "code", "execution_count": 90, "id": "c2a5763e-0569-455d-9bac-cb32a77ac4bf", "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", " \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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
metabolitefluxdilutionreaction
04abut0.1448800.2EX_4abut(e)
1Lcystin0.0020911.0EX_Lcystin(e)
2ab14lac_L0.2582691.0EX_ab14lac_L(e)
3acgal0.2103320.2EX_acgal(e)
4acon_C1.1227851.0EX_acon_C(e)
...............
82gncore2_rl1.000000NaNEX_gncore2_rl(e)
83core71.000000NaNEX_core7(e)
84gchola1.000000NaNEX_gchola(e)
85tchola1.000000NaNEX_tchola(e)
86o20.001000NaNEX_o2(e)
\n", "

87 rows × 4 columns

\n", "
" ], "text/plain": [ " metabolite flux dilution reaction\n", "0 4abut 0.144880 0.2 EX_4abut(e)\n", "1 Lcystin 0.002091 1.0 EX_Lcystin(e)\n", "2 ab14lac_L 0.258269 1.0 EX_ab14lac_L(e)\n", "3 acgal 0.210332 0.2 EX_acgal(e)\n", "4 acon_C 1.122785 1.0 EX_acon_C(e)\n", ".. ... ... ... ...\n", "82 gncore2_rl 1.000000 NaN EX_gncore2_rl(e)\n", "83 core7 1.000000 NaN EX_core7(e)\n", "84 gchola 1.000000 NaN EX_gchola(e)\n", "85 tchola 1.000000 NaN EX_tchola(e)\n", "86 o2 0.001000 NaN EX_o2(e)\n", "\n", "[87 rows x 4 columns]" ] }, "execution_count": 90, "metadata": {}, "output_type": "execute_result" } ], "source": [ "diet.set_index(\"metabolite\", inplace=True)\n", "annotations = pd.read_csv(\"../data/agora_metabolites.csv\")\n", "\n", "# mucin\n", "for met in annotations.loc[annotations.metabolite.str.contains(\"core\"), \"metabolite\"]:\n", " diet.loc[met, \"flux\"] = 1\n", "\n", "# primary BAs\n", "for met in [\"gchola\", \"tchola\"]:\n", " diet.loc[met, \"flux\"] = 1\n", "\n", "# anaerobic\n", "diet.loc[\"o2\", \"flux\"] = 0.001\n", "\n", "diet.reset_index(inplace=True)\n", "diet[\"reaction\"] = \"EX_\" + diet.metabolite + \"(e)\"\n", "diet" ] }, { "cell_type": "markdown", "id": "c3024830-4534-4786-8665-932dd02b7b6a", "metadata": {}, "source": [ "And we will merge this table with some annotations to make it more accessible." ] }, { "cell_type": "code", "execution_count": 91, "id": "8ddab049-2e20-488b-aa9e-8894698a105d", "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", " \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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
metabolitefluxdilutionreactionnamehmdbkegg.compoundpubchem.compoundinchichebiglobal_id
04abut0.1448800.2EX_4abut_m4-AminobutanoateHMDB00112C00334119.0InChI=1S/C4H9NO2/c5-3-1-2-4(6)7/h1-3,5H2,(H,6,7)NaNEX_4abut(e)
1Lcystin0.0020911.0EX_Lcystin_mL-cystineHMDB00192C00491NaNInChI=1S/C6H12N2O4S2/c7-3(5(9)10)1-13-14-2-4(8...NaNEX_Lcystin(e)
2ab14lac_L0.2582691.0EX_ab14lac_L_mL-Arabinono-1,4-lactoneNaNNaNNaNNaNNaNEX_ab14lac_L(e)
3acgal0.2103320.2EX_acgal_mN-acetyl-D-galactosamineHMDB00212C0113235717.0NaNNaNEX_acgal(e)
4acon_C1.1227851.0EX_acon_C_mcis-AconitateNaNNaNNaNNaNNaNEX_acon_C(e)
\n", "
" ], "text/plain": [ " metabolite flux dilution reaction name \\\n", "0 4abut 0.144880 0.2 EX_4abut_m 4-Aminobutanoate \n", "1 Lcystin 0.002091 1.0 EX_Lcystin_m L-cystine \n", "2 ab14lac_L 0.258269 1.0 EX_ab14lac_L_m L-Arabinono-1,4-lactone \n", "3 acgal 0.210332 0.2 EX_acgal_m N-acetyl-D-galactosamine \n", "4 acon_C 1.122785 1.0 EX_acon_C_m cis-Aconitate \n", "\n", " hmdb kegg.compound pubchem.compound \\\n", "0 HMDB00112 C00334 119.0 \n", "1 HMDB00192 C00491 NaN \n", "2 NaN NaN NaN \n", "3 HMDB00212 C01132 35717.0 \n", "4 NaN NaN NaN \n", "\n", " inchi chebi global_id \n", "0 InChI=1S/C4H9NO2/c5-3-1-2-4(6)7/h1-3,5H2,(H,6,7) NaN EX_4abut(e) \n", "1 InChI=1S/C6H12N2O4S2/c7-3(5(9)10)1-13-14-2-4(8... NaN EX_Lcystin(e) \n", "2 NaN NaN EX_ab14lac_L(e) \n", "3 NaN NaN EX_acgal(e) \n", "4 NaN NaN EX_acon_C(e) " ] }, "execution_count": 91, "metadata": {}, "output_type": "execute_result" } ], "source": [ "skeleton = pd.merge(diet, annotations, on=\"metabolite\")\n", "\n", "skeleton[\"global_id\"] = skeleton.reaction\n", "skeleton[\"reaction\"] = \"EX_\" + skeleton.metabolite + \"_m\"\n", "skeleton.head()" ] }, { "cell_type": "markdown", "id": "3e958b78-e7a3-4277-a632-044ac8b9d36d", "metadata": {}, "source": [ "## Complete the medium\n", "\n", "Great we now have a pretty good skeleton. One issue that this will never be fully complete. There will always be some components missing that are essential for microbial growth. Fortunately, we provide a algorithm in MICOM to complete a medium with the smallest set of additional components to provide growth to all intestinal taxa." ] }, { "cell_type": "code", "execution_count": 92, "id": "6ff1606f-40ad-4e89-a5f4-909b6847e7f8", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Completing 818 strain-level models on a medium with 87 components (1 strict).\n",
       "
\n" ], "text/plain": [ "Completing \u001b[1;36m818\u001b[0m strain-level models on a medium with \u001b[1;36m87\u001b[0m components \u001b[1m(\u001b[0m\u001b[1;31m1\u001b[0m\u001b[31m strict\u001b[0m\u001b[1m)\u001b[0m.\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "4965aea19a7e43a3bb350fb1fba1097f", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Output()" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "
\n",
       "
\n" ], "text/plain": [ "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
Obtained growth for 815 models adding additional flux of 0.82/2940.27 on average.\n",
       "
\n" ], "text/plain": [ "Obtained growth for \u001b[1;36m815\u001b[0m models adding additional flux of \u001b[1;36m0.82\u001b[0m/\u001b[1;36m2940.27\u001b[0m on average.\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from micom.workflows.db_media import complete_db_medium\n", "\n", "manifest, imports = complete_db_medium(\n", " \"../data/agora103_strain.qza\", \n", " medium=skeleton, \n", " growth=0.1, \n", " threads=12, \n", " max_added_import=10, # do not add more than 10 mmol/h of flux per component\n", " strict=[\"EX_o2(e)\"], # force anaerobic environment\n", " weights=\"mass\" # minimize added molecular weight\n", ")" ] }, { "cell_type": "code", "execution_count": 93, "id": "32bd665c-ce23-4b28-bfd1-23adfdfd4743", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True 815\n", "False 3\n", "Name: can_grow, dtype: int64" ] }, "execution_count": 93, "metadata": {}, "output_type": "execute_result" } ], "source": [ "manifest.can_grow.value_counts()" ] }, { "cell_type": "code", "execution_count": 94, "id": "4dd91dec-23c7-4699-8d31-9d3a64680280", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Added flux is 153.99/3143.57 mmol/h.\n" ] } ], "source": [ "filled = imports.max()\n", "added = filled.sum() - skeleton.loc[skeleton.reaction.isin(filled.index), \"flux\"].sum()\n", "\n", "print(f\"Added flux is {added.sum():.2f}/{filled.sum():.2f} mmol/h.\")" ] }, { "cell_type": "markdown", "id": "3b5962e5-3c91-438a-aaec-9f764096e29d", "metadata": {}, "source": [ "Let's see what was added in large amounts." ] }, { "cell_type": "code", "execution_count": 95, "id": "8d324305-1e05-4f50-84e1-e6440d66e18c", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "EX_h_m 10.000000\n", "EX_h2_m 10.000000\n", "EX_glyleu_m 10.000000\n", "EX_no_m 10.000000\n", "EX_ser_L_m 10.000000\n", "EX_glyc_m 8.883167\n", "EX_succ_m 8.277121\n", "EX_co2_m 7.558247\n", "EX_asn_L_m 6.665649\n", "EX_for_m 5.926777\n", "EX_urea_m 4.965212\n", "EX_mal_L_m 4.867167\n", "EX_acald_m 4.838348\n", "EX_cytd_m 4.458517\n", "EX_ph2s_m 4.322594\n", "EX_acac_m 4.121076\n", "EX_fum_m 3.904283\n", "EX_nh4_m 3.869570\n", "EX_no3_m 3.851188\n", "EX_arg_L_m 3.519534\n", "dtype: float64" ] }, "execution_count": 95, "metadata": {}, "output_type": "execute_result" } ], "source": [ "added_fluxes = filled.copy()\n", "shared = added_fluxes.index[added_fluxes.index.isin(skeleton.reaction)]\n", "added_fluxes[shared] -= skeleton.flux[shared]\n", "added_fluxes.sort_values(ascending=False)[0:20]" ] }, { "cell_type": "markdown", "id": "ad36b333-bdc5-4a4f-9c90-58cfc3845f94", "metadata": {}, "source": [ "Looks okay. So we will now assemble the final medium. For this we add the new components to each sample and rebuild the annotations for a nicely formatted medium." ] }, { "cell_type": "code", "execution_count": 96, "id": "2abf0ad7-27c0-4d3f-b813-711c7b6874d5", "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", " \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", " \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", " \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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
metabolitefluxnamehmdbkegg.compoundpubchem.compoundinchichebireactionglobal_id
0ala_L0.427871L-alanineHMDB00161C000415950.0InChI=1S/C3H7NO2/c1-2(4)3(5)6/h2H,4H2,1H3,(H,5...NaNEX_ala_L_mEX_ala_L(e)
1arg_L3.769624L-argininium(1+)HMDB00517C000626322.0InChI=1S/C6H14N4O2/c7-4(5(11)12)2-1-3-10-6(8)9...NaNEX_arg_L_mEX_arg_L(e)
2asn_L6.665649L-asparagineHMDB00168C001526267.0InChI=1S/C4H8N2O3/c5-2(4(8)9)1-3(6)7/h2H,1,5H2...NaNEX_asn_L_mEX_asn_L(e)
3asp_L3.163472L-aspartate(1-)HMDB00191C000495960.0InChI=1S/C4H7NO4/c5-2(4(8)9)1-3(6)7/h2H,1,5H2,...NaNEX_asp_L_mEX_asp_L(e)
4ca22.710538calcium(2+)HMDB00464C00076NaNInChI=1S/Ca/q+2NaNEX_ca2_mEX_ca2(e)
.................................
173MGlcn540.009248mucin-type O-glycan No 54NaNNaNNaNNaNNaNEX_MGlcn54_mEX_MGlcn54(e)
174n20.028071NitrogenNaNNaNNaNNaNNaNEX_n2_mEX_n2(e)
175cmp0.008410CMPHMDB00095C000556131.0NaNNaNEX_cmp_mEX_cmp(e)
176datp0.002391dATPHMDB01532C0013115993.0NaNNaNEX_datp_mEX_datp(e)
177so31.072348SulfiteHMDB00240C000941100.0InChI=1S/H2O3S/c1-4(2)3/h(H2,1,2,3)/p-2NaNEX_so3_mEX_so3(e)
\n", "

178 rows × 10 columns

\n", "
" ], "text/plain": [ " metabolite flux name hmdb kegg.compound \\\n", "0 ala_L 0.427871 L-alanine HMDB00161 C00041 \n", "1 arg_L 3.769624 L-argininium(1+) HMDB00517 C00062 \n", "2 asn_L 6.665649 L-asparagine HMDB00168 C00152 \n", "3 asp_L 3.163472 L-aspartate(1-) HMDB00191 C00049 \n", "4 ca2 2.710538 calcium(2+) HMDB00464 C00076 \n", ".. ... ... ... ... ... \n", "173 MGlcn54 0.009248 mucin-type O-glycan No 54 NaN NaN \n", "174 n2 0.028071 Nitrogen NaN NaN \n", "175 cmp 0.008410 CMP HMDB00095 C00055 \n", "176 datp 0.002391 dATP HMDB01532 C00131 \n", "177 so3 1.072348 Sulfite HMDB00240 C00094 \n", "\n", " pubchem.compound inchi \\\n", "0 5950.0 InChI=1S/C3H7NO2/c1-2(4)3(5)6/h2H,4H2,1H3,(H,5... \n", "1 6322.0 InChI=1S/C6H14N4O2/c7-4(5(11)12)2-1-3-10-6(8)9... \n", "2 6267.0 InChI=1S/C4H8N2O3/c5-2(4(8)9)1-3(6)7/h2H,1,5H2... \n", "3 5960.0 InChI=1S/C4H7NO4/c5-2(4(8)9)1-3(6)7/h2H,1,5H2,... \n", "4 NaN InChI=1S/Ca/q+2 \n", ".. ... ... \n", "173 NaN NaN \n", "174 NaN NaN \n", "175 6131.0 NaN \n", "176 15993.0 NaN \n", "177 1100.0 InChI=1S/H2O3S/c1-4(2)3/h(H2,1,2,3)/p-2 \n", "\n", " chebi reaction global_id \n", "0 NaN EX_ala_L_m EX_ala_L(e) \n", "1 NaN EX_arg_L_m EX_arg_L(e) \n", "2 NaN EX_asn_L_m EX_asn_L(e) \n", "3 NaN EX_asp_L_m EX_asp_L(e) \n", "4 NaN EX_ca2_m EX_ca2(e) \n", ".. ... ... ... \n", "173 NaN EX_MGlcn54_m EX_MGlcn54(e) \n", "174 NaN EX_n2_m EX_n2(e) \n", "175 NaN EX_cmp_m EX_cmp(e) \n", "176 NaN EX_datp_m EX_datp(e) \n", "177 NaN EX_so3_m EX_so3(e) \n", "\n", "[178 rows x 10 columns]" ] }, "execution_count": 96, "metadata": {}, "output_type": "execute_result" } ], "source": [ "added_df = filled[filled > 1e-8].reset_index() \n", "added_df.iloc[:, 0] = added_df.iloc[:, 0].str.replace(\"EX_|_m$\", \"\", regex=True)\n", "added_df.columns = [\"metabolite\", \"flux\"]\n", "\n", "completed = pd.merge(added_df, annotations, on=\"metabolite\", how=\"left\")\n", "completed[\"reaction\"] = \"EX_\" + completed.metabolite + \"_m\"\n", "completed[\"global_id\"] = \"EX_\" + completed.metabolite + \"(e)\"\n", "completed" ] }, { "cell_type": "markdown", "id": "7633139b-8f41-4d49-b833-10f2c5ab0a41", "metadata": {}, "source": [ "## Validate the medium\n", "\n", "And we will now validate whether the medium works." ] }, { "cell_type": "code", "execution_count": 97, "id": "6962f533-2cab-4b4c-9e6b-8c2ccf0f5dec", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Checking 818 strain-level models on a medium with 178 components.\n",
       "
\n" ], "text/plain": [ "Checking \u001b[1;36m818\u001b[0m strain-level models on a medium with \u001b[1;36m178\u001b[0m components.\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "92133371410143e19aaf2f7ddd146ea8", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Output()" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "
\n",
       "
\n" ], "text/plain": [ "\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from micom.workflows.db_media import check_db_medium\n", "\n", "check = check_db_medium(\"../data/agora103_strain.qza\", medium=completed, threads=12)" ] }, { "cell_type": "code", "execution_count": 98, "id": "2b509db7-f18d-4f1e-82fc-ca86206fa79d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "count 818.000000\n", "mean 0.190551\n", "std 0.105812\n", "min 0.036577\n", "25% 0.100000\n", "50% 0.156764\n", "75% 0.256409\n", "max 0.646666\n", "Name: growth_rate, dtype: float64" ] }, "execution_count": 98, "metadata": {}, "output_type": "execute_result" } ], "source": [ "check.growth_rate.describe()" ] }, { "cell_type": "code", "execution_count": 99, "id": "7baa0acf-95a4-47f2-bb29-616128d549ad", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'../media/baobab_honey_antelope.qza'" ] }, "execution_count": 99, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import qiime2 as q2\n", "\n", "arti = q2.Artifact.import_data(\"MicomMedium[Global]\", completed)\n", "arti.save(\"../media/baobab_honey_antelope.qza\")" ] }, { "cell_type": "code", "execution_count": null, "id": "9ccb51ce-5186-450d-bd0d-54e1f810c707", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.8.13" } }, "nbformat": 4, "nbformat_minor": 5 }