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 SBML Rule handling logic #120

Merged
merged 3 commits into from
Apr 4, 2022
Merged

Fix SBML Rule handling logic #120

merged 3 commits into from
Apr 4, 2022

Conversation

dweindl
Copy link
Member

@dweindl dweindl commented Mar 31, 2022

RateRules were ignored so far...

Related to PEtab-dev/PEtab#539, PEtab-dev/PEtab#513

RateRules were ignored so far...
@dweindl dweindl requested a review from dilpath April 4, 2022 14:53
Comment on lines 412 to +418
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}
Copy link
Member

Choose a reason for hiding this comment

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

Just some duplicated code, fine as is.

Suggested change
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}
parameters = {
p.getId(): p.getValue()
for p in sbml_model.getListOfParameters()
if sbml_model.getRuleByVariable(p.getId()) is None
}
if not with_values:
return list(parameters.keys())
return parameters

Copy link
Member Author

@dweindl dweindl Apr 4, 2022

Choose a reason for hiding this comment

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

You are right about the duplication, but I'd still keep it as is. For large models, this saves quite a couple of XML lookups.

@dweindl dweindl merged commit 93d8551 into develop Apr 4, 2022
@dweindl dweindl deleted the fix_rules branch April 4, 2022 19:54
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