SBRG / cobrame

A COBRApy extension for genome-scale models of metabolism and expression (ME-models)
Other
34 stars 17 forks source link

Access to MiniME or pickled version of iJL965_ME that does not depend on MiniME? #30

Open djinnome opened 5 years ago

djinnome commented 5 years ago

Hi folks,

I am trying to load iJL965_ME.pickle in python2 and I am unable to because I don't have access to the minime library.

from cPickle import dump,load
me = load(open('iJL965_ME.pickle', 'rb'))

results in the following error.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-8-aac67a141a6b> in <module>()
----> 1 me = load(open('iJL965_ME.pickle', 'rb'))

ImportError: No module named minime.core.MEModel

Unfortunately, I don't see the minime library available on github. Would someone be willing to grant me access to this library or provide a pickled version of the ME model that does not require this library?

Sincerely,

Jeremy

coltonlloyd commented 5 years ago

Hi Jeremy,

Thanks for letting me know about this. The cobrame module was called minime prior to us publishing the code. I'll put updating the iJL965 model for cobrame on the TODO list.

In the meantime, I'm sharing the minime repository with you so you can access it. Let me know if you run into any issues!

Colton

djinnome commented 5 years ago

Hi @coltonlloyd

Thanks for granting me access. Unfortunately, when I try toimport minime, I get the following error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-26500ac16334> in <module>()
      1 #from cobrame.solve.algorithms import binary_search
      2 #from cobrame.solve.symbolic import compile_expressions
----> 3 import minime
      4 from minime.solve.algorithms import binary_search
      5 from minime.solve.symbolic import compile_expressions

/Users/zuck016/.pyenv/versions/anaconda2-5.2.0/lib/python2.7/site-packages/minime/__init__.py in <module>()
----> 1 from core.Components import *
      2 from core.MEModel import *
      3 from core.MEReactions import *
      4 from core.ProcessData import *

ImportError: No module named core.Components

