Skip to content

Commit

Permalink
Release 0.1.26
Browse files Browse the repository at this point in the history
Merge pull request #121 from PEtab-dev/release_0.1.26
  • Loading branch information
dweindl authored Apr 7, 2022
2 parents e912ff7 + 921574e commit c457c05
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## 0.1 series

### 0.1.26

* Fix SBML Rule handling logic by @dweindl in
https://github.com/PEtab-dev/libpetab-python/pull/120

### 0.1.25
* Fix for pytest 7.1 by @yannikschaelte in https://github.com/PEtab-dev/libpetab-python/pull/112
* Fix jinja version by @dilpath in https://github.com/PEtab-dev/libpetab-python/pull/115
Expand Down
4 changes: 3 additions & 1 deletion petab/parameter_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,13 @@ def _apply_condition_parameters(par_mapping: ParMappingDict,
if overridee_id == CONDITION_NAME:
continue

# Species and compartments are handled elsewhere
# Species, compartments, and rule targets are handled elsewhere
if sbml_model.getSpecies(overridee_id) is not None:
continue
if sbml_model.getCompartment(overridee_id) is not None:
continue
if sbml_model.getRuleByVariable(overridee_id) is not None:
continue

par_mapping[overridee_id] = core.to_float_if_float(
condition_df.loc[condition_id, overridee_id])
Expand Down
13 changes: 6 additions & 7 deletions petab/sbml.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,24 +399,23 @@ def get_sigmas(sbml_model: libsbml.Model, remove: bool = False) -> dict:

def get_model_parameters(sbml_model: libsbml.Model, with_values=False
) -> Union[List[str], Dict[str, float]]:
"""Return SBML model parameters which are not AssignmentRule
targets for observables or sigmas
"""Return SBML model parameters which are not Rule targets
Arguments:
sbml_model: SBML model
with_values:
If False, returns list of SBML model parameter IDs which
are not AssignmentRule targets for observables or sigmas. If True,
returns a dictionary with those parameter IDs as keys and parameter
values from the SBML model as values.
are not Rule targets. If True, returns a dictionary with those
parameter IDs as keys and parameter values from the SBML model as
values.
"""
if not with_values:
return [p.getId() for p in sbml_model.getListOfParameters()
if sbml_model.getAssignmentRuleByVariable(p.getId()) is None]
if sbml_model.getRuleByVariable(p.getId()) is None]

return {p.getId(): p.getValue()
for p in sbml_model.getListOfParameters()
if sbml_model.getAssignmentRuleByVariable(p.getId()) is None}
if sbml_model.getRuleByVariable(p.getId()) is None}


def write_sbml(
Expand Down
2 changes: 1 addition & 1 deletion petab/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""PEtab library version"""
__version__ = '0.1.25'
__version__ = '0.1.26'

0 comments on commit c457c05

Please sign in to comment.