mendessoares / MMinte

16 stars 10 forks source link

MMinte with model created by Carveme #13

Open arianccbasile opened 5 years ago

arianccbasile commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

Thx for your suggestion. I will check that code :+1:

arianccbasile commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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