-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Problem description
I'm working with MICOM 0.37.1 to simulate anaerobic growth in a microbial community. The community is constructed from .xml models exported from ModelSEED (via KBase), using compartments c0 and e0. I manually converted all exchange reactions to follow the MICOM convention: EX_xxx_m.
My goal was to:
- Apply a custom anaerobic medium (filtered from
minimal_medium()by removing oxygen and adding CO₂, H₂, etc.) - Evaluate MAG-level growth using
slim_optimize()on each individual model before runningcooperative_tradeoff()
However, I encountered multiple problems:
Observed output
- Some models raise the following error: '' is not a valid SBML 'SId'.
This appears to happen when the SBML file has elements with empty IDs, possibly caused by export or post-processing errors. MICOM fails when applying the medium to these models.
-
I also get repeated warnings like:
Since my models use_mas the external compartment, this suggests MICOM/Cobra can't reliably detect it without manual.compartmentsassignment. -
When applying the anaerobic medium:
- Some models raise
KeyError: 'EX_cpd00305_m'(exchange not found in the model) - Others return
nanfromslim_optimize(), even when the medium is filtered to contain only compatible exchanges.
Expected behavior:
- MICOM should provide a more fault-tolerant way to assign media (e.g., ignore missing reactions with a warning)
- External compartments should be clearly detectable or definable
- There could be a utility to pre-validate models before community construction
Code Sample
from cobra.io import read_sbml_model
import os
custom_medium = {
"EX_cpd00027_m": -10,
"EX_cpd00029_m": -10,
"EX_cpd00011_m": -10,
"EX_cpd11640_m": -10,
"EX_cpd00013_m": -10,
"EX_cpd00009_m": -10,
"EX_cpd00048_m": -10,
}
carpeta_modelos = "/ruta/a/modelos"
crecimientos = {}
for archivo in os.listdir(carpeta_modelos):
if archivo.endswith(".xml"):
modelo = read_sbml_model(os.path.join(carpeta_modelos, archivo))
# Filter medium
reacciones_disponibles = {rxn.id for rxn in modelo.exchanges}
medio_filtrado = {k: v for k, v in custom_medium.items() if k in reacciones_disponibles}
# Apply and test
modelo.medium = medio_filtrado
tasa = modelo.slim_optimize()
crecimientos[archivo] = tasa
'' is not a valid SBML 'SId'.
Could not identify an external compartment by name and choosing one with the most boundary reactions.
KeyError: 'EX_cpd00305_m'
python -c "import micom; micom.show_versions()"
System
------
Platform: Ubuntu 24.04 lts
Python: 3.10.x
Micom: 0.37.1
COBRApy: 0.25.x
optlang: 1.6.x
Solver: gurobi (academic license).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels