Skip to content

Commit

Permalink
CommPhitting conflict resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
freiburgermsu committed Jun 30, 2023
2 parents 101adfd + 0912574 commit 6639316
Show file tree
Hide file tree
Showing 13 changed files with 835 additions and 84 deletions.
2 changes: 1 addition & 1 deletion docs/source/community/mssmetana_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ The scores can be calculated over a large range of models, either for specified
- *pool_size* ``int``: the number of parallel processes across which pairwise scores will be calculated, where omitting this score does not parallelize the process. Our observation is that the processes are not very CPU intensive, even when specifying the maximal number of cores, so this option should be utilized for >50 models, especially for all versus all comparisons.


**Returns** *scores_df* & *mets* ``Pandas.DataFrame`` & ``list<dict>``: a dataframe of all scores for all computed pairs and a list of the metabolites the comprise the ``MRO`` and ``MIP`` scores, for additional information of differences between the members, respectively. These returned objects can be directly passed as inputs into the ``smetana_report`` function of ModelSEEDpy to create an HTML output of the results, which processes the DataFrame into a quantitative heatmap and will eventually include the extra metabolites as hoverover metadata for access to users.
**Returns** *scores_df* & *mets* ``Pandas.DataFrame`` & ``list<dict>``: a dataframe of all scores for all computed pairs and a list of the metabolites the comprise the ``MRO`` and ``MIP`` scores, for additional information of differences between the members, respectively. These returned objects can be directly passed as inputs into the ``commscores_report`` function of ModelSEEDpy to create an HTML output of the results, which processes the DataFrame into a quantitative heatmap and will eventually include the extra metabolites as hoverover metadata for access to users.



