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

Support initialAssignments with the DefaultImporter #132

Merged
merged 7 commits into from
Aug 17, 2023

Conversation

paulflang
Copy link
Member

@paulflang paulflang commented Aug 14, 2023

This is to support initialAssignments for users who do not want to flatten them during libSBML conversion (i.e. with the import_simplify_math) converter from SBML.jl. As the DefaultImporter no longer uses this converter, it is needed for correct default imports.

Documentation: I did not add a docstring to the new function create_symbol as it is not exported.

Testing: I wanted to add a test function for create_symbol but this requires SciML/ModelingToolkit.jl#2228.

@codecov
Copy link

codecov bot commented Aug 14, 2023

Codecov Report

Merging #132 (e8edc6c) into main (76c91e9) will increase coverage by 0.29%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #132      +/-   ##
==========================================
+ Coverage   93.94%   94.24%   +0.29%     
==========================================
  Files           7        7              
  Lines         347      365      +18     
==========================================
+ Hits          326      344      +18     
  Misses         21       21              
Files Changed Coverage Δ
src/systems.jl 93.68% <100.00%> (+0.06%) ⬆️
src/utils.jl 94.73% <100.00%> (+1.51%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@paulflang paulflang marked this pull request as ready for review August 15, 2023 18:41
Copy link

@ai-maintainer ai-maintainer bot left a comment

Choose a reason for hiding this comment

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

AI-Maintainer Review for PR - Pl/initial assignments

Title and Description 👍

Title and Description
The description of the pull request provides a clear explanation of the purpose of the changes. It effectively communicates the intent to support `initialAssignments` for users who do not want to flatten them during libSBML conversion. However, the title of the pull request could be more descriptive to better convey the purpose of the changes.

Scope of Changes 👍

Scope of Changes
The changes in the pull request are narrowly focused on addressing a specific issue related to `initialAssignments` during libSBML conversion. The modifications primarily involve adding and updating code related to `u0map`, `parammap`, and `initial_assignment_map` in the `Catalyst.ReactionSystem` function and the `get_mappings` function. There are also some additions and modifications in the `create_symbol` function. The changes are focused on resolving the specific issue at hand rather than addressing multiple issues simultaneously.

Documentation 👎

Documentation
The newly added function `create_symbol` in both `src/utils.jl` and `test/utils.jl` does not have docstrings. It would be beneficial to add docstrings that describe the behavior, arguments, and return values of these functions.

Testing 👎

Testing
The description does not provide information on how the changes were tested. It would be helpful to include details about the testing process, such as the specific test cases used or any additional steps taken to ensure the correctness and functionality of the modifications.

Suggested Changes

  1. Add a more descriptive title for the pull request that better conveys the purpose of the changes.
  2. Add docstrings to the create_symbol function in both src/utils.jl and test/utils.jl that describe the behavior, arguments, and return values of the function.
  3. Include information in the description about how the changes were tested. This could include specific test cases used or additional steps taken to ensure the correctness and functionality of the modifications.

Reviewed with AI Maintainer

src/systems.jl Outdated
for (k, v) in model.initial_assignments
var = create_symbol(k, model)
val = model.initial_assignments[k]
push!(initial_assignment_map, var => interpret_as_num(val, model)) # Todo
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the todo here about?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is already done, but I forgot to delete the comment.🙈

src/systems.jl Outdated

for (k, v) in model.initial_assignments
var = create_symbol(k, model)
val = model.initial_assignments[k]
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the difference between v and val?

Copy link
Member Author

Choose a reason for hiding this comment

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

None. Well spotted. Changed that.

@paulflang paulflang changed the title Pl/initial assignments Support initialAssignments with the DefaultImporter Aug 17, 2023
@paulflang paulflang merged commit f22243a into main Aug 17, 2023
10 checks passed
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