Closed TorkelE closed 2 years ago
Hi,
First, it's not too important but you probably want to post any future python related issues on PyBioNetGen repo instead.
Second, yes there is a way to suppress the output. The documentation is lagging behind development, sorry about the delay. Try doing:
r = bionetgen.run('model.bngl', suppress=True)
run
method currently accepts 1 arg, 3 kwargs input
, output=None
, suppress=False
and timeout=None
where timeout is in seconds.
Please let me know if it works for you, I'll close the issue after if it does.
Thanks, when I add the supress
kwarg the run errors. I do
import bionetgen
model = bionetgen.bngmodel('model.bngl')
if I do
result = bionetgen.run(model);
everything is fine, however,
result = bionetgen.run(model, suppress=True);
gives this error:
BioNetGen version 2.7.1
Reading from file /tmp/tmpgcizzo9z/multistate.bngl (level 0)
Read 9 parameters.
Read 3 molecule types.
Read 3 species.
Read 4 reaction rule(s).
Read 4 observable(s).
Wrote model in xml format to ./multistate.xml.
Finished processing file /tmp/tmpgcizzo9z/multistate.bngl.
CPU TIME: total 0.01 s.
Couldn't run the simulation
'NoneType' object has no attribute 'decode'
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<timed exec> in <module>
~/anaconda3/lib/python3.7/site-packages/bionetgen/modelapi/runner.py in run(inp, out, suppress, timeout)
31 cli = BNGCLI(inp, out, conf["bngpath"], suppress=suppress, timeout=timeout)
32 try:
---> 33 cli.run()
34 os.chdir(cur_dir)
35 except Exception as e:
~/anaconda3/lib/python3.7/site-packages/bionetgen/tools/cli.py in run(self)
138 raise RuntimeError(
139 "Failed to run your BNGL file, there might be an issue with your model!",
--> 140 out.stdout.decode("UTF-8"),
141 out.stderr.decode("UTF-8"),
142 )
AttributeError: 'NoneType' object has no attribute 'decode'
(also, thanks for pointing me to https://github.com/RuleWorld/PyBioNetGen/issues, will use that in the future)
I'm looking into it now, can you tell me which OS you are using this on? Also can you run bionetgen info
in the command line and give me the output?
Actually, I figured out the issue, there will be a new PyBioNetGen version with the patch in 10-15 minutes.
OK, PyBioNetGen version 0.7.0 is out, Try updating with pip install bionetgen --upgrade
and if that doesn't work try pip install bionetgen==0.7.0
. Please let me know if that fixes your problem.
That worked! Thanks a lot for the quick help :)
I'm glad that's solved and that you for posting it as an issue 👍
Hello, I am simulating BioNetGen models in python. The workflow is something like:
The "model.bngl" file basically declares the model and then runs a
simulate({method=>"ode",t_end=>10,n_steps=>1000})
.Each time I simulate it I get a print-out like:
when I make several simulations, this generates a lot of text, clogging up my jupyter notebook. Is there some way to prevent this from being generated?