Expand Down
203 changes: 200 additions & 3 deletions examples/Community Modeling/smetana/10-member_pairs_dev.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 1,
"id": "68a7047b-5da4-479d-85a1-87497aeeb978",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -4415,14 +4415,16 @@
{
"cell_type": "markdown",
"id": "409e58df-9e36-4790-a204-fae774790f33",
"metadata": {},
"metadata": {
"tags": []
},
"source": [
"# Develop directed MIP"
]
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 2,
"id": "9220c071-4b2a-4b6c-af14-cce6d6918c29",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -5623,6 +5625,201 @@
"]"
]
},
{
"cell_type": "markdown",
"id": "63bf16ed-fb24-4cf0-9ad5-d55a0b2dfef6",
"metadata": {},
"source": [
"# pH perturbation score"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "8987cfcd-847a-4489-aa27-df86eebae5e8",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"473.733804286171\n",
"-1000.0\n"
]
}
],
"source": [
"solutions = [model.optimize() for model in models]\n",
"for sol in solutions:\n",
" print(sol.fluxes[\"EX_cpd00067_e0\"])"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "715c1bfa-e45f-4346-b6f9-ca16aac11e66",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[('EX_cpd00001_e0', 0.0),\n",
" ('EX_cpd00007_e0', -1.2280689575811854),\n",
" ('EX_cpd00009_e0', 1000.0),\n",
" ('EX_cpd00011_e0', 1000.0),\n",
" ('EX_cpd00012_e0', 445.48098900886606),\n",
" ('EX_cpd00013_e0', 0.0),\n",
" ('EX_cpd00017_e0', -2.6450716009440915),\n",
" ('EX_cpd00023_e0', 794.2768493887612),\n",
" ('EX_cpd00024_e0', -1000.0),\n",
" ('EX_cpd00027_e0', 0.0),\n",
" ('EX_cpd00028_e0', -0.37786737156344175),\n",
" ('EX_cpd00030_e0', -0.37786737156344163),\n",
" ('EX_cpd00033_e0', -84.08921841218991),\n",
" ('EX_cpd00034_e0', -0.37786737156344175),\n",
" ('EX_cpd00035_e0', 1000.0),\n",
" ('EX_cpd00036_e0', 0.7557347431267184),\n",
" ('EX_cpd00039_e0', -38.436064532634774),\n",
" ('EX_cpd00041_e0', -43.67362607785033),\n",
" ('EX_cpd00048_e0', -0.37786737156344175),\n",
" ('EX_cpd00051_e0', -33.21931318421173),\n",
" ('EX_cpd00053_e0', 114.37097421995135),\n",
" ('EX_cpd00054_e0', -210.75476480931735),\n",
" ('EX_cpd00058_e0', -0.37786737156344175),\n",
" ('EX_cpd00060_e0', -14.942078954498),\n",
" ('EX_cpd00063_e0', -0.37786737156344163),\n",
" ('EX_cpd00064_e0', 0.0),\n",
" ('EX_cpd00065_e0', -6.356041872791398),\n",
" ('EX_cpd00066_e0', -20.80704273451524),\n",
" ('EX_cpd00067_e0', 473.733804286171),\n",
" ('EX_cpd00069_e0', -16.24988063704211),\n",
" ('EX_cpd00073_e0', 0.0),\n",
" ('EX_cpd00075_e0', 782.347072616093),\n",
" ('EX_cpd00076_e0', 0.0),\n",
" ('EX_cpd00080_e0', -1000.0),\n",
" ('EX_cpd00082_e0', 235.5948087319868),\n",
" ('EX_cpd00084_e0', -11.387216834004752),\n",
" ('EX_cpd00092_e0', 0.0),\n",
" ('EX_cpd00098_e0', 0.0),\n",
" ('EX_cpd00099_e0', -0.3778673715634417),\n",
" ('EX_cpd00100_e0', -231.4008878027877),\n",
" ('EX_cpd00104_e0', -0.3778673715634417),\n",
" ('EX_cpd00105_e0', 0.0),\n",
" ('EX_cpd00106_e0', -589.6373276000724),\n",
" ('EX_cpd00107_e0', -50.54852168644491),\n",
" ('EX_cpd00108_e0', 0.0),\n",
" ('EX_cpd00116_e0', 0.0),\n",
" ('EX_cpd00117_e0', 0.0),\n",
" ('EX_cpd00118_e0', -0.3778673715634417),\n",
" ('EX_cpd00119_e0', -10.67335333355537),\n",
" ('EX_cpd00122_e0', -21.686624901517284),\n",
" ('EX_cpd00128_e0', -18.442227097818275),\n",
" ('EX_cpd00129_e0', 0.0),\n",
" ('EX_cpd00130_e0', -344.90175316392964),\n",
" ('EX_cpd00132_e0', -27.04315928895215),\n",
" ('EX_cpd00136_e0', -0.3778673715634416),\n",
" ('EX_cpd00137_e0', 0.0),\n",
" ('EX_cpd00138_e0', 0.0),\n",
" ('EX_cpd00142_e0', 431.5080305070734),\n",
" ('EX_cpd00149_e0', -0.37786737156344175),\n",
" ('EX_cpd00154_e0', 0.0),\n",
" ('EX_cpd00156_e0', -47.43046340922638),\n",
" ('EX_cpd00159_e0', 999.9999999999999),\n",
" ('EX_cpd00161_e0', 0.0),\n",
" ('EX_cpd00162_e0', -999.9999999999999),\n",
" ('EX_cpd00164_e0', 0.0),\n",
" ('EX_cpd00166_e0', 0.0),\n",
" ('EX_cpd00179_e0', 0.0),\n",
" ('EX_cpd00184_e0', 0.0),\n",
" ('EX_cpd00205_e0', -0.37786737156344175),\n",
" ('EX_cpd00209_e0', -782.3470726160931),\n",
" ('EX_cpd00210_e0', 0.0),\n",
" ('EX_cpd00211_e0', 0.0),\n",
" ('EX_cpd00214_e0', 0.0),\n",
" ('EX_cpd00215_e0', -0.3778673715634417),\n",
" ('EX_cpd00218_e0', 999.2442652568735),\n",
" ('EX_cpd00220_e0', -1.1336021146903306),\n",
" ('EX_cpd00224_e0', 0.0),\n",
" ('EX_cpd00244_e0', 0.0),\n",
" ('EX_cpd00246_e0', 23.097702325364505),\n",
" ('EX_cpd00249_e0', 0.0),\n",
" ('EX_cpd00254_e0', -0.37786737156344175),\n",
" ('EX_cpd00264_e0', -0.37786737156344175),\n",
" ('EX_cpd00266_e0', 0.0),\n",
" ('EX_cpd00268_e0', 0.0),\n",
" ('EX_cpd00276_e0', 0.0),\n",
" ('EX_cpd00280_e0', 0.0),\n",
" ('EX_cpd00281_e0', 0.0),\n",
" ('EX_cpd00305_e0', 0.0),\n",
" ('EX_cpd00307_e0', -28.248177967351705),\n",
" ('EX_cpd00308_e0', 0.0),\n",
" ('EX_cpd00309_e0', -20.830498095983845),\n",
" ('EX_cpd00311_e0', -20.83049809598385),\n",
" ('EX_cpd00314_e0', 0.0),\n",
" ('EX_cpd00322_e0', -32.55972393326172),\n",
" ('EX_cpd00355_e0', -1000.0),\n",
" ('EX_cpd00367_e0', 0.0),\n",
" ('EX_cpd00381_e0', 0.0),\n",
" ('EX_cpd00386_e0', 0.0),\n",
" ('EX_cpd00393_e0', -1.1336021146903252),\n",
" ('EX_cpd00395_e0', 0.0),\n",
" ('EX_cpd00438_e0', 0.0),\n",
" ('EX_cpd00531_e0', 0.0),\n",
" ('EX_cpd00540_e0', 0.0),\n",
" ('EX_cpd00550_e0', 0.0),\n",
" ('EX_cpd00588_e0', 0.0),\n",
" ('EX_cpd00609_e0', 0.0),\n",
" ('EX_cpd00635_e0', 0.0),\n",
" ('EX_cpd00637_e0', 0.0),\n",
" ('EX_cpd00644_e0', -0.7557347431268853),\n",
" ('EX_cpd00653_e0', 0.0),\n",
" ('EX_cpd00654_e0', 0.0),\n",
" ('EX_cpd00731_e0', -3.3678377742560768),\n",
" ('EX_cpd00793_e0', -0.37786737156344175),\n",
" ('EX_cpd00794_e0', 293.4729127260834),\n",
" ('EX_cpd00797_e0', 0.0),\n",
" ('EX_cpd00971_e0', 0.0),\n",
" ('EX_cpd01012_e0', 0.0),\n",
" ('EX_cpd01017_e0', 0.0),\n",
" ('EX_cpd01030_e0', 0.0),\n",
" ('EX_cpd01080_e0', -33.55136743359262),\n",
" ('EX_cpd01092_e0', 0.0),\n",
" ('EX_cpd01171_e0', 0.0),\n",
" ('EX_cpd01262_e0', 0.0),\n",
" ('EX_cpd01329_e0', 0.0),\n",
" ('EX_cpd01914_e0', 0.0),\n",
" ('EX_cpd03048_e0', 0.0),\n",
" ('EX_cpd03424_e0', 0.0),\n",
" ('EX_cpd03453_e0', 0.0),\n",
" ('EX_cpd03696_e0', 0.0),\n",
" ('EX_cpd03725_e0', 0.0),\n",
" ('EX_cpd03726_e0', 0.0),\n",
" ('EX_cpd03847_e0', -3.3678377742560763),\n",
" ('EX_cpd04097_e0', 0.0),\n",
" ('EX_cpd04098_e0', 0.0),\n",
" ('EX_cpd04099_e0', 0.0),\n",
" ('EX_cpd08023_e0', 0.0),\n",
" ('EX_cpd09878_e0', 0.0),\n",
" ('EX_cpd10515_e0', -1.1336021146903248),\n",
" ('EX_cpd10516_e0', 0.0),\n",
" ('EX_cpd11575_e0', 0.0),\n",
" ('EX_cpd11576_e0', 0.0),\n",
" ('EX_cpd11578_e0', 0.0),\n",
" ('EX_cpd11579_e0', 0.0),\n",
" ('EX_cpd11596_e0', 0.0),\n",
" ('EX_cpd15560_e0', 0.0),\n",
" ('EX_cpd15561_e0', 0.0),\n",
" ('EX_cpd15603_e0', 0.0)]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"display(sorted([content for content in solutions[0].fluxes.items() if \"EX_\" in content[0]]))"
]
},
{
"cell_type": "markdown",
"id": "40fbe40e-4209-4052-9e38-27d7678c3cf2",
Expand Down
Loading

0 comments on commit 6639316

Please sign in to comment.