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

Fix Rule-handling in PEtab import #1753

Merged
merged 14 commits into from
Apr 8, 2022
Merged

Fix Rule-handling in PEtab import #1753

merged 14 commits into from
Apr 8, 2022

Conversation

dweindl
Copy link
Member

@dweindl dweindl commented Mar 31, 2022

RateRules-targets in the condition table were previously ignored.

Closes #1750

Also fixes a bug where InitialAssignments were not honored for elements that occurred as column in the condition table and were set to NaN (i.e. "use model value").

@codecov
Copy link

codecov bot commented Mar 31, 2022

Codecov Report

Merging #1753 (f75133d) into develop (93c7304) will decrease coverage by 7.76%.
The diff coverage is 95.55%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1753      +/-   ##
===========================================
- Coverage    73.59%   65.82%   -7.77%     
===========================================
  Files           71       30      -41     
  Lines        12053     4337    -7716     
===========================================
- Hits          8870     2855    -6015     
+ Misses        3183     1482    -1701     
Flag Coverage Δ
cpp ?
petab 60.71% <95.55%> (?)
python ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
python/amici/petab_objective.py 94.32% <90.90%> (+94.32%) ⬆️
python/amici/__init__.py 90.69% <100.00%> (+0.22%) ⬆️
python/amici/parameter_mapping.py 70.33% <100.00%> (+32.94%) ⬆️
python/amici/petab_import.py 72.38% <100.00%> (+72.38%) ⬆️
python/amici/sbml_import.py 91.94% <100.00%> (-1.29%) ⬇️
python/amici/bngl_import.py 0.00% <0.00%> (-100.00%) ⬇️
python/amici/pandas.py 11.62% <0.00%> (-86.63%) ⬇️
python/amici/conserved_quantities_demartino.py 0.00% <0.00%> (-65.56%) ⬇️
python/amici/testing.py 0.00% <0.00%> (-50.00%) ⬇️
python/amici/swig_wrappers.py 59.32% <0.00%> (-35.60%) ⬇️
... and 62 more

@matthiaskoenig
Copy link

@dweindl Thanks for the work on the issue.

As I understand this fixes the rate rule issue. Would it be possible to merge this in develop?
Best M

@dweindl
Copy link
Member Author

dweindl commented Apr 7, 2022

@matthiaskoenig : Will try to do this week. Needs a new https://github.com/PEtab-dev/libpetab-python release first.

@dweindl dweindl marked this pull request as ready for review April 7, 2022 19:58
@dweindl dweindl requested a review from FFroehlich April 7, 2022 20:20
Copy link
Member

@FFroehlich FFroehlich left a comment

Choose a reason for hiding this comment

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

👍

python/amici/petab_import.py Outdated Show resolved Hide resolved
python/amici/petab_import.py Outdated Show resolved Hide resolved
value = get_species_initial(
petab_problem.sbml_model.getSpecies(species_id)
)
element = petab_problem.sbml_model.getElementBySId(element_id)
Copy link
Member

Choose a reason for hiding this comment

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

hmm this doesn't account for InitialAssignments right? (was already the case for species before, but I am not sure thats correct in the first place)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, you are right. Good catch. Should add a test case.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@@ -86,7 +86,8 @@ def get_fixed_parameters(
# remove overridden parameters (`object`-type columns)
fixed_parameters = [p for p in fixed_parameters
if condition_df[p].dtype != 'O'
and sbml_model.getParameter(p) is not None]
and sbml_model.getParameter(p) is not None
and sbml_model.getRuleByVariable(p) is None]
Copy link
Member

Choose a reason for hiding this comment

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

uuuuh, so what happens with rules here that don't have a RateRule qualifier?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is about whether these parameters should be considered as AMICI-constant-parameters. Any parameters that are rule targets cannot be constants. Or am I missing something?

@dweindl dweindl requested a review from FFroehlich April 8, 2022 08:30
@dweindl dweindl self-assigned this Apr 8, 2022
Copy link
Member

@FFroehlich FFroehlich left a comment

Choose a reason for hiding this comment

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

👍

@dweindl dweindl merged commit 8d19766 into develop Apr 8, 2022
@dweindl dweindl deleted the petab_rules branch April 8, 2022 19:56
@sonarcloud
Copy link

sonarcloud bot commented Apr 8, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@dweindl
Copy link
Member Author

dweindl commented Apr 8, 2022

Would it be possible to merge this in develop?

@matthiaskoenig : now available on pypi - amici>=0.11.28

@matthiaskoenig
Copy link

@dweindl Thanks. This part works, just moving on to the next issue with model import ;) See #1779.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AMICI does not handle conditions for parameters governed by rate rules
3 participants