Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

MMinte with model created by Carveme #13

Open
arianccbasile opened this issue Jan 11, 2019 · 5 comments
Open

MMinte with model created by Carveme #13

arianccbasile opened this issue Jan 11, 2019 · 5 comments

Comments

@arianccbasile
Copy link

Good morning!
I am trying to use your scripts (adapting them to python3.6) for my metabolic models created by carveme (https://github.com/cdanielmachado/carveme) instead of ModelSEED so starting from widget4. I was wondering whether it is a problem or your scripts work also with carveme models.

Sincerely,
Arianna Basile

@mmundy42
Copy link
Contributor

Arianna,

That should work to start with widget4 using models created by carveme. As long as the model can be loaded by cobrapy, MMinte should work. I would suggest using the MMinte code in my fork at https://github.com/mmundy42/MMinte where the code was restructured to make it easier to use the functionality of MMinte from your own Python code.

@arianccbasile
Copy link
Author

Thx for your suggestion. I will check that code 👍

@arianccbasile
Copy link
Author

I did as you suggeted but using your fork of the mminte code I get some errors in the file "interaction_worker.py" in detail when I run calculate_growth_rates in my code I get the following error

`---------------------------------------------------------------------------
RemoteTraceback Traceback (most recent call last)
RemoteTraceback:
"""
Traceback (most recent call last):
File "/mnt/data_SSD/anaconda3/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/mnt/data_SSD/anaconda3/lib/python3.6/site-packages/mminte/interaction_worker.py", line 69, in compute_growth_rates
if a_solution.x_dict[a_objective] < growth_rate_cutoff:
AttributeError: 'Solution' object has no attribute 'x_dict'
"""

The above exception was the direct cause of the following exception:

AttributeError Traceback (most recent call last)
in
----> 1 growth_rates = mminte.calculate_growth_rates(pair_model_filenames, western_diet)

/mnt/data_SSD/anaconda3/lib/python3.6/site-packages/mminte/interaction_analysis.py in calculate_growth_rates(pair_models, medium, n_processes)
160 growth_rates = pd.DataFrame(columns=growth_rate_columns)
161 for result in result_list:
--> 162 growth_rates = growth_rates.append(result.get(), ignore_index=True)
163 pool.close()
164 return growth_rates

/mnt/data_SSD/anaconda3/lib/python3.6/multiprocessing/pool.py in get(self, timeout)
668 return self._value
669 else:
--> 670 raise self._value
671
672 def _set(self, i, obj):

AttributeError: 'Solution' object has no attribute 'x_dict'
`

I checked all the dependencies versions and it should be ok so I wonder if there is something wrong with the code it self. I tried also with the models you provided but I got the same error.

Any suggestions?
Sincerely,
Arianna

@mmundy42
Copy link
Contributor

What version of cobrapy do you have in your environment? cobrapy changed the Solution object in 0.14.0. The LegacySolution object has the x_dict attribute. Can you go back to cobrapy version 0.12.x? Otherwise there is some work to be done to update MMinte to work with the latest cobrapy.

@arianccbasile
Copy link
Author

arianccbasile commented Jan 25, 2019

I solved creating a new environment with cobra 0.5.2. Quite old version but it worked. Thank you for your kind answer.

Sincerely,
Arianna

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants