Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local function export fixes, example model #464

Merged
merged 3 commits into from Oct 16, 2019

Conversation

@alubbock
Copy link
Member

@alubbock alubbock commented Oct 7, 2019

  • New localfunc.py example model, based on a BioNetGen example model
  • Fix export of models with local functions to SBML and StochKit
  • Show meaningful error messages when attempting to export models
    with local functions to cupSODA or Kappa
  • Fix local function parameter reads from BioNetGen when parameter
    is actually a constant expression, e.g. 2^2
Copy link
Member

@jmuhlich jmuhlich left a comment

Approved, but I did notice a couple of minor things.

I was going to suggest using the | operator instead of itertools.chain on the ComponentSets, but it doesn't make things much more readable and it's not very efficient. It might be worth optimizing those set operators in the future.

pysb/bng.py Outdated
p = pysb.core.Parameter(pname, pval, _export=False)
# Need to parse the value, since BNG considers some expressions
# to be "Constant", e.g. "2^2"
p = pysb.core.Parameter(pname, parse_bngl_expr(pval), _export=False)
Copy link
Member

@jmuhlich jmuhlich Oct 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe hoist pval = parse_bngl_expr(pval) out of theif ptype ... block since we're doing it in both cases now. Up to you.

@@ -15,7 +15,7 @@
from pysb.pathfinder import get_path
import sympy
import collections

import itertools
Copy link
Member

@jmuhlich jmuhlich Oct 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems spurious.

alubbock added 3 commits Oct 16, 2019
Imported from the BioNetGen model localfunc.bngl
Fix export of models with local functions to SBML and StochKit.
Meaningful error messages with same models when exporting to
Kappa or cupSODA.

Fix local function parameter reads from BNG when parameter
is actually a constant expression, e.g. "2^2"
@alubbock alubbock force-pushed the localfunc_example branch from ff5f0af to 717fdde Oct 16, 2019
@alubbock alubbock merged commit d74ba62 into pysb:master Oct 16, 2019
1 of 2 checks passed
@alubbock alubbock deleted the localfunc_example branch Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants