danielriosgarza / MAMBO

GNU General Public License v3.0
12 stars 4 forks source link

Some problems about the script #3

Closed zzb23 closed 6 years ago

zzb23 commented 6 years ago

When I tried to use the script, I met many problems.

  1. Traceback (most recent call last): File "python.py", line 15, in initial_environment = pyx.starting_environment(models) File "bottom_up_ecology.pyx", line 26, in bottom_up_ecology.pyx.starting_environment if (e in reacts and ex in reacts): #identify exchange reactions (if you removed reactions by setting fluxes to zero, then you should add this condition here) TypeError: argument of type 'Reaction' is not iterable

line 26, I think if (e in reacts and ex in reacts): should change to if (e in reacts.id and ex in reacts.id):

2.

Traceback (most recent call last): File "python.py", line 31, in pyx.single_MCMC_run(numpy.random.random_integers(0, len(metabs)-1), models, initial_environment, metabs, relative_abundance, evolution_of_exchange_reactions , i) File "bottom_up_ecology.pyx", line 112, in bottom_up_ecology.pyx.single_MCMC_run new_value = (target_metabolite, current_media[target_metabolite]+numpy.random.uniform(low=-2, high=2)) #small random value change to the reaction. TypeError: can only concatenate tuple (not "float") to tuple

line 112, I guess this problem may be caused by line 32 starting_reaction_dic[reacts]= (1000.0, -1*numpy.random.uniform ()) . When I change it to starting_reaction_dic[reacts]= -1*numpy.random.uniform (), it works. But I don't know should I change it ??

3.

Traceback (most recent call last): File "python.py", line 31, in pyx.single_MCMC_run(numpy.random.random_integers(0, len(metabs)-1), models, initial_environment, metabs, relative_abundance, evolution_of_exchange_reactions , i) File "bottom_up_ecology.pyx", line 115, in bottom_up_ecology.pyx.single_MCMC_run z_on_current_media[i] = list_of_models[i].solution.f #collating the array with current objective values. AttributeError: 'Model' object has no attribute 'solution'

When I use the newest "cobra", line 115 shows no 'solution' object. So I change "list_of_models[i].solution.f" to "list_of_models[i].optimize().objective_value". Is it right ??

4.

The example listed bte.single_MCMC_run(numpy.random.random_integers(0, len(metabs), models, initial_environment, metabs, relative_abundance, evolution_of_exchange_reactions , i) has problem, it should be changed to bte.single_MCMC_run(numpy.random.random_integers(0, len(metabs)-1), models, initial_environment, metabs, relative_abundance, evolution_of_exchange_reactions , i).

5.

I don't know how to use the script to compelet a whole anaysis(for example, I have 16s taxa abundance for several samples, but I don't know how to deal with it to be used in the script), would you mind supplying some usage supplement

danielriosgarza commented 6 years ago

Issue 2 was in fact a problem with the script. The starting environment function was outdated and your correction is what it should be. Thank you for pointing this out (I fixed it in the script). The other issues are related with the version of cobrapy and should be adjusted according to your version, as I believe you are doing.

As for point 5, in fact we published this git to show the computational functions that were used in the study and it's clearly not published as a software suite for the whole analysis process that is needed to successfully use the approach. This goes from generating genome-scale metabolic models, obtaining metagenomics data, etc. I believe the methods in the paper state what is needed. I am happy to help you implement the approach with your data. Please send me an email if you have specific questions. danielriosgarza@gmail.com