From 9804d82d132c4889e87e4281cc02bb24679d0498 Mon Sep 17 00:00:00 2001 From: paulflang Date: Fri, 25 Nov 2022 18:38:11 +0000 Subject: [PATCH 1/3] support kwargs[:defaults] in the ReactionSystem constructor --- src/systems.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/systems.jl b/src/systems.jl index 24c0795..923a44f 100644 --- a/src/systems.jl +++ b/src/systems.jl @@ -37,13 +37,17 @@ function Catalyst.ReactionSystem(model::SBML.Model; kwargs...) # Todo: requires Dict(Catalyst.DEFAULT_IV.val => 0))) push!(raterules_subs, rhs ~ o.lhs) end + if haskey(kwargs, :defaults) + defs = ModelingToolkit._merge(defs, kwargs[:defaults]) + kwargs = filter(x -> !isequal(first(x), :defaults), kwargs) + end constraints_sys = ODESystem(vcat(algrules, raterules_subs, obsrules_rearranged), IV; name = gensym(:CONSTRAINTS), continuous_events = get_events(model)) ReactionSystem(rxs, IV, first.(u0map), first.(parammap); defaults = defs, name = gensym(:SBML), constraints = constraints_sys, - combinatoric_ratelaws = false, kwargs...) + combinatoric_ratelaws = false) end """ From f4d57cd5d35296336e6121449f0cb34a261a3f71 Mon Sep 17 00:00:00 2001 From: paulflang Date: Mon, 28 Nov 2022 00:40:17 +0100 Subject: [PATCH 2/3] pass remaining kwargs to ReactionSystem constructor --- src/systems.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systems.jl b/src/systems.jl index 923a44f..aacd369 100644 --- a/src/systems.jl +++ b/src/systems.jl @@ -47,7 +47,7 @@ function Catalyst.ReactionSystem(model::SBML.Model; kwargs...) # Todo: requires ReactionSystem(rxs, IV, first.(u0map), first.(parammap); defaults = defs, name = gensym(:SBML), constraints = constraints_sys, - combinatoric_ratelaws = false) + combinatoric_ratelaws = false, kwargs...) end """ From a3a147c3912fdf8f716e48f17cf75f228b931600 Mon Sep 17 00:00:00 2001 From: paulflang Date: Mon, 28 Nov 2022 00:40:38 +0100 Subject: [PATCH 3/3] bump patch version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 7794a18..4bff9c8 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SBMLToolkit" uuid = "86080e66-c8ac-44c2-a1a0-9adaadfe4a4e" authors = ["paulflang", "anandijain"] -version = "0.1.17" +version = "0.1.18" [deps] Catalyst = "479239e8-5488-4da2-87a7-35f2df7eef83"