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

writing ReactionSystem to file #456

Closed
anandijain opened this issue Dec 21, 2021 · 2 comments
Closed

writing ReactionSystem to file #456

anandijain opened this issue Dec 21, 2021 · 2 comments

Comments

@anandijain
Copy link
Contributor

ODESystems allow you to do

open("mwe.jl", "w") do io
       write(io, sys)
end

this fails on ReactionSystems with

ERROR: type Reaction has no field lhs
Stacktrace:
 [1] getproperty
   @ ./Base.jl:42 [inlined]
 [2] round_trip_eq(eq::Reaction{Any, Float64}, var2name::Dict{Any, Symbol})
   @ ModelingToolkit ~/.julia/packages/ModelingToolkit/r5ZaU/src/systems/abstractsystem.jl:565
 [3] push_eqs!(stmt::Vector{Any}, eqs::Vector{Any}, var2name::Dict{Any, Symbol})
   @ ModelingToolkit ~/.julia/packages/ModelingToolkit/r5ZaU/src/systems/abstractsystem.jl:572
 [4] toexpr(sys::ReactionSystem{ODESystem})
   @ ModelingToolkit ~/.julia/packages/ModelingToolkit/r5ZaU/src/systems/abstractsystem.jl:621
 [5] write(io::IOStream, sys::ReactionSystem{ODESystem})
   @ ModelingToolkit ~/.julia/packages/ModelingToolkit/r5ZaU/src/systems/abstractsystem.jl:636
 [6] (::var"#14#15")(io::IOStream)
   @ Main ./REPL[190]:2
 [7] open(::var"#14#15", ::String, ::Vararg{String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Base ./io.jl:330
 [8] open(::Function, ::String, ::String)
   @ Base ./io.jl:328
 [9] top-level scope
   @ REPL[190]:1

I haven't looked into fixing this yet, just making a note.
this isn't urgent, but would make debugging some things from sbml easier

@isaacsas
Copy link
Member

isaacsas commented Dec 21, 2021

Probably needs a custom write for ReactionSystems, or something that is called by it.

@TorkelE
Copy link
Member

TorkelE commented Jun 4, 2024

a new save_reactionsystem function has been implemented to do this (it is also possible using Serialization.jl)

@TorkelE TorkelE closed this as completed Jun 4, 2024
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

No branches or pull requests

3 participants