biosustain / cameo

cameo - computer aided metabolic engineering & optimization
http://cameo.bio
Apache License 2.0
114 stars 44 forks source link

Some pathway predictions result in an infinite loop #249

Open kvikshaug opened 5 years ago

kvikshaug commented 5 years ago

Steps to reproduce:

  1. Download iJO1366.json into the working directory
  2. Run the following script with cameo 0.11.15. It looks for pathways to ATP in iJO1366.
from cameo.models.universal import metanetx_universal_model_bigg_rhea
import cameo
import cameo.api
import cobra

# To get a bit of log output
logging.config.dictConfig({"version": 1, "disable_existing_loggers": False, "formatters": {"simple": {"format": "[%(levelname)s] [%(name)s] ""%(message)s"} }, "handlers": {"console": {"level": "DEBUG", "class": "logging.StreamHandler", "formatter": "simple", } }, "root": {"level": "DEBUG", "handlers": ["console"]}, })

product = metanetx_universal_model_bigg_rhea.metabolites.MNXM3  # ATP
model = cobra.io.load_json_model("iJO1366.json")
predictor = cameo.strain_design.pathway_prediction.PathwayPredictor(model, universal_model=metanetx_universal_model_bigg_rhea)
result = predictor.run(product, max_predictions=1, timeout=120)

Result:

/usr/local/lib/python3.6/site-packages/cameo/visualization/plotting/__init__.py:52 UserWarning: Cannot import any plotting library. Please install one of 'plotly', 'bokeh' or 'ggplot' if you want to use any plotting function.
[DEBUG] [cameo.io] Reading file from /usr/local/lib/python3.6/site-packages/cameo/models/universal_models/metanetx_universal_model_bigg_rhea.json assuming pickled model.
[DEBUG] [cameo.io] Cannot unpickle /usr/local/lib/python3.6/site-packages/cameo/models/universal_models/metanetx_universal_model_bigg_rhea.json. Assuming json model next.
[INFO] [cameo.strain_design.pathway_prediction.pathway_predictor] Trying to set solver to cplex to speed up pathway predictions.
[INFO] [cameo.strain_design.pathway_prediction.pathway_predictor] Adding reactions from universal model to host model.
[DEBUG] [cameo.strain_design.pathway_prediction.pathway_predictor] Adding adapter reactions to connect model with universal model.
[INFO] [cameo.strain_design.pathway_prediction.pathway_predictor] Adding switches.
[INFO] [cameo.strain_design.pathway_prediction.pathway_predictor] Setting minimization of switch variables as objective.
[DEBUG] [cameo.strain_design.pathway_prediction.pathway_predictor] Predicting pathway No. 1
[INFO] [cameo.strain_design.pathway_prediction.pathway_predictor] []
[INFO] [cameo.strain_design.pathway_prediction.pathway_predictor] It seems MNXM3 is a native product in model iJO1366. Let's see if we can find better heterologous pathways.
[INFO] [cameo.strain_design.pathway_prediction.pathway_predictor] Knocking out adapter reaction adapter_atp_c_MNXM3: atp_c <=> MNXM3 containing native product.
[DEBUG] [cameo.strain_design.pathway_prediction.pathway_predictor] Predicting pathway No. 1
[INFO] [cameo.strain_design.pathway_prediction.pathway_predictor] []
[INFO] [cameo.strain_design.pathway_prediction.pathway_predictor] It seems MNXM3 is a native product in model iJO1366. Let's see if we can find better heterologous pathways.
[INFO] [cameo.strain_design.pathway_prediction.pathway_predictor] Knocking out adapter reaction adapter_atp_c_MNXM3: atp_c --> MNXM3 containing native product.
[DEBUG] [cameo.strain_design.pathway_prediction.pathway_predictor] Predicting pathway No. 1
...

The last few lines are repeated indefinitely. This seems to be a bug? From what I can tell, this counter never increments when the code always reaches the path to knockout adapter with native product.