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

Event assignment not working #170

Open
vwiela opened this issue Dec 2, 2024 · 2 comments
Open

Event assignment not working #170

vwiela opened this issue Dec 2, 2024 · 2 comments
Labels
question Further information is requested

Comments

@vwiela
Copy link

vwiela commented Dec 2, 2024

Dear all,

I am trying to import and convert an SBML model with 50 reactions, 29 species, 34 parameters and 17 events into a ReactionSystem using the following recommended code from you example page

sbml_file = string(petab_folder, "/", model_name, ".sbml")

SBMLToolkit.checksupport_file(sbml_file)


# import the model from SBML
model = readSBML(sbml_file, doc -> begin
    set_level_and_version(3, 2)(doc)
    convert_promotelocals_expandfuns(doc)
end)

This works great and I does import the model. However, when I want to convert it then, I get an error.
Precisely it fails in the event assignment, when running through
https://github.com/SciML/SBMLToolkit.jl/blob/4e7abda2bc4501f9cd63864f8a26c7b681a6ca4a/src/drafts.jl

The problem is that model.events is a vector of Pair{String, SBML.Event} and then an element ev in values(model.events) is a Pair, so the line

for as in ev.event_assignments

cannot be executed and would need to be changed to

for as in ev[2].event_assignments

in order to grab the SBML.Event from the pair.

I am not sure whether this is something unique to my SBML model and I would need to change my import, or it is a bug in the code.
Any help is appreciated, thanks.

Vincent

@vwiela vwiela added the question Further information is requested label Dec 2, 2024
@paulflang
Copy link
Member

Hi @vwiela, thanks for reporting this issue and suggesting a solution. Looks like your model contains parameters with constant=false that are updated in an event. I added a test case and fixed the failure. Can you check if #171 works for you?

@vwiela
Copy link
Author

vwiela commented Dec 11, 2024

Hey, @paulflang thanks for your response and the fix.

Sorry, for not trying it earlier..
It does work now with your fix.

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

No branches or pull requests

2 participants