RuleWorld / nfsim

A general-purpose, stochastic, biochemical reaction simulator for large reaction networks
http://michaelsneddon.net/nfsim/
MIT License
14 stars 9 forks source link

Can't use a Species Observable in a local function #20

Open lh64 opened 8 years ago

lh64 commented 8 years ago

From wshlavacek:

Please see the attached BNGL file, which should allow you to reproduce the bug.

If an observable appearing in a local function is a Species observable, NFsim simulations cannot be performed. The following console error message is generated: "-in clone species observable, this is not yet updated to handle stoch observables. fix me." If the observable is a Molecules observable, there is no problem with starting an NFsim simulation. The problem does not arise when using BioNetGen/run_network for simulations.

Can this be fixed?

It turns out (contrary to warning messages produced by the software), a Species observable is sometimes faster to calculate than a Molecules observable. Being forced to use a Molecules observable in a local function (instead of the faster-to-calculate Species observable) is greatly slowing down simulations.

To clarify... Switching from a Species to Molecules observable is causing an orders of magnitude slow down in NFsim simulation efficiency. I'm being forced to use the Molecules observable because this observable is used in a local function, which apparently doesn't work with the Species observable type.

p.s. I think the reason the Species observable is faster is because the counting of matches stops once a match is found, whereas the Molecules observable evaluation procedure will find all matches. Obviously, this is not the desired observable type when looking for existence of a pattern when species will tend to have many symmetries.

bug_species_vs_molecules.txt