Skip to content

Commit

Permalink
BSS score debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
freiburgermsu committed Jun 26, 2023
1 parent 504ab7d commit 0edd988
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 54 deletions.
104 changes: 61 additions & 43 deletions examples/Community Modeling/smetana/debugging_CommScores_app.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@
"name": "stdout",
"output_type": "stream",
"text": [
"The minimal flux media consists of 39 compounds and a 1.9434348647772872 total influx, with a growth value of 0.10000000000006956\n",
"The minimal flux media consists of 39 compounds and a 1.897989858269931 total influx, with a growth value of 0.09999999999985704\n",
"The minimal flux media consists of 35 compounds and a 1.6635843914690578 total influx, with a growth value of 0.0999999999999432\n",
"The minimal flux media consists of 34 compounds and a 1.6635843914472912 total influx, with a growth value of 0.10000000000056675\n",
"The minimal flux media consists of 39 compounds and a 1.8979898582835206 total influx, with a growth value of 0.10000000000035852\n",
"The minimal flux media consists of 39 compounds and a 1.9434348647771043 total influx, with a growth value of 0.10000000000005213\n",
"The minimal media of all members:\n",
"{'Pseudomonas_sp._GM17_2511231006.fna.RAST.fbamodel': {'media': {'EX_cpd00179_e0': 0.06274188137458704, 'EX_cpd00051_e0': 0.0246696822701341, 'EX_cpd00058_e0': 0.00028061591595913103, 'EX_cpd00063_e0': 0.0002806159159591311, 'EX_cpd00066_e0': 0.015451949003134503, 'EX_cpd00205_e0': 0.00028061591595913103, 'EX_cpd00307_e0': 0.008410361565448637, 'EX_cpd00065_e0': 0.00472019191450218, 'EX_cpd00030_e0': 0.0002806159159591311, 'EX_cpd01017_e0': 0.008456496968442235, 'EX_cpd00215_e0': 0.00028061591595913103, 'EX_cpd00048_e0': 0.00028061591595913103, 'EX_cpd00438_e0': 0.0011917803122624656, 'EX_cpd00355_e0': 1.1842235631390219, 'EX_cpd00104_e0': 0.00028061591595913103, 'EX_cpd00119_e0': 0.007926360007371592, 'EX_cpd00793_e0': 0.000280615915959131, 'EX_cpd00322_e0': 0.0241798510337235, 'EX_cpd00007_e0': 0.0008418477478773931, 'EX_cpd00654_e0': 0.005215640721434261, 'EX_cpd00156_e0': 0.035223318909420306, 'EX_cpd00107_e0': 0.03753888475401271, 'EX_cpd00393_e0': 0.0008418477478773931, 'EX_cpd00644_e0': 0.0005612318319182638, 'EX_cpd00254_e0': 0.00028061591595913103, 'EX_cpd10515_e0': 0.0008418477478773932, 'EX_cpd00149_e0': 0.00028061591595913103, 'EX_cpd00311_e0': 0.015193123295810391, 'EX_cpd00264_e0': 0.00028061591595913103, 'EX_cpd00069_e0': 0.012067660460661201, 'EX_cpd00209_e0': 0.44760816358392586, 'EX_cpd00017_e0': 0.01306075817503584, 'EX_cpd00136_e0': 0.00028061591595913125, 'EX_cpd00028_e0': 0.00028061591595913103, 'EX_cpd00220_e0': 0.0008418477478773932, 'EX_cpd00034_e0': 0.00028061591595913103, 'EX_cpd00099_e0': 0.00028061591595913103, 'EX_cpd01080_e0': 0.024916275954454087, 'EX_cpd03847_e0': 0.002501059771089441}}, 'Sphingobium_sp._AP49_2512564014.fna.RAST.fbamodel': {'media': {'EX_cpd00051_e0': 0.0246696822701341, 'EX_cpd00058_e0': 0.000280615915959131, 'EX_cpd00063_e0': 0.0002806159159591311, 'EX_cpd00066_e0': 0.015451949003134503, 'EX_cpd00794_e0': 0.23177487666713806, 'EX_cpd00205_e0': 0.000280615915959131, 'EX_cpd00065_e0': 0.004720191914502182, 'EX_cpd00030_e0': 0.0002806159159591311, 'EX_cpd01017_e0': 0.008456496968338646, 'EX_cpd00215_e0': 0.00028061591595913103, 'EX_cpd00118_e0': 0.0002806159159591311, 'EX_cpd00048_e0': 0.000280615915959131, 'EX_cpd00104_e0': 0.000280615915959131, 'EX_cpd00119_e0': 0.16897710574742356, 'EX_cpd00793_e0': 0.00028061591595913103, 'EX_cpd00322_e0': 0.02417985103368549, 'EX_cpd00007_e0': 1.1741528321247476, 'EX_cpd00654_e0': 0.0011789605965904404, 'EX_cpd00039_e0': 0.0285438020490179, 'EX_cpd00156_e0': 0.03522331890914209, 'EX_cpd00107_e0': 0.037538884754012715, 'EX_cpd00009_e0': 0.08097478546317277, 'EX_cpd00393_e0': 0.000841847747877422, 'EX_cpd00644_e0': 0.0005612318318146764, 'EX_cpd00254_e0': 0.00028061591595913103, 'EX_cpd00149_e0': 0.00028061591595913103, 'EX_cpd10515_e0': 0.0008418477478773931, 'EX_cpd00264_e0': 0.0002806159159591311, 'EX_cpd00069_e0': 0.012067660460661201, 'EX_cpd00017_e0': 0.0019643114117139167, 'EX_cpd00136_e0': 0.00028061591595913103, 'EX_cpd00028_e0': 0.000280615915959131, 'EX_cpd00220_e0': 0.0008418477478773931, 'EX_cpd00034_e0': 0.0002806159159591311, 'EX_cpd00099_e0': 0.00028061591595913103, 'EX_cpd00277_e0': 0.0020247366768575458, 'EX_cpd01080_e0': 0.024916275954454083, 'EX_cpd00060_e0': 0.011096446763321905, 'EX_cpd03847_e0': 0.0025010597710894396}}, 'Variovorax_sp._CF313_2513020051.fna.RAST.fbamodel': {'media': {'EX_cpd00051_e0': 0.02466968227013427, 'EX_cpd00058_e0': 0.0002806159159591311, 'EX_cpd00063_e0': 0.00028061591595913103, 'EX_cpd00066_e0': 0.015451949003135044, 'EX_cpd00794_e0': 0.8176244301344567, 'EX_cpd15606_e0': 1.8216047928745112e-18, 'EX_cpd00205_e0': 0.0002806159159591311, 'EX_cpd00307_e0': 0.02097774605879147, 'EX_cpd00065_e0': 0.004720191914502181, 'EX_cpd00030_e0': 0.00028061591595913103, 'EX_cpd00215_e0': 0.00028061591595913103, 'EX_cpd00048_e0': 0.0002806159159591311, 'EX_cpd00355_e0': 0.08097454709762467, 'EX_cpd00104_e0': 0.0002806159159591311, 'EX_cpd00119_e0': 0.007926360007703519, 'EX_cpd00793_e0': 0.00028061591595913103, 'EX_cpd00322_e0': 0.02417985103372351, 'EX_cpd00007_e0': 0.0007015397898978277, 'EX_cpd00042_e0': 0.008456496968442575, 'EX_cpd00156_e0': 0.035223318909072016, 'EX_cpd00107_e0': 0.03753888475401271, 'EX_cpd00210_e0': 3.9958763578644884e-20, 'EX_cpd00393_e0': 0.0008418477478773936, 'EX_cpd00644_e0': 0.0005612318320354429, 'EX_cpd00254_e0': 0.00028061591595913114, 'EX_cpd00149_e0': 0.0002806159159591311, 'EX_cpd10515_e0': 0.0008418477478773931, 'EX_cpd00069_e0': 0.012067660460661201, 'EX_cpd00209_e0': 0.5366108058190525, 'EX_cpd00017_e0': 0.02944552934880533, 'EX_cpd00136_e0': 0.00028061591590533954, 'EX_cpd00028_e0': 0.0002806159159591311, 'EX_cpd00220_e0': 0.0008418477478774283, 'EX_cpd00034_e0': 0.00028061591595913103, 'EX_cpd00099_e0': 0.0002806159159591311}}}\n",
"{'Variovorax_sp._CF313_2513020051.fna.RAST.fbamodel': {'media': {'EX_cpd00136_e0': 0.0002806159159591311, 'EX_cpd00058_e0': 0.0002806159159591311, 'EX_cpd00794_e0': 0.8176244301433631, 'EX_cpd00028_e0': 0.0002806159159591311, 'EX_cpd00156_e0': 0.0352233189091625, 'EX_cpd00644_e0': 0.0005612318319187093, 'EX_cpd00322_e0': 0.02417985103372351, 'EX_cpd00099_e0': 0.0002806159159591311, 'EX_cpd00069_e0': 0.012067660460778994, 'EX_cpd00048_e0': 0.0002806159159591311, 'EX_cpd10515_e0': 0.0008418477478773931, 'EX_cpd00254_e0': 0.00028061591595913114, 'EX_cpd00063_e0': 0.00028061591595913103, 'EX_cpd00209_e0': 0.5366108058214961, 'EX_cpd00107_e0': 0.037538884753668865, 'EX_cpd00066_e0': 0.01545194900313454, 'EX_cpd00205_e0': 0.0002806159159591311, 'EX_cpd00119_e0': 0.007926360007371593, 'EX_cpd00220_e0': 0.0008418477478773521, 'EX_cpd00149_e0': 0.0002806159159591311, 'EX_cpd00355_e0': 0.08097454709604926, 'EX_cpd11583_e0': 2.6524073788118896e-13, 'EX_cpd00042_e0': 0.008456496968441576, 'EX_cpd00017_e0': 0.02944552931832897, 'EX_cpd00007_e0': 0.0007015397898978275, 'EX_cpd00393_e0': 0.0008418477478773936, 'EX_cpd00307_e0': 0.02097774605799387, 'EX_cpd00215_e0': 0.00028061591595913103, 'EX_cpd00034_e0': 0.00028061591595913103, 'EX_cpd00793_e0': 0.00028061591595913103, 'EX_cpd00104_e0': 0.0002806159159591311, 'EX_cpd00030_e0': 0.00028061591595913103, 'EX_cpd00065_e0': 0.004720191914502181, 'EX_cpd00051_e0': 0.024669682270134108}}, 'Sphingobium_sp._AP49_2512564014.fna.RAST.fbamodel': {'media': {'EX_cpd00136_e0': 0.00028061591595913044, 'EX_cpd00058_e0': 0.000280615915959131, 'EX_cpd00794_e0': 0.23177487666981836, 'EX_cpd00028_e0': 0.000280615915959131, 'EX_cpd00156_e0': 0.03522331890916251, 'EX_cpd00644_e0': 0.0005612318318995885, 'EX_cpd00322_e0': 0.02417985103368549, 'EX_cpd00654_e0': 0.0011789605965904404, 'EX_cpd00099_e0': 0.00028061591595913103, 'EX_cpd00069_e0': 0.012067660460661201, 'EX_cpd00048_e0': 0.000280615915959131, 'EX_cpd10515_e0': 0.0008418477478773931, 'EX_cpd00254_e0': 0.00028061591595913103, 'EX_cpd00063_e0': 0.0002806159159591311, 'EX_cpd00009_e0': 0.08097478546698383, 'EX_cpd00107_e0': 0.037538884754012715, 'EX_cpd00066_e0': 0.015451949003134503, 'EX_cpd00039_e0': 0.0285438020490179, 'EX_cpd00205_e0': 0.000280615915959131, 'EX_cpd00119_e0': 0.16897710575033004, 'EX_cpd00264_e0': 0.0002806159159591311, 'EX_cpd00220_e0': 0.0008418477478773931, 'EX_cpd00149_e0': 0.00028061591595913103, 'EX_cpd01080_e0': 0.024916275954454083, 'EX_cpd00017_e0': 0.001964311411713915, 'EX_cpd00118_e0': 0.0002806159159591311, 'EX_cpd00007_e0': 1.174152832128853, 'EX_cpd00060_e0': 0.011096446763321919, 'EX_cpd00393_e0': 0.0008418477478774118, 'EX_cpd00277_e0': 0.0020247366767531506, 'EX_cpd00215_e0': 0.00028061591595913103, 'EX_cpd00034_e0': 0.0002806159159591311, 'EX_cpd00793_e0': 0.00028061591595913103, 'EX_cpd00104_e0': 0.000280615915959131, 'EX_cpd00030_e0': 0.0002806159159591311, 'EX_cpd03847_e0': 0.0025010597710894396, 'EX_cpd00051_e0': 0.0246696822701341, 'EX_cpd00065_e0': 0.004720191914502182, 'EX_cpd01017_e0': 0.008456496968423561}}, 'Pseudomonas_sp._GM17_2511231006.fna.RAST.fbamodel': {'media': {'EX_cpd00136_e0': 0.00028061591595913103, 'EX_cpd00058_e0': 0.00028061591595913103, 'EX_cpd00028_e0': 0.00028061591595913103, 'EX_cpd00156_e0': 0.035223318909420306, 'EX_cpd00644_e0': 0.0005612318319182638, 'EX_cpd00322_e0': 0.0241798510337235, 'EX_cpd00654_e0': 0.005215640721434261, 'EX_cpd00099_e0': 0.00028061591595913103, 'EX_cpd00069_e0': 0.012067660460661201, 'EX_cpd00048_e0': 0.00028061591595913103, 'EX_cpd10515_e0': 0.0008418477478773932, 'EX_cpd00254_e0': 0.00028061591595913103, 'EX_cpd00063_e0': 0.0002806159159591311, 'EX_cpd00209_e0': 0.4476081635840533, 'EX_cpd00107_e0': 0.03753888475401271, 'EX_cpd00066_e0': 0.015451949003134503, 'EX_cpd00205_e0': 0.00028061591595913103, 'EX_cpd00119_e0': 0.007926360007371592, 'EX_cpd00264_e0': 0.00028061591595913103, 'EX_cpd00220_e0': 0.0008418477478773932, 'EX_cpd00149_e0': 0.00028061591595913103, 'EX_cpd01080_e0': 0.024916275954454087, 'EX_cpd00355_e0': 1.1842235631384532, 'EX_cpd00017_e0': 0.013060758175035835, 'EX_cpd00179_e0': 0.06274188137472217, 'EX_cpd00007_e0': 0.0008418477478773933, 'EX_cpd00393_e0': 0.0008418477478773844, 'EX_cpd00438_e0': 0.0011917803122624656, 'EX_cpd00307_e0': 0.008410361565448637, 'EX_cpd00215_e0': 0.00028061591595913103, 'EX_cpd00034_e0': 0.00028061591595913103, 'EX_cpd00793_e0': 0.000280615915959131, 'EX_cpd00104_e0': 0.00028061591595913103, 'EX_cpd00030_e0': 0.0002806159159591311, 'EX_cpd03847_e0': 0.002501059771089441, 'EX_cpd00051_e0': 0.0246696822701341, 'EX_cpd00065_e0': 0.00472019191450218, 'EX_cpd00311_e0': 0.01519312329593317, 'EX_cpd01017_e0': 0.008456496968442235}}}\n",
"\n",
"Examining the 3 model pairs\n",
"Loading 32 workers and computing the scores 2023-06-25 08:47:10.019986\n"
"cpd11416_c0 bio1: 0.5 cpd11416_c1 + 0.5 cpd11416_c2 --> cpd11416_c0;\tcpd11416_c0 SK_cpd11416_c0: cpd11416_c0 <=> ;\tMainProcess~~0\t['Variovorax_sp._CF313_2513020051.fna.RAST.fbamodel', 'Sphingobium_sp._AP49_2512564014.fna.RAST.fbamodel']\n",
"cpd11416_c0 bio1: 0.5 cpd11416_c1 + 0.5 cpd11416_c2 --> cpd11416_c0;\tcpd11416_c0 SK_cpd11416_c0: cpd11416_c0 <=> ;\tMainProcess~~1\t['Variovorax_sp._CF313_2513020051.fna.RAST.fbamodel', 'Pseudomonas_sp._GM17_2511231006.fna.RAST.fbamodel']\n",
"cpd11416_c0 bio1: 0.5 cpd11416_c1 + 0.5 cpd11416_c2 --> cpd11416_c0;\tcpd11416_c0 SK_cpd11416_c0: cpd11416_c0 <=> ;\tMainProcess~~2\t['Sphingobium_sp._AP49_2512564014.fna.RAST.fbamodel', 'Pseudomonas_sp._GM17_2511231006.fna.RAST.fbamodel']\n"
]
},
{
Expand Down Expand Up @@ -81,6 +83,8 @@
" <th>mip_model1</th>\n",
" <th>mip_model2</th>\n",
" <th>pc</th>\n",
" <th>bss_model0</th>\n",
" <th>bss_model1</th>\n",
" <th>bit</th>\n",
" <th>gyd</th>\n",
" <th>RFC</th>\n",
Expand All @@ -89,73 +93,79 @@
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Pseudomonas_sp._GM17_2511231006.fna.RAST.fbamodel</td>\n",
" <td>Variovorax_sp._CF313_2513020051.fna.RAST.fbamodel</td>\n",
" <td>Sphingobium_sp._AP49_2512564014.fna.RAST.fbamodel</td>\n",
" <td>R2A_edition_003</td>\n",
" <td>0.84615 (33/39)</td>\n",
" <td>0.84615 (33/39)</td>\n",
" <td>24</td>\n",
" <td>2 (1)</td>\n",
" <td>10 (3)</td>\n",
" <td>0.60797</td>\n",
" <td>amensalism</td>\n",
" <td>0.16283</td>\n",
" <td>0.30420</td>\n",
" <td>0.85294 (29/34)</td>\n",
" <td>0.74359 (29/39)</td>\n",
" <td>23</td>\n",
" <td>3 (1)</td>\n",
" <td>12 (5)</td>\n",
" <td>0.640966</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>mutualism</td>\n",
" <td>0.71279</td>\n",
" <td>0.35061</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Pseudomonas_sp._GM17_2511231006.fna.RAST.fbamodel</td>\n",
" <td>Variovorax_sp._CF313_2513020051.fna.RAST.fbamodel</td>\n",
" <td>Pseudomonas_sp._GM17_2511231006.fna.RAST.fbamodel</td>\n",
" <td>R2A_edition_003</td>\n",
" <td>0.91176 (31/34)</td>\n",
" <td>0.79487 (31/39)</td>\n",
" <td>0.88571 (31/35)</td>\n",
" <td>22</td>\n",
" <td>5 (0)</td>\n",
" <td>7 (3)</td>\n",
" <td>0.763488</td>\n",
" <td>competitive</td>\n",
" <td>20</td>\n",
" <td>1 (0)</td>\n",
" <td>3 (0)</td>\n",
" <td>0.939003</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>mutualism</td>\n",
" <td>0.47295</td>\n",
" <td>0.42291</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Sphingobium_sp._AP49_2512564014.fna.RAST.fbamodel</td>\n",
" <td>Variovorax_sp._CF313_2513020051.fna.RAST.fbamodel</td>\n",
" <td>Pseudomonas_sp._GM17_2511231006.fna.RAST.fbamodel</td>\n",
" <td>R2A_edition_003</td>\n",
" <td>0.74359 (29/39)</td>\n",
" <td>0.82857 (29/35)</td>\n",
" <td>23</td>\n",
" <td>11 (5)</td>\n",
" <td>7 (0)</td>\n",
" <td>0.640966</td>\n",
" <td>0.84615 (33/39)</td>\n",
" <td>0.84615 (33/39)</td>\n",
" <td>13</td>\n",
" <td>2 (0)</td>\n",
" <td>2 (0)</td>\n",
" <td>0.921067</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>amensalism</td>\n",
" <td>0.71279</td>\n",
" <td>0.35061</td>\n",
" <td>0.16283</td>\n",
" <td>0.30420</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" model1 \\\n",
"0 Pseudomonas_sp._GM17_2511231006.fna.RAST.fbamodel \n",
"1 Pseudomonas_sp._GM17_2511231006.fna.RAST.fbamodel \n",
"0 Variovorax_sp._CF313_2513020051.fna.RAST.fbamodel \n",
"1 Variovorax_sp._CF313_2513020051.fna.RAST.fbamodel \n",
"2 Sphingobium_sp._AP49_2512564014.fna.RAST.fbamodel \n",
"\n",
" model2 media \\\n",
"0 Sphingobium_sp._AP49_2512564014.fna.RAST.fbamodel R2A_edition_003 \n",
"1 Variovorax_sp._CF313_2513020051.fna.RAST.fbamodel R2A_edition_003 \n",
"2 Variovorax_sp._CF313_2513020051.fna.RAST.fbamodel R2A_edition_003 \n",
"1 Pseudomonas_sp._GM17_2511231006.fna.RAST.fbamodel R2A_edition_003 \n",
"2 Pseudomonas_sp._GM17_2511231006.fna.RAST.fbamodel R2A_edition_003 \n",
"\n",
" mro_model1 mro_model2 cip mip_model1 mip_model2 pc \\\n",
"0 0.84615 (33/39) 0.84615 (33/39) 24 2 (1) 10 (3) 0.60797 \n",
"1 0.79487 (31/39) 0.88571 (31/35) 22 5 (0) 7 (3) 0.763488 \n",
"2 0.74359 (29/39) 0.82857 (29/35) 23 11 (5) 7 (0) 0.640966 \n",
"0 0.85294 (29/34) 0.74359 (29/39) 23 3 (1) 12 (5) 0.640966 \n",
"1 0.91176 (31/34) 0.79487 (31/39) 20 1 (0) 3 (0) 0.939003 \n",
"2 0.84615 (33/39) 0.84615 (33/39) 13 2 (0) 2 (0) 0.921067 \n",
"\n",
" bit gyd RFC \n",
"0 amensalism 0.16283 0.30420 \n",
"1 competitive 0.47295 0.42291 \n",
"2 amensalism 0.71279 0.35061 "
" bss_model0 bss_model1 bit gyd RFC \n",
"0 0.0 0.0 mutualism 0.71279 0.35061 \n",
"1 0.0 0.0 mutualism 0.47295 0.42291 \n",
"2 0.0 0.0 amensalism 0.16283 0.30420 "
]
},
"metadata": {},
Expand All @@ -166,8 +176,16 @@
"%run ../../../modelseedpy/community/mscommscores.py\n",
"\n",
"from os import cpu_count\n",
"display(MSCommScores.kbase_output([model1, model2, model3], kbase_obj=kbase_api, environments=environments, pool_size=cpu_count()/2)[0])"
"display(MSCommScores.kbase_output([model1, model2, model3], kbase_obj=kbase_api, environments=environments)[0]) #, pool_size=cpu_count()/2)[0])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b9bb7da2-cc19-439a-b692-27ea6e1ccebf",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
Loading

0 comments on commit 0edd988

Please sign in to comment.