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

Extending and testing the AMR-based modeling API #239

Merged
merged 37 commits into from
Sep 10, 2023
Merged

Extending and testing the AMR-based modeling API #239

merged 37 commits into from
Sep 10, 2023

Conversation

bgyori
Copy link
Member

@bgyori bgyori commented Sep 8, 2023

Note: this is redoing the PR #238 by @nanglo123 against the main branch.

New MIRA Operations in mira/modeling/askenet/ops.py

  • replace_rate_law_mathml
  • add_parameter
    • Currently, we only add parameters that are present in rate laws. Thus newly added parameters using this method are not present in the output amr file. @bgyori will decide how to handle adding parameters not present in any rate laws.
  • remove_X where X is an observable or parameter
    • If X is an observable, we simply just pop the observable object from the dict of observables
    • If X is a parameter, we remove the parameter from the list of parameters in the output amr file and replace every instance of the replaced parameter with the replacement value
  • add_transition
    • Currently, new states and parameters present in the rate law passed in when adding a transition are not added to the list of states and parameters repsectively of the output amr file
  • add_observable
  • replace_x_expression
    • Added 2 versions of the method in which we either pass in a Sympy object or xml string (mathml object) representing the rate law

Unit tests for MIRA operations in tests/test_modeling/test_askenet.py

  • Added passing unit tests for all previously defined MIRA operations. Added passing unit tests for all newly added operations except for add_parameter. Currently, the unit test for add_transition doesn't test for the presence of newly added states and parameters.

Bug Fixes

  • Fixed a bug in commit e9cb3dc where changed parameters after calling replace_parameter_id were not showing in output amr['semantics']['ode']['parameters']

  • Fixed a bug in commit 0ae9ed0 and commit a1e6381 where observables in the output amr had identical values for their name and id field (template model-> amr). Also fixed an issue where template models constructed from an amr file (amr -> template model) used a observables['id'] for the name and display_name of a concept. Now the name field will take the display_name attribute associated with a concept and id will take the id attribute associated with a oncept.

bgyori and others added 30 commits August 24, 2023 10:08
…g picking dict item objects in repplace observable id method
…te_id unit test to not check for length equality between old and new amr expressions asstates do not have to be a single letter
…tests for remove_transition and replace_rate_law_sympy
…or test_replace_rate_law_sympy to test both output amr expression and expression_mathml
…_expression(xml_str) rather than sympy.repr(str) to method
…ailure more apparent and fixed bug where changed parameter ids not showing in parameter list of new_amr
…eplacing observable id to accept a display name argument
…e objects have a non None value for their display name attribute
…s and parameters are not showing in the output amr) and its accompanying unit test
…ion and added decorator to all unit tests that require sbmlmath
@bgyori bgyori merged commit 409eb22 into main Sep 10, 2023
4 checks passed
@bgyori bgyori deleted the modeling_api branch September 10, 2023 20:09
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.

2 participants