I was able to work around this bug by working in the minime directory, so that it would import ok, but then I realized I needed an older version of cobrapy, so I downgraded to 0.9.1 (which is the last time that cobra.flux_analysis.variability.calculate_lp_variability was still around. But then I couldn't get soplex_cython to install, as it would error out here:

(anaconda2-5.2.0) bash-3.2$ pip install .
Processing /Users/zuck016/Projects/src/soplex_cython-0.0.7
Building wheels for collected packages: soplex
  Running setup.py bdist_wheel for soplex ... error
  Complete output from command /Users/zuck016/.pyenv/versions/anaconda2-5.2.0/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/z1/nhct2gps3y94tkbwqvvd7y_jw6p1l8/T/pip-req-build-mKyZXh/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/z1/nhct2gps3y94tkbwqvvd7y_jw6p1l8/T/pip-wheel-iYErZ0 --python-tag cp27:
  running bdist_wheel
  running build
  running build_ext
  building 'soplex' extension
  creating build
  creating build/temp.macosx-10.6-x86_64-2.7
  creating build/temp.macosx-10.6-x86_64-2.7/soplex
  creating build/temp.macosx-10.6-x86_64-2.7/soplex/src
  gcc -fno-strict-aliasing -I/Users/zuck016/.pyenv/versions/anaconda2-5.2.0/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Isoplex/src -I/usr/local/include -I/Users/zuck016/.pyenv/versions/anaconda2-5.2.0/include/python2.7 -c soplex.cpp -o build/temp.macosx-10.6-x86_64-2.7/soplex.o --std=c++0x -DWITH_LONG_DOUBLE -DSOPLEX_WITH_GMP
  In file included from soplex.cpp:683:
  soplex/src/spxdefines.h:251:1: error: thread-local storage is not supported for the current target
  THREADLOCAL extern const Real infinity;
  ^
  soplex/src/spxdefines.h:145:21: note: expanded from macro 'THREADLOCAL'
  #define THREADLOCAL thread_local
                      ^
  soplex/src/spxdefines.h:261:4: error: thread-local storage is not supported for the current target
     THREADLOCAL static Real s_epsilon;
     ^
  soplex/src/spxdefines.h:145:21: note: expanded from macro 'THREADLOCAL'
  #define THREADLOCAL thread_local
                      ^
  soplex/src/spxdefines.h:263:4: error: thread-local storage is not supported for the current target
     THREADLOCAL static Real s_epsilon_factorization;
     ^
  soplex/src/spxdefines.h:145:21: note: expanded from macro 'THREADLOCAL'
  #define THREADLOCAL thread_local
                      ^
  soplex/src/spxdefines.h:265:4: error: thread-local storage is not supported for the current target
     THREADLOCAL static Real s_epsilon_update;
     ^
  soplex/src/spxdefines.h:145:21: note: expanded from macro 'THREADLOCAL'
  #define THREADLOCAL thread_local
                      ^
  soplex/src/spxdefines.h:267:4: error: thread-local storage is not supported for the current target
     THREADLOCAL static Real s_epsilon_pivot;
     ^
  soplex/src/spxdefines.h:145:21: note: expanded from macro 'THREADLOCAL'
  #define THREADLOCAL thread_local
                      ^
  In file included from soplex.cpp:685:
  In file included from soplex/src/soplex.h:28:
  In file included from soplex/src/basevectors.h:30:
  soplex/src/rational.h:52:7: error: thread-local storage is not supported for the current target
        THREADLOCAL static IdList< Private > unusedPrivateList;
        ^
  soplex/src/spxdefines.h:145:21: note: expanded from macro 'THREADLOCAL'
  #define THREADLOCAL thread_local
                      ^
  In file included from soplex.cpp:685:
  In file included from soplex/src/soplex.h:28:
  In file included from soplex/src/basevectors.h:30:
  soplex/src/rational.h:53:7: error: thread-local storage is not supported for the current target
        THREADLOCAL static bool useListMem;
        ^
  soplex/src/spxdefines.h:145:21: note: expanded from macro 'THREADLOCAL'
  #define THREADLOCAL thread_local
                      ^
  7 errors generated.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for soplex
  Running setup.py clean for soplex
  Complete output from command /Users/zuck016/.pyenv/versions/anaconda2-5.2.0/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/z1/nhct2gps3y94tkbwqvvd7y_jw6p1l8/T/pip-req-build-mKyZXh/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/z1/nhct2gps3y94tkbwqvvd7y_jw6p1l8/T/pip-req-build-mKyZXh/setup.py", line 50, in <module>
      extract_soplex()
    File "/private/var/folders/z1/nhct2gps3y94tkbwqvvd7y_jw6p1l8/T/pip-req-build-mKyZXh/setup.py", line 38, in extract_soplex
      shutil.move("soplex-" + soplex_ver, "soplex")
    File "/Users/zuck016/.pyenv/versions/anaconda2-5.2.0/lib/python2.7/shutil.py", line 306, in move
      raise Error, "Destination path '%s' already exists" % real_dst
  shutil.Error: Destination path 'soplex/soplex-3.1.1' already exists

  ----------------------------------------
  Failed cleaning build dir for soplex
Failed to build soplex
Installing collected packages: soplex
  Running setup.py install for soplex ... error
    Complete output from command /Users/zuck016/.pyenv/versions/anaconda2-5.2.0/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/z1/nhct2gps3y94tkbwqvvd7y_jw6p1l8/T/pip-req-build-mKyZXh/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/z1/nhct2gps3y94tkbwqvvd7y_jw6p1l8/T/pip-record-bhCbKT/install-record.txt --single-version-externally-managed --compile:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/z1/nhct2gps3y94tkbwqvvd7y_jw6p1l8/T/pip-req-build-mKyZXh/setup.py", line 50, in <module>
        extract_soplex()
      File "/private/var/folders/z1/nhct2gps3y94tkbwqvvd7y_jw6p1l8/T/pip-req-build-mKyZXh/setup.py", line 38, in extract_soplex
        shutil.move("soplex-" + soplex_ver, "soplex")
      File "/Users/zuck016/.pyenv/versions/anaconda2-5.2.0/lib/python2.7/shutil.py", line 306, in move
        raise Error, "Destination path '%s' already exists" % real_dst
    shutil.Error: Destination path 'soplex/soplex-3.1.1' already exists

    ----------------------------------------
Command "/Users/zuck016/.pyenv/versions/anaconda2-5.2.0/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/z1/nhct2gps3y94tkbwqvvd7y_jw6p1l8/T/pip-req-build-mKyZXh/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/z1/nhct2gps3y94tkbwqvvd7y_jw6p1l8/T/pip-record-bhCbKT/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/z1/nhct2gps3y94tkbwqvvd7y_jw6p1l8/T/pip-req-build-mKyZXh/

I am concerned that there are so many moving parts that no one will ever be able to reproduce your results unless you make a Docker image available with all the dependencies installed as you did with ecolime. Is this something you can make available?

coltonlloyd commented 5 years ago

Hi @djinnome,

Sorry this has been such a hassle, and I completely agree. As a short term solution, I'm going to work on loading the iJL965 model and translating it into a version that can be saved as a COBRAme-compatible JSON model. This way it can be loaded and solved in the existing docker container, like ecolime.

Does that sound like it could work for now?

Colton

djinnome commented 5 years ago

Hi Colton,

That sounds like a completely reasonable solution.

Sincerely,

Jeremy

djinnome commented 5 years ago

Another option is to provide a pip requirements.txt or an anaconda environment.yml so that I can create a python virtual environment with all the necessary dependencies.

coltonlloyd commented 5 years ago

Hi Jeremy,

Here is a link to a COBRAme compatible json for iJL965. You can load and solve the model in the COBRAme/ECOLIme docker using

from cobrame.io.json import load_reduced_json_me_model
me = load_reduced_json_me_model('iJL695_ME_reduced.json')

This model includes all of the reactions/metabolites in iJL695 and gives identical solutions when solved. But it does not maintain the full ME-model functionality (the distinction is described in more detail here). I hope this is ok in the meantime while I work on way to save the model with all the COBRAme capabilities.

Thanks again for helping us correct these mistakes, and let me know if you have any other issues or questions!

Colton

djinnome commented 5 years ago

Hi @coltonlloyd thanks for making the reduced model available. I can confirm that I was able to reproduce the main results of the paper using this model. How much time do you need to save the model with all the COBRAme capabilities?

Sincerely,

Jeremy

coltonlloyd commented 5 years ago

Hi Jeremy,

Sorry for the delay. I had some time to work on this the past few days, and I think we now have the model working in COBRAme. We're double checking that the model was saved correctly, so I'll let you know when it's available. Should be by the end of next week at the latest.

Thanks for your patience!

Colton

djinnome commented 5 years ago

Hi Colton,

I really appreciate you taking the time to make your ME models reusable by the scientific community.
The value of your work is multiplied by the number of people who build upon it.

Sincerely,

Jeremy