Skip to content

Commit

Permalink
CommScores upates and associated edits
Browse files Browse the repository at this point in the history
  • Loading branch information
freiburgermsu committed Aug 23, 2023
1 parent 9863aaa commit 2e7f999
Show file tree
Hide file tree
Showing 19 changed files with 672,985 additions and 30 deletions.
4 changes: 2 additions & 2 deletions docs/source/community/mssmetana_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ All of the defined scores can be simulated on the initalized community system th
--------------------------
kbase_output()
report_generation()
--------------------------

The scores can be calculated over a large range of models, either for specified pairs or for all combinations of all models. This process can be expedited with optional parallelization. This function is a **Staticmethod**, and therefore cannot access any content that is loaded in the class object of the aforementioned functions.

.. code-block:: python
scores_df, mets = mssmet.kbase_output(all_models:iter=None, pairs:dict=None, mem_media:dict=None,
scores_df, mets = mssmet.report_generation(all_models:iter=None, pairs:dict=None, mem_media:dict=None,
pair_limit:int=None, exclude_pairs:list=None, kbase_obj=None,
RAST_genomes:dict=None, see_media:bool=True,
environment:Union[dict]=None, # can be KBase media object
Expand Down
167 changes: 149 additions & 18 deletions examples/Community Modeling/smetana/Vorholt_replication.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20212,8 +20212,7 @@
"metadata": {
"collapsed": true,
"jupyter": {
"outputs_hidden": true,
"source_hidden": true
"outputs_hidden": true
},
"tags": []
},
Expand Down Expand Up @@ -20296,9 +20295,6 @@
"execution_count": null,
"id": "65543502-d39f-4e78-b473-e86d71db1f2f",
"metadata": {
"jupyter": {
"source_hidden": true
},
"tags": []
},
"outputs": [],
Expand All @@ -20316,8 +20312,7 @@
"metadata": {
"collapsed": true,
"jupyter": {
"outputs_hidden": true,
"source_hidden": true
"outputs_hidden": true
},
"tags": []
},
Expand All @@ -20344,8 +20339,7 @@
"metadata": {
"collapsed": true,
"jupyter": {
"outputs_hidden": true,
"source_hidden": true
"outputs_hidden": true
},
"scrolled": true,
"tags": []
Expand Down Expand Up @@ -20433,8 +20427,7 @@
"metadata": {
"collapsed": true,
"jupyter": {
"outputs_hidden": true,
"source_hidden": true
"outputs_hidden": true
},
"tags": []
},
Expand Down Expand Up @@ -20505,9 +20498,6 @@
"execution_count": null,
"id": "d11948bf-23e9-4ad6-94d7-62e0ee5f1c86",
"metadata": {
"jupyter": {
"source_hidden": true
},
"tags": []
},
"outputs": [],
Expand Down Expand Up @@ -20548,9 +20538,6 @@
"execution_count": 2,
"id": "ea3ed9e3-db56-4543-b29e-a342e40b5a05",
"metadata": {
"jupyter": {
"source_hidden": true
},
"tags": []
},
"outputs": [],
Expand Down Expand Up @@ -20624,6 +20611,129 @@
"GCF_001422185 = kbase_api.get_from_ws(\"154981/95/1\") ; GCF_001421235 = kbase_api.get_from_ws(\"154981/85/1\") ; GCF_001423565 = kbase_api.get_from_ws(\"154981/84/1\")"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "6fbc94e8-87b3-4212-8fe3-9ef2cca343af",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"# from cobra.io import write_sbml_model\n",
"# from os import path\n",
"\n",
"# for model in MSmodels:\n",
"# write_sbml_model(model, path.join(\"vorholt models\", model.id))"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "d775718f-e98b-4e04-a3e9-1c3f3276a1d8",
"metadata": {
"collapsed": true,
"jupyter": {
"outputs_hidden": true
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"{'EX_cpd03424_e0': 1000,\n",
" 'EX_cpd00215_e0': 1000,\n",
" 'EX_cpd00028_e0': 1000,\n",
" 'EX_cpd10515_e0': 1000,\n",
" 'EX_cpd00030_e0': 1000,\n",
" 'EX_cpd00149_e0': 1000,\n",
" 'EX_cpd00058_e0': 1000,\n",
" 'EX_cpd00099_e0': 1000,\n",
" 'EX_cpd00007_e0': 1000,\n",
" 'EX_cpd00034_e0': 1000,\n",
" 'EX_cpd00156_e0': 1000,\n",
" 'EX_cpd00249_e0': 1000,\n",
" 'EX_cpd00092_e0': 1000,\n",
" 'EX_cpd00069_e0': 1000,\n",
" 'EX_cpd00065_e0': 1000,\n",
" 'EX_cpd00184_e0': 1000,\n",
" 'EX_cpd00161_e0': 1000,\n",
" 'EX_cpd00048_e0': 1000,\n",
" 'EX_cpd00054_e0': 1000,\n",
" 'EX_cpd00220_e0': 1000,\n",
" 'EX_cpd00129_e0': 1000,\n",
" 'EX_cpd00644_e0': 1000,\n",
" 'EX_cpd00009_e0': 1000,\n",
" 'EX_cpd00066_e0': 1000,\n",
" 'EX_cpd00218_e0': 1000,\n",
" 'EX_cpd00971_e0': 1000,\n",
" 'EX_cpd00254_e0': 1000,\n",
" 'EX_cpd00060_e0': 1000,\n",
" 'EX_cpd00039_e0': 1000,\n",
" 'EX_cpd00107_e0': 1000,\n",
" 'EX_cpd00205_e0': 1000,\n",
" 'EX_cpd00246_e0': 1000,\n",
" 'EX_cpd00322_e0': 1000,\n",
" 'EX_cpd00226_e0': 1000,\n",
" 'EX_cpd00119_e0': 1000,\n",
" 'EX_cpd00531_e0': 1000,\n",
" 'EX_cpd00001_e0': 1000,\n",
" 'EX_cpd00067_e0': 1000,\n",
" 'EX_cpd00033_e0': 1000,\n",
" 'EX_cpd00023_e0': 1000,\n",
" 'EX_cpd00027_e0': 1000,\n",
" 'EX_cpd00393_e0': 1000,\n",
" 'EX_cpd10516_e0': 1000,\n",
" 'EX_cpd00654_e0': 1000,\n",
" 'EX_cpd00438_e0': 1000,\n",
" 'EX_cpd00381_e0': 1000,\n",
" 'EX_cpd11595_e0': 1000,\n",
" 'EX_cpd01012_e0': 1000,\n",
" 'EX_cpd00063_e0': 1000,\n",
" 'EX_cpd00041_e0': 1000,\n",
" 'EX_cpd01048_e0': 1000,\n",
" 'EX_cpd00051_e0': 1000,\n",
" 'EX_cpd00035_e0': 1000,\n",
" 'EX_cpd00182_e0': 1000,\n",
" 'EX_cpd00311_e0': 1000,\n",
" 'EX_cpd00126_e0': 1000,\n",
" 'EX_cpd00018_e0': 1000,\n",
" 'EX_cpd00091_e0': 1000,\n",
" 'EX_cpd00046_e0': 1000,\n",
" 'EX_cpd00793_e0': 1000,\n",
" 'EX_cpd00541_e0': 1000,\n",
" 'EX_cpd00239_e0': 1000,\n",
" 'EX_cpd00013_e0': 1000,\n",
" 'EX_cpd00244_e0': 1000,\n",
" 'EX_cpd11574_e0': 1000,\n",
" 'EX_cpd00020_e0': 1000,\n",
" 'EX_cpd11657_e0': 1000,\n",
" 'EX_cpd00116_e0': 1000}"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# r2a_methanol_media = FBAHelper.convert_kbase_media(kbase_api.get_from_ws(\"154981/21/1\"), 1000)\n",
"# r2a_methanol_media"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f32e9eb7-397b-4a99-9c96-e5a871eb7d57",
"metadata": {},
"outputs": [],
"source": [
"%run ../../../modelseedpy/community/mscommunity.py\n",
"\n",
"CommScores.report_generation([GCF_001424595, GCF_001421165], environments)"
]
},
{
"cell_type": "code",
"execution_count": 4,
Expand Down Expand Up @@ -20669,6 +20779,27 @@
" print(mem.id)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "00013c7a-347d-4aac-8ac1-3a1f5f11dd9c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.0"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"GCF_001423785.slim_optimize()"
]
},
{
"cell_type": "code",
"execution_count": 6,
Expand Down Expand Up @@ -20722,7 +20853,7 @@
"source": [
"%run ../../../modelseedpy/community/commscores.py\n",
"# from modelseedpy import MSCompatibility\n",
"df, mets = CommScores.kbase_output(MSmodels, environments=kbase_api.get_from_ws(\"154981/21/1\"), kbase_obj=kbase_api, annotated_genomes=True, skip_bad_media=True, print_progress=True) #, pool_size=cpu_count()/2)[0])\n",
"df, mets = CommScores.report_generation(MSmodels, environments=kbase_api.get_from_ws(\"154981/21/1\"), kbase_obj=kbase_api, annotated_genomes=True, skip_bad_media=True, print_progress=True) #, pool_size=cpu_count()/2)[0])\n",
"\n",
"from pprint import pprint\n",
"display(df)\n",
Expand Down
Loading

0 comments on commit 2e7f999

Please sign in to comment.