cdanielmachado / carveme

CarveMe: genome-scale metabolic model reconstruction
Other
145 stars 49 forks source link

Building Universal model using Alternative Biomass reactions #116

Closed jccvila closed 3 years ago

jccvila commented 3 years ago

Hi Daniel

I'm having some issues with building alternative universal models using CARVEME (such as with the alternative biomass reactions). If i run

build_universe --curated

I get the following error


  File "/home/jean/yes/envs/carveme/bin/build_universe", line 8, in <module>
    sys.exit(main())
  File "/home/jean/yes/envs/carveme/lib/python3.6/site-packages/carveme/cli/build_universe.py", line 207, in main
    outputfile=args.output)
  File "/home/jean/yes/envs/carveme/lib/python3.6/site-packages/carveme/cli/build_universe.py", line 76, in maincall
    model = load_cbmodel(universe_draft, flavor=config.get('sbml', 'default_flavor'))
  File "/home/jean/yes/envs/carveme/lib/python3.6/site-packages/reframed/io/sbml.py", line 148, in load_cbmodel
    load_metabolites(sbml_model, model, flavor, load_metadata)
  File "/home/jean/yes/envs/carveme/lib/python3.6/site-packages/reframed/io/sbml.py", line 220, in load_metabolites
    model.add_metabolite(load_metabolite(species, flavor, load_metadata=load_metadata))
  File "/home/jean/yes/envs/carveme/lib/python3.6/site-packages/reframed/io/sbml.py", line 228, in load_metabolite
    if fbc_species.isSetChemicalFormula():
AttributeError: 'NoneType' object has no attribute 'isSetChemicalFormula'```

Think everything is using the correct version. Have tried going line by line through your code, but have not yet come up with a quick fix.
cdanielmachado commented 3 years ago

Sorry, this happens because I changed the default SBML format to the new FBC2 but the universal model is still in the old COBRA legacy format.

Do you want to build your own biomass equation? If you just want to change to one of the available ones (gram positive, gram negative, or cyanobacteria) you don't need to build a new universe.

jccvila commented 3 years ago

Yeah i'd like to use alternative biomass reactions present in previously published models (such as iJO1366 or iJN1463), rather than the ones currently available.

cdanielmachado commented 3 years ago

You can find the config.cfg file inside the carveme installation folder (somewhere inside your python packages) and change the following:

[sbml]
default_flavor = bigg

Replace bigg with cobra.

If it doesn't work, please let me know.

jccvila commented 3 years ago

So that gave me a different bug.

/home/jean/yes/envs/carveme/lib/python3.6/site-packages/reframed/io/sbml.py:169: UserWarning: Exchange reactions were not detected.
  warn("Exchange reactions were not detected.")
Starting universe curation...
(initial size: 9163 x 13959)

Filtering by taxa: bacteria
Traceback (most recent call last):
  File "/home/jean/yes/envs/carveme/bin/build_universe", line 8, in <module>
    sys.exit(main())
  File "/home/jean/yes/envs/carveme/lib/python3.6/site-packages/carveme/cli/build_universe.py", line 207, in main
    outputfile=args.output)
  File "/home/jean/yes/envs/carveme/lib/python3.6/site-packages/carveme/cli/build_universe.py", line 117, in maincall
    remove_blocked=(not allow_blocked))
  File "/home/jean/yes/envs/carveme/lib/python3.6/site-packages/carveme/universe/curation.py", line 341, in curate_universe
    model.remove_compartments(other_compartments, delete_metabolites=True, delete_reactions=True)
TypeError: remove_compartments() got an unexpected keyword argument 'delete_metabolites'

Is reframed maybe using a different sbml format?

cdanielmachado commented 3 years ago

Hello,

Sorry for the late reply. Can you uninstall carveme and reframed and install the latest versions?

Please let me know if this solves your problem.

cdanielmachado commented 3 years ago

By the way, the syntax has changed a bit, the command is now called curate_universe.

To specify your own biomass, please run:

curate_universe --biomass [biomass id] --biomass-db [filename]

The biomass file should have a format similar to this one.

jccvila commented 3 years ago

Thanks a lot. I saw the update and seems like some big changes. Thanks alot for the work on this. I still hit a bugs with curate_universe but i'll see if i can get it to work in the new package.

Am i correct in thinking that you've removed the 'component contribution' step in the pipeline for building universal models and are just using the heuristics? I think this make sense, but just want to confirm.

cdanielmachado commented 3 years ago

That is correct. I tried different approaches to automatically integrate thermodynamics data but they all had limitations. In the end, I used dG0 values (calculated with eQuilibrator) to curate some problematic reactions, but this was a manual process.