danielriosgarza / MAMBO

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

TypeError: argument of type 'Reaction' is not iterable #9

Closed ghost closed 4 years ago

ghost commented 4 years ago

import os import cobra import numpy import bottom_up_ecology as bte

n=10 models = [cobra.io.read_sbml_model('models' + '/' + os.listdir('models')[i]) for i in range(n)] for i in range(n): models[i].solver = 'glpk'

initial_environment = bte.starting_environment(models)

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

I am not sure what I've done wrong here, anyone know the fix?

danielriosgarza commented 4 years ago

It is because of the version of cobrapy you are using. In the current version, you have to specify reacts.id. So... if(e in reacts.id and ex in reacts.id):

ghost commented 4 years ago

Using COBRAPy 0.4.1 did not seem to fix the issue. How would I go about specifying reacts.id? Thanks.