{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Analyzing metabolic interactions\n", "\n", "Whereas the default results will show you which taxon consumes and produces which metabolite it is not immediately apparent which metabolic interactions that implies. Thus, we provide some helpers to quantify and summarize metabolic interactions between taxa.\n", "\n", "It should be noted that MICOM provides mechanistic interactions, thus they differ quite abit from correlations. First, they are calculated on a per sample basis and can thus differ between samples as well. They are also non-symmetric and directed and thus qualify as ecological interactions. The strategy used in `grow` workflow might also affect the predicted interactions. The most conservative (least interactions) will be predicted with parsimonious FBA because it will also minimize inter-taxon fluxes. The other strategies are somewhat more permissive for inter-taxon fluxes but may also include futile cycles (which will not appear in parsimonious FBA).\n", "\n", "Finally all-versus-all interactions can be somewhat slow for larger data sets due to the inherent combinatorial explosion. The complexity will scale with $n_{samples} \\cdot n^2_{taxa} \\cdot n_{metabolites}$.\n", "\n", "## Calculating focal interactions\n", "\n", "Interactions are obatined from a `GrowthResults` object as obtained by the `grow` workflow. By default they are based on a single taxon of interest (called a focal taxon) for which we will calculate all metabolic interactions with all other taxa in all samples. MICOM stratifies interactions into 3 ecological types shown below.\n", "\n", "\n", "\n", "Let's see what that looks like by using a larger example result." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | metabolite | \n", "focal | \n", "partner | \n", "class | \n", "flux | \n", "sample_id | \n", "name | \n", "molecular_weight | \n", "C_number | \n", "N_number | \n", "... | \n", "kegg.compound | \n", "lipidmaps | \n", "metanetx.chemical | \n", "pubchem.compound | \n", "reactome | \n", "sbo | \n", "seed.compound | \n", "chebi | \n", "smiles | \n", "reaction | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2115 | \n", "ala_L[e] | \n", "s__Akkermansia_muciniphila | \n", "s__Bacteroides_fragilis | \n", "provided | \n", "11.238551 | \n", "S_SRR5935812 | \n", "L-alanine | \n", "89.09318 | \n", "3 | \n", "1 | \n", "... | \n", "C00041 | \n", "NaN | \n", "MNXM1105732 | \n", "5950.0 | \n", "NaN | \n", "SBO:0000247 | \n", "cpd00035 | \n", "CHEBI:16977 | \n", "NaN | \n", "EX_ala_L(e) | \n", "
2141 | \n", "lac_D[e] | \n", "s__Akkermansia_muciniphila | \n", "s__Bacteroides_fragilis | \n", "provided | \n", "11.141526 | \n", "S_SRR5935812 | \n", "D-lactate | \n", "89.07000 | \n", "3 | \n", "0 | \n", "... | \n", "C00256 | \n", "NaN | \n", "MNXM731835 | \n", "61503.0 | \n", "NaN | \n", "SBO:0000247 | \n", "cpd00221 | \n", "CHEBI:42111 | \n", "NaN | \n", "EX_lac_D(e) | \n", "
1080 | \n", "acald[e] | \n", "s__Akkermansia_muciniphila | \n", "s__Escherichia_coli | \n", "received | \n", "9.277781 | \n", "S_SRR5935769 | \n", "Acetaldehyde | \n", "44.05256 | \n", "2 | \n", "0 | \n", "... | \n", "C00084 | \n", "NaN | \n", "MNXM75 | \n", "177.0 | \n", "NaN | \n", "SBO:0000247 | \n", "cpd00071 | \n", "CHEBI:15343 | \n", "NaN | \n", "EX_acald(e) | \n", "
1120 | \n", "pro_L[e] | \n", "s__Akkermansia_muciniphila | \n", "s__Escherichia_coli | \n", "received | \n", "9.208372 | \n", "S_SRR5935769 | \n", "L-proline | \n", "115.13046 | \n", "5 | \n", "1 | \n", "... | \n", "C00148;C000763 | \n", "NaN | \n", "MNXM114 | \n", "145742.0 | \n", "NaN | \n", "SBO:0000247 | \n", "cpd00129 | \n", "CHEBI:17203 | \n", "NaN | \n", "EX_pro_L(e) | \n", "
1094 | \n", "etoh[e] | \n", "s__Akkermansia_muciniphila | \n", "s__Escherichia_coli | \n", "received | \n", "8.980545 | \n", "S_SRR5935769 | \n", "Ethanol | \n", "46.06844 | \n", "2 | \n", "0 | \n", "... | \n", "C00469 | \n", "NaN | \n", "MNXM734299 | \n", "702.0 | \n", "NaN | \n", "SBO:0000247 | \n", "cpd00363 | \n", "CHEBI:16236 | \n", "NaN | \n", "EX_etoh(e) | \n", "
5 rows × 24 columns
\n", "\n", " | sample_id | \n", "focal | \n", "partner | \n", "class | \n", "flux | \n", "mass_flux | \n", "C_flux | \n", "N_flux | \n", "n_ints | \n", "
---|---|---|---|---|---|---|---|---|---|
0 | \n", "S_SRR5935769 | \n", "s__Akkermansia_muciniphila | \n", "s__Alistipes_finegoldii | \n", "co-consumed | \n", "7.349260 | \n", "0.535659 | \n", "16.389235 | \n", "2.699664 | \n", "8 | \n", "
1 | \n", "S_SRR5935769 | \n", "s__Akkermansia_muciniphila | \n", "s__Alistipes_finegoldii | \n", "provided | \n", "3.180756 | \n", "0.342653 | \n", "13.209727 | \n", "2.560137 | \n", "6 | \n", "
2 | \n", "S_SRR5935769 | \n", "s__Akkermansia_muciniphila | \n", "s__Alistipes_finegoldii | \n", "received | \n", "1.513632 | \n", "0.321052 | \n", "13.030612 | \n", "2.967128 | \n", "6 | \n", "
3 | \n", "S_SRR5935769 | \n", "s__Akkermansia_muciniphila | \n", "s__Alistipes_onderdonkii | \n", "co-consumed | \n", "2.329465 | \n", "0.259526 | \n", "8.734520 | \n", "1.738114 | \n", "8 | \n", "
4 | \n", "S_SRR5935769 | \n", "s__Akkermansia_muciniphila | \n", "s__Alistipes_onderdonkii | \n", "provided | \n", "0.906143 | \n", "0.112754 | \n", "5.490118 | \n", "0.764795 | \n", "4 | \n", "
\n", "\n" ], "text/plain": [ "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "(1115688, 24)" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "full = interactions(results, taxa=None, threads=8)\n", "full.shape" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This generates quite a lot of results, but we can again use a summary." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(117108, 9)" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "full_summary = summarize_interactions(full)\n", "full_summary.shape" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Metabolic Exchange Score\n", "\n", "For a slightly more global view on exchanges we also provide calculation of the Metabolic Exchange Score (MES) by Marcelino et al., which is decribed [in detail here](https://doi.org/10.1038/s41467-023-42112-w). The MES is the geometric mean of the number of producers P and consumers C of a metabolite m in a single sample i, given by:\n", "\n", "$$\n", "MES^i_m = 2\\cdot\\frac{P^i_m\\cdot C^i_m}{P^i_m + C^i_m}\n", "$$\n", "\n", "This can be interpreted as a normalized number of all observed metabolic interactions (becuse $P\\cdot C$ is the number of all possible directed combinations of producers and consumers). So it is a measure of cross-feeding. \n", "\n", "It can also be calculated very fast for large data sets, so let's go." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | metabolite | \n", "sample_id | \n", "MES | \n", "name | \n", "molecular_weight | \n", "C_number | \n", "N_number | \n", "bigg.metabolite | \n", "biocyc | \n", "hmdb | \n", "... | \n", "kegg.compound | \n", "lipidmaps | \n", "metanetx.chemical | \n", "pubchem.compound | \n", "reactome | \n", "sbo | \n", "seed.compound | \n", "chebi | \n", "smiles | \n", "reaction | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "12dhchol[e] | \n", "S_SRR5935769 | \n", "4.800000 | \n", "12-Dehydrocholate | \n", "405.54758 | \n", "24 | \n", "0 | \n", "12dhchol | \n", "NaN | \n", "NaN | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "SBO:0000247 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "EX_12dhchol(e) | \n", "
1 | \n", "12dhchol[e] | \n", "S_SRR5935812 | \n", "4.800000 | \n", "12-Dehydrocholate | \n", "405.54758 | \n", "24 | \n", "0 | \n", "12dhchol | \n", "NaN | \n", "NaN | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "SBO:0000247 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "EX_12dhchol(e) | \n", "
2 | \n", "12dhchol[e] | \n", "S_SRR5935816 | \n", "3.428571 | \n", "12-Dehydrocholate | \n", "405.54758 | \n", "24 | \n", "0 | \n", "12dhchol | \n", "NaN | \n", "NaN | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "SBO:0000247 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "EX_12dhchol(e) | \n", "
3 | \n", "12dhchol[e] | \n", "S_SRR5935843 | \n", "4.444444 | \n", "12-Dehydrocholate | \n", "405.54758 | \n", "24 | \n", "0 | \n", "12dhchol | \n", "NaN | \n", "NaN | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "SBO:0000247 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "EX_12dhchol(e) | \n", "
4 | \n", "12dhchol[e] | \n", "S_SRR5935924 | \n", "4.444444 | \n", "12-Dehydrocholate | \n", "405.54758 | \n", "24 | \n", "0 | \n", "12dhchol | \n", "NaN | \n", "NaN | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "SBO:0000247 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "EX_12dhchol(e) | \n", "
5 rows × 21 columns
\n", "