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

Add fixed species support #364

merged 9 commits into from Feb 5, 2019

Add fixed species support to the BNG importer

* Correct use of deprecated Model.initial in Builder
* Move many BNG validation models from the "with_force" list to the "regular"
  • Loading branch information...
jmuhlich committed Jan 7, 2019
commit cf2827f57cf2e92b45a8bd3e5f9e5b14179cda71
@@ -172,9 +172,11 @@ def expression(self, *args, **kwargs):
return e

def initial(self, *args):
def initial(self, *args, **kwargs):
"""Adds an initial condition to the Builder's model instance."""
i = Initial(*args, _export=False, **kwargs)
return i

def __getitem__(self, index):
"""Returns the component with the given string index
@@ -186,11 +186,6 @@ def _parse_observables(self):

def _parse_initials(self):
for i in self._x.iterfind(_ns('{0}ListOfSpecies/{0}Species')):
if i.get('Fixed') is not None and i.get('Fixed') == "1":
self._warn_or_except('Species %s is fixed, but will be '
'treated as an ordinary species in '
'PySB.' % i.get('name'))

value_param = i.get('concentration')
value = float(value_param)
@@ -210,7 +205,9 @@ def _parse_initials(self):
mon_pats = self._parse_species(i)
species_cpt = self.model.compartments.get(i.get('compartment'))
self.initial(ComplexPattern(mon_pats, species_cpt), value_param)
cp = ComplexPattern(mon_pats, species_cpt)
fixed = i.get('Fixed') == "1"
self.initial(cp, value_param, fixed)

def _parse_compartments(self):
for c in self._x.iterfind(_ns('{0}ListOfCompartments/{0}compartment')):
@@ -77,15 +77,7 @@ def _sbml_location(filename):

def test_bngl_import_expected_passes_with_force():
for filename in ('Haugh2b',
full_filename = _bngl_location(filename)
with warnings.catch_warnings():
@@ -95,20 +87,29 @@ def test_bngl_import_expected_passes_with_force():

def test_bngl_import_expected_passes():
for filename in ('CaOscillate_Func',
full_filename = _bngl_location(filename)
yield (bngl_import_compare_simulations, full_filename)

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.