cdanielmachado / smetana

SMETANA: a tool to analyse interactions in microbial communities
Other
56 stars 11 forks source link

"Reaction R_EX_M_h2o_e_pool not found" error #23

Open jdwinkler-lanzatech opened 3 years ago

jdwinkler-lanzatech commented 3 years ago

Hi,

I'm trying to run SMETANA on a collection of Gapseq generated models using the following settings:

No specified media. When I attempt to run the analysis, I get the following error:

Traceback (most recent call last):
  File "C:/repos/lt-community-modeling/communities/generate_report_artifacts.py", line 1127, in <module>
    threads=2)
  File "C:/repos/lt-community-modeling/communities/generate_report_artifacts.py", line 1098, in execute_site_analysis
    output_directory=os.path.join(output_base_directory, 'smetana'))
  File "C:\repos\lt-community-modeling\communities\consortia\analysis\smetana_analysis.py", line 167, in run_smetana_analysis
    aerobic=False,)
  File "C:\repos\lt-community-modeling\venv\lib\site-packages\smetana\interface.py", line 360, in main
    medium_id, env = define_environment(medium, media_db, community, mode, aerobic, verbose, min_mol_weight, use_lp)
  File "C:\repos\lt-community-modeling\venv\lib\site-packages\smetana\interface.py", line 127, in define_environment
    use_lp=use_lp, max_uptake=max_uptake)
  File "C:\repos\lt-community-modeling\venv\lib\site-packages\smetana\smetana.py", line 380, in minimal_environment
    community.merged.set_flux_bounds("R_EX_M_h2o_e_pool", -inf, inf)
  File "C:\repos\lt-community-modeling\venv\lib\site-packages\reframed\core\cbmodel.py", line 353, in set_flux_bounds
    raise KeyError(f"Reaction {r_id} not found")
KeyError: 'Reaction R_EX_M_h2o_e_pool not found'

I gather that this error is occurring because of a missing reaction in the synthesized community model, but I am unsure how to fix it. Do you have any suggestions about the possible root cause and what I can change on my end? I can specify a media to avoid this issue if necessary.

cdanielmachado commented 3 years ago

I guess the models created with gapseq do not include a water exchange reaction.

I created a quick fix in reframed so it will ignore that case. You will need to update directly from the repository.

pip uninstall reframed
pip install https://github.com/cdanielmachado/reframed/archive/refs/heads/master.zip

Please let me know if this works.

jdwinkler-lanzatech commented 3 years ago

Thanks. I'll give it a shot when I'm back from holiday next week.

Just FYI, the H2O exchange reaction in Gapseq is "R_EX_cpd00001_e0" in the models, so could be a detection heuristic issue?

jdwinkler-lanzatech commented 3 years ago

The new version of reframed seems to work, thanks! I mostly get N/A for MIP predictions, but I'll play around with it more.