segrelab / cometspy

Python interface for running COMETS simulations and analyzing the results
GNU General Public License v3.0
11 stars 9 forks source link

the method of cometspy.comets() can not working properly #15

Closed wupeng1998 closed 2 years ago

wupeng1998 commented 2 years ago

when i use cometspy to simulation, i find the method can not working properly. here is my test code: import cobra.test import cometspy as c from cometspy.utils import chemostat

make a model from a cobra model, open exchange reactions, and give a pop

tb = cobra.test.create_test_model("textbook")
m = c.model(tb)
m.initial_pop = [0, 0, 1.e-4]
m.open_exchanges()
reservoir = {'glc__D_e': 0.01, 'nh4_e': 1000., 'pi_e': 1000.}
c.layout, c.params = chemostat([m], reservoir, 0.1)
c.params.set_param("maxCycles", 100)
sim = c.comets(c.layout, c.params)
sim.run()
print(sim.total_biomass)

And there is the screenshot of my error. image

jeremymchacon commented 2 years ago

Hello, that means that the COMETS_HOME environmental variable was not found. It should have been set during COMETS installation (which is separate from and necessary to use cometspy, and can be downloaded at runComets.org) .

If you do have COMETS installed and for some reason the variable is not present in your python env, you can set it at the top of your script with the os package:

import os os.environ['COMETS_HOME'] = '/home/jeremy/comets/'

where /home/jeremy/comets is where comets is on your system.