EPFL-LCSB / yetfl

Apache License 2.0
4 stars 3 forks source link

helper_gen_models_yeast.py: IndexError #1

Open alvxi opened 2 years ago

alvxi commented 2 years ago

Hi, running yETFL on ETFL docker container. When I first try to run helper_gen_models_yeast.py, I get the following error:

root@:~/yetfl/code# python helper_gen_models_yeast.py
Scaling...
 A: min|aij| =  1.000e+00  max|aij| =  1.000e+00  ratio =  1.000e+00
Problem data seem to be well scaled
No defined compartments in model model. Compartments will be deduced heuristically using regular expressions.
Using regular expression found the following compartments:c, ce, e, er, erm, g, gm, i, lp, m, mm, n, p, v, vm
Traceback (most recent call last):
  File "helper_gen_models_yeast.py", line 21, in <module>
    from yeast import   get_model, get_thermo_data, get_coupling_dict, \
  File "/home/pytfa/yetfl/code/yeast.py", line 1128, in <module>
    cobra_model = cobra.io.load_matlab_model('../input_models/yeast8_thermo_curated.mat')
  File "/usr/local/lib/python3.6/site-packages/cobra/io/mat.py", line 301, in load_matlab_model
    return from_mat_struct(data[possible_name], model_id=possible_name, inf=inf)
  File "/usr/local/lib/python3.6/site-packages/cobra/io/mat.py", line 773, in from_mat_struct
    mat_parse_annotations(new_metabolites, m, d_replace=DICT_MET)
  File "/usr/local/lib/python3.6/site-packages/cobra/io/mat.py", line 395, in mat_parse_annotations
    prov: annotations[prov][i] for prov in providers if annotations[prov][i]
  File "/usr/local/lib/python3.6/site-packages/cobra/io/mat.py", line 395, in <dictcomp>
    prov: annotations[prov][i] for prov in providers if annotations[prov][i]
IndexError: list index out of range

I can't understand why this happens, so I'm asking what I am doing wrong or if there is an issue with the script.

Thanks in advance

oftadehomid commented 2 years ago

Thank you for your comment! I checked this; the issue was related to the latest update (version 0.25.0) provided by cobra. The new cobra function to load mat files is not compatible with the old structures that we had. I have made a new commit to the main ETFL repository. You can fetch the new version, uninstall your current version of ETFL and cobra, and reinstall ETFL with the new requirements. Alternatively, you can just downgrade your cobra package to the version 0.24.0 or older. Just remember if you are using cobra for other projects, it might be better to use docker or anaconda environments to avoid any inconsistency between different versions.

alvxi commented 2 years ago

Thank you for the answer! I downgraded cobra to 0.24 and now when I try to run test_small.py it raises another error:

image

Also tested on windows, and gives the same error.

oftadehomid commented 2 years ago

The issue was solved! Please pull the latest ETFL code.