-
Notifications
You must be signed in to change notification settings - Fork 7
v2: Add experiments->events converter #387
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #387 +/- ##
==========================================
+ Coverage 74.01% 74.15% +0.13%
==========================================
Files 60 62 +2
Lines 6642 6794 +152
Branches 1154 1184 +30
==========================================
+ Hits 4916 5038 +122
- Misses 1288 1307 +19
- Partials 438 449 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3dbcaaf
to
fa34d69
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
petab/v2/converters.py
Outdated
f"Event `{event.getId()}` has no priority set. " | ||
"Make sure that this event cannot trigger at the time of " | ||
"a PEtab condition change, otherwise the behavior is " | ||
"undefined.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, makes sense since SBML distinguishes "simultaneous due to undefined priority" and "random ordering due to equal priority". Still, I guess setting the priority and issuing a warning might make more sense/is more user-friendly than not setting the priority. The latter case supports users who exploit tool-specific ordering of undefined events, which I guess is relatively rare.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simultaneous due to undefined priority
The order would be undefined in that case, not simultaneous.
exploit tool-specific ordering of undefined events
This is definitely not a use case I would want to support in PEtab.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simultaneous due to undefined priority
The order would be undefined in that case, not simultaneous.
exploit tool-specific ordering of undefined events
This is definitely not a use case I would want to support in PEtab.
Yes, the events are simultaneous, and the ordering is undefined. But my point was just that setting a priority changes the ordering. Hence, we could set the priority of the event, and change the warning to be "this event priority is now defined". I guess this is more user friendly, because users are probably not trying to exploit (or rather, we don't want to support) tool-specific behavior for "events that are simultaneous, with undefined ordering".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I don't think this changes anything. If there are two event assignments to be executed at the same simulation time, it doesn't matter if one has a priority and the other does not, or if neither has a priority. The execution order is undefined in either case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, the complete suggestion:
The user has a model that already has an event A that will trigger at t=10, with undefined priority.
The converter adds a period condition change event B at t=10.
We can set the priority of both event A and event B, to get the expected behavior for the PEtab condition change, and warn the user that the event A priority was changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But there is no choice: the PEtab event must occur first. This ordering must already be accepted by the user regardless of this experiment->event converter, since this ordering is in the PEtab spec. The user's only choice is whether the ordering of their remaining non-PEtab events are undefined or random or ordered -- which is the thing that the user does not care about, or they would have already set the priority. Hence, I see setting a priority as the sensible default, since it won't break anything, and will ensure that the PEtab event occurs first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you are right in principle, I still don't think this is the place to change the behavior of other parts of the model. I am fine with adding an additional default_priority
parameter to set any undefined priorities to that value if a user opts in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't think this is the place to change the behavior of other parts of the model
Could happen but if behavior does change, it would be behavior that is not within the scope of SBML, as far as I can tell, since SBML leaves it undefined.
Anyway, a default_priority
(or preexisting_priority
so it's clear that it's different to the PEtab event priority) would be fine for me. Should be included in this warning message, so users know how to quickly resolve the warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd find preexisting_priority
somewhat confusing, since it's specifically used for events for which no priority preexists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, maybe undefined_priority
?
Also the new docstring for default_priority
describes the "undefined priority" case, but not the "equal priority" case, which is what using the default_priority
will result in.
On both points, the current PR state is fine for me 👍 Thanks
1de4410
to
b2ddd82
Compare
Add functionality to convert PEtab v2 experiments/conditions to SBML events. This should make it easier to implement v2 support in other tools.
Co-authored-by: Dilan Pathirana <[email protected]>
b2ddd82
to
e660f60
Compare
Co-authored-by: Dilan Pathirana <[email protected]>
Add functionality to convert PEtab v2 experiments/conditions to SBML events. This should make it easier to implement v2 support in other tools.
All condition table changes are converted to event assignments. Only two indicator variables have to be set for each experiment.
Closes #370.