Comments (12)
Hmm, I just tried with a model I had laying around and it did work:
In [1]: import micom as mm
In [2]: com = mm.load_pickle("A1.pickle")
In [3]: med = mm.qiime_formats.load_qiime_medium("/home/cdiener/Downloads/vmh_high_fat_low_carb_agora.qza")
In [4]: med
Out[4]:
reaction metabolite global_id flux
reaction
EX_ala_L_m EX_ala_L_m ala_L_m EX_ala_L(e) 3.519601
EX_arg_L_m EX_arg_L_m arg_L_m EX_arg_L(e) 1.873749
EX_asp_L_m EX_asp_L_m asp_L_m EX_asp_L(e) 4.159954
EX_btn_m EX_btn_m btn_m EX_btn(e) 0.000100
EX_ca2_m EX_ca2_m ca2_m EX_ca2(e) 1.677521
... ... ... ... ...
EX_gsn_m EX_gsn_m gsn_m EX_gsn(e) 0.000148
EX_nadp_m EX_nadp_m nadp_m EX_nadp(e) 0.000003
EX_urea_m EX_urea_m urea_m EX_urea(e) 0.084613
EX_dgsn_m EX_dgsn_m dgsn_m EX_dgsn(e) 0.000167
EX_nmn_m EX_nmn_m nmn_m EX_nmn(e) 0.000529
[122 rows x 4 columns]
In [5]: com.medium = med.flux
[12:52:00] WARNING I could not find the following exchanges in your model: EX_cmp_m, EX_amet_m community.py:668
In [6]: sol = com.cooperative_tradeoff(fraction=0.5)
In [7]: sol
Out[7]: <CommunitySolution 0.003 at 0x7fa6d5af9130>
The following info would be helpful:
- Are you using the genus-level for your models?
- Did you download the diet recently?
- What solver are you using?
from media.
- I am using strain level AGORA models.
- The most recent time I downloaded the diet was today.
- CPLEX
Update:
I tried with a genus-level model for the same sample and am able to successful simulate the community. I also tried the complete_db_medium to make sure all the strain-level agora models could grow, but ran into the same error with cooperative_tradeoff.
from media.
Yeah, the media are only completed on the genus level. Probably better to do it on the strain level. I will switch to this strategy. complete_db_medium
should work with the strain level. What output do you get from complete_db_medium
with the strain models? Especially, manifest.can_grow.value_counts()
? If you get taxa without growth there you might have to increase the basic fluxes in the template medium before filling in gaps.
This medium is definitely complicated though since it simply does not contain enough carbon sources for Bacteria to grow. I'm also planning to add in mucin to alleviate this a bit.
from media.
manifest.can_grow.value_counts() True 815 False 3 Name: can_grow, dtype: int64
from media.
That doesn't look too bad though. Can you paste the code you are using to complete the strain medium and use it?
from media.
I am starting with the current qiime medium available on this repo.
`
from micom.qiime_formats import load_qiime_medium
medium = load_qiime_medium('vmh_high_fat_low_carb_agora.qza')
from micom.workflows.db_media import complete_db_medium
manifest, imports = complete_db_medium("AGORA-with-MUCINS.zip", medium, growth=1e-4,
threads=59, max_added_import=10, weights="C")
import pandas as pd
fluxes = imports.max()
fluxes = fluxes[(fluxes > 1e-6) | fluxes.index.isin(medium.reaction)]
completed = pd.DataFrame({
"reaction": fluxes.index,
"metabolite": fluxes.index.str.replace("^EX_", "", regex=True),
"global_id": fluxes.index.str.replace("_m$", "(e)", regex=True),
"flux": fluxes
})
from qiime2 import Artifact
arti = Artifact.import_data("MicomMedium[Global]", completed)
arti.save("vmh_high_fat_low_carb_strain.qza")
To grow the samples:
medium = load_qiime_medium('vmh_high_fat_low_carb_strain.qza')
growth_results = grow(manifest=manifest, model_folder='sample_models', medium=medium, threads=59, tradeoff=0.5)
`
from media.
I see. It looks like "AGORA-with-MUCINS.zip" is the AGORA file downloaded from VMH. This is by itself not a valid MICOM model database so I'm pretty sure the problem lies there. MICOM model databases are the ones that you can download from https://zenodo.org/record/3755182 or one that was created using build_database
. It's definitely a bug in MICOM though since it should have detected that and complained.
The completed medium looks okay though. Hard to say what the problem is without seeing the actual models. This should only happen if the strains in your community are exactly the strains that could not grow in the optimization. How many strains are there for each model? Numerical issues usually get worse the larger the model gets, though we have run a few models with 100+ taxa and it usually worked...
from media.
The "AGORA-with-MUCINS.zip" was built with MICOM's build_database
.
The samples have on average 55 strains (max of 109) in each model. It doesn't look like the number of strains matched in the sample correlates with whether the optimization fails or not. Is there a way I could send a few samples that the optimization is failing? I am unable to attach them here.
from media.
Ah, that makes more sense. Definitely, you can send me the file or a Google drive link to mail (a) cdiener.com
. A pickle for a single sample that fails is probably enough.
from media.
Thanks for the models. I checked them and surprisingly some of the AGORA models have demand reactions and since those can't be fulfilled in low nutrient conditions you get the infeasibility. So no numerical issues, the models were indeed infeasible 😅 For instance, for sample 1, the following fixes the issue:
com.reactions.DM_btn__Faecalibacterium_prausnitzii_M21_2.lower_bound = 0
com.reactions.get_by_id("DM_thmpp(c)__Lactobacillus_fermentum_ATCC_14931").lower_bound = 0
This should be addressed in MICOM by adjusting those bounds. Having growth rate-independent demands is not good practice, This can also trip up complete_medium, so this should also work better after that. Hopefully, I'll find some time to get to this soon.
from media.
Thank you! I am now able to simulate all my samples by looking for reactions with positive lower bounds or negative upper bounds and changing the bounds to 0.
from media.
Awesome, looks like this was the issue then.
Now tracked in micom-dev/micom#56
from media.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from media.