From 5ee5179c92df3b7bd4491ebc297c6eae21ed0ee1 Mon Sep 17 00:00:00 2001 From: paulflang Date: Sat, 13 Jul 2024 14:07:02 +0200 Subject: [PATCH 01/14] complete reaction systems --- src/systems.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/systems.jl b/src/systems.jl index fed983e..615629c 100644 --- a/src/systems.jl +++ b/src/systems.jl @@ -90,11 +90,12 @@ function Catalyst.ReactionSystem(model::SBML.Model; kwargs...) # Todo: requires defs = ModelingToolkit._merge(defs, kwargs[:defaults]) kwargs = filter(x -> !isequal(first(x), :defaults), kwargs) end - ReactionSystem([rxs..., algrules..., raterules_subs..., obsrules_rearranged...], + rs = ReactionSystem([rxs..., algrules..., raterules_subs..., obsrules_rearranged...], IV, first.(u0map), first.(parammap); defaults = defs, name = gensym(:SBML), continuous_events = get_events(model), combinatoric_ratelaws = false, kwargs...) + return complete(rs) # Todo: maybe add a `complete=True` kwarg end """ From c49d9a9f91ffbbf3787130305d3c962994a20165 Mon Sep 17 00:00:00 2001 From: paulflang Date: Sat, 13 Jul 2024 14:34:10 +0200 Subject: [PATCH 02/14] update variables to unknowns --- test/mwe.jl | 3 +++ test/rules.jl | 8 ++++---- test/runtests.jl | 42 +++++++++++++++++++++--------------------- test/systems.jl | 10 +++++----- 4 files changed, 33 insertions(+), 30 deletions(-) create mode 100644 test/mwe.jl diff --git a/test/mwe.jl b/test/mwe.jl new file mode 100644 index 0000000..5e95ddc --- /dev/null +++ b/test/mwe.jl @@ -0,0 +1,3 @@ +a = first(@species A [isconstantspecies = false]) +b = first(@species A [isbcspecies = true]) +isequal(a, b) diff --git a/test/rules.jl b/test/rules.jl index 09420cf..b5935c5 100644 --- a/test/rules.jl +++ b/test/rules.jl @@ -59,16 +59,16 @@ m = readmodel(sbml) vc = SBMLToolkit.get_volume_correction(m, "S1") @test isnothing(vc) -# tests that non-constant parameters become states +# tests that non-constant parameters become nonspecies unknowns sbml, _, _ = SBMLToolkitTestSuite.read_case("00033") m = readmodel(sbml) @named sys = ODESystem(m) @species k1(IV) -@test isequal(k1, states(sys)[end]) +@test isequal(k1, nonspecies(sys)[end]) -# tests that non-constant compartments become states +# tests that non-constant compartments become nonspecies unknowns sbml, _, _ = SBMLToolkitTestSuite.read_case("00051") # hOSU="true" species m = readmodel(sbml) @named sys = ODESystem(m) @species C(IV) -@test isequal(C, states(sys)[end]) +@test isequal(C, nonspecies(sys)[end]) diff --git a/test/runtests.jl b/test/runtests.jl index ecabd09..6cafcac 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,28 +1,28 @@ using SafeTestsets, Test @safetestset "SBMLToolkit.jl" begin - @safetestset "Quality Assurance" begin - include("qa.jl") - end - @safetestset "Systems" begin - include("systems.jl") - end - @safetestset "Reactions" begin - include("reactions.jl") - end - @safetestset "Rules" begin - include("rules.jl") - end - @safetestset "Events" begin - include("events.jl") - end - @safetestset "Utils" begin - include("utils.jl") - end + # @safetestset "Quality Assurance" begin + # include("qa.jl") + # end + # @safetestset "Systems" begin + # include("systems.jl") + # end + # @safetestset "Reactions" begin + # include("reactions.jl") + # end + # @safetestset "Rules" begin + # include("rules.jl") + # end + # @safetestset "Events" begin + # include("events.jl") + # end + # @safetestset "Utils" begin + # include("utils.jl") + # end @safetestset "Simulation results" begin include("simresults.jl") end - @safetestset "Wuschel" begin - include("wuschel.jl") - end + # @safetestset "Wuschel" begin + # include("wuschel.jl") + # end end diff --git a/test/systems.jl b/test/systems.jl index 2fe458d..accdeea 100644 --- a/test/systems.jl +++ b/test/systems.jl @@ -49,7 +49,7 @@ rs = ReactionSystem(MODEL1) @test isequal(Catalyst.get_eqs(rs), Catalyst.Reaction[Catalyst.Reaction(k1, nothing, [s1], nothing, [1.0])]) @test isequal(Catalyst.get_iv(rs), IV) -@test isequal(Catalyst.get_states(rs), [s1]) +@test isequal(Catalyst.get_species(rs), [s1]) @test isequal(Catalyst.get_ps(rs), [k1, c1]) @named rs = ReactionSystem(MODEL1) isequal(nameof(rs), :rs) @@ -59,7 +59,7 @@ rs = ReactionSystem(readSBML(sbmlfile)) Catalyst.Reaction[Catalyst.Reaction(k1 / c1, [s1, s2], [s1s2], [1.0, 1.0], [1.0])]) @test isequal(Catalyst.get_iv(rs), IV) -@test isequal(Catalyst.get_states(rs), [s1, s1s2, s2]) +@test isequal(Catalyst.get_species(rs), [s1, s1s2, s2]) @test isequal(Catalyst.get_ps(rs), [k1, c1]) @named rs = ReactionSystem(MODEL1) isequal(nameof(rs), :rs) @@ -71,7 +71,7 @@ rs = ReactionSystem(MODEL2) # Contains reversible reaction Catalyst.Reaction(k1, nothing, [s1], nothing, [1])]) @test isequal(Catalyst.get_iv(rs), IV) -@test isequal(Catalyst.get_states(rs), [s1]) +@test isequal(Catalyst.get_species(rs), [s1]) @test isequal(Catalyst.get_ps(rs), [k1, c1]) @test convert(ModelingToolkit.ODESystem, rs) isa ODESystem @@ -82,7 +82,7 @@ odesys = ODESystem(MODEL1) trueeqs = Equation[Differential(IV)(s1) ~ k1] @test isequal(Catalyst.get_eqs(odesys), trueeqs) @test isequal(Catalyst.get_iv(odesys), IV) -@test isequal(Catalyst.get_states(odesys), [s1]) +@test isequal(Catalyst.get_species(odesys), [s1]) @test isequal(Catalyst.get_ps(odesys), [k1, c1]) u0 = [s1 => 1.0] par = [k1 => 1.0, c1 => 2.0] @@ -98,7 +98,7 @@ trueeqs = Equation[Differential(IV)(s1) ~ -(k1 * s1 * s2) / c1, Differential(IV)(s2) ~ -(k1 * s1 * s2) / c1] @test isequal(Catalyst.get_eqs(odesys), trueeqs) @test isequal(Catalyst.get_iv(odesys), IV) -@test isequal(Catalyst.get_states(odesys), [s1, s1s2, s2]) +@test isequal(Catalyst.get_species(odesys), [s1, s1s2, s2]) @test isequal(Catalyst.get_ps(odesys), [k1, c1]) u0 = [s1 => 2 * 1.0, s2 => 2 * 1.0, s1s2 => 2 * 1.0] par = [k1 => 1.0, c1 => 2.0] From eaf9be05fdb408ba5a215e5fcc5767f0dfec180d Mon Sep 17 00:00:00 2001 From: paulflang Date: Sat, 13 Jul 2024 14:36:08 +0200 Subject: [PATCH 03/14] update to default_t and default_time_deriv --- src/SBMLToolkit.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SBMLToolkit.jl b/src/SBMLToolkit.jl index 0d58baa..1b88ee0 100644 --- a/src/SBMLToolkit.jl +++ b/src/SBMLToolkit.jl @@ -15,7 +15,7 @@ include("utils.jl") export ReactionSystem, ODESystem export readSBML, readSBMLFromString, set_level_and_version, convert_simplify_math, - convert_promotelocals_expandfuns + convert_promotelocals_expandfuns, checksupport_file export DefaultImporter, ReactionSystemImporter, ODESystemImporter end From fcb58938f6e0320feef040dc0938746ef68b67e0 Mon Sep 17 00:00:00 2001 From: paulflang Date: Sat, 13 Jul 2024 16:12:21 +0200 Subject: [PATCH 04/14] up to Catalyst v13 v14 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 6ba044c..3bd083c 100644 --- a/Project.toml +++ b/Project.toml @@ -11,7 +11,7 @@ SymbolicUtils = "d1185830-fcd6-423d-90d6-eec64667417b" [compat] Aqua = "0.8" CSV = "0.10.5" -Catalyst = "13" +Catalyst = "13, 14" DataFrames = "1" Downloads = "1" ModelingToolkit = "8.51" From efa41b9d501c7126aad667c7b9e2ea8b202758df Mon Sep 17 00:00:00 2001 From: paulflang Date: Sat, 13 Jul 2024 17:35:17 +0200 Subject: [PATCH 05/14] update description of differences to SBMLImporter --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 355b430..8fbdad0 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ SBMLToolkit.jl is a lightweight tool to import models specified in the Systems Biology Markup Language (SBML) into the Julia SciML ecosystem. There are multiple ways to specify the same model in SBML. Please help us improving SBMLToolkit.jl by creating a GitHub issue if you experience errors when converting your SBML model. -SBMLToolkit uses the [SBML.jl](https://github.com/LCSB-BioCore/SBML.jl) wrapper of the [libSBML](https://model.caltech.edu/software/libsbml/) library to lower dynamical SBML models into dynamical systems. If you would like to import BioNetGen models use the `writeSBML()` export function or import the `.net` file with [ReactionNetworkImporters.jl](https://github.com/SciML/ReactionNetworkImporters.jl). For constrained-based modeling, please have a look at [COBREXA.jl](https://github.com/LCSB-BioCore/COBREXA.jl). We also recommend trying [SBMLImporter.jl](https://github.com/sebapersson/SBMLImporter.jl) (Pros: respects directionality of events, outputs concentrations instead of amounts. Cons: imports ODESystems, i.e. does not interface with Catalyst). +SBMLToolkit uses the [SBML.jl](https://github.com/LCSB-BioCore/SBML.jl) wrapper of the [libSBML](https://model.caltech.edu/software/libsbml/) library to lower dynamical SBML models into completed dynamical systems. If you would like to import BioNetGen models use the `writeSBML()` export function or import the `.net` file with [ReactionNetworkImporters.jl](https://github.com/SciML/ReactionNetworkImporters.jl). For constrained-based modeling, please have a look at [COBREXA.jl](https://github.com/LCSB-BioCore/COBREXA.jl). We also recommend trying [SBMLImporter.jl](https://github.com/sebapersson/SBMLImporter.jl). While SBMLToolkit.jl has a slighly cleaner interface, SBMLImporter.jl respects directionality of events, can output concentrations or amounts, and provides better simulation performance for models including time-triggered events and SBML `piecewise` expressions. ## Installation @@ -46,7 +46,7 @@ rs = readSBML("my_model.xml", ReactionSystemImporter()) One common case where this is useful is if you want to run stochastic instead of ODE simulations. -In the very unlikely case that you need fine-grained control over the SBML import, you can create an SBML.jl `Model` (we strongly recommend manually running `SBMLToolkit.checksupport_file("my_model.xml")` before) +In the very unlikely case that you need fine-grained control over the SBML import, you can create an SBML.jl `Model` (we strongly recommend manually running `checksupport_file("my_model.xml")` before) ```julia using SBML From e27e0c8ace943934799f49165e14306327cfc934 Mon Sep 17 00:00:00 2001 From: paulflang Date: Sat, 13 Jul 2024 17:37:24 +0200 Subject: [PATCH 06/14] fix typo in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8fbdad0..c24afab 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ SBMLToolkit.jl is a lightweight tool to import models specified in the Systems Biology Markup Language (SBML) into the Julia SciML ecosystem. There are multiple ways to specify the same model in SBML. Please help us improving SBMLToolkit.jl by creating a GitHub issue if you experience errors when converting your SBML model. -SBMLToolkit uses the [SBML.jl](https://github.com/LCSB-BioCore/SBML.jl) wrapper of the [libSBML](https://model.caltech.edu/software/libsbml/) library to lower dynamical SBML models into completed dynamical systems. If you would like to import BioNetGen models use the `writeSBML()` export function or import the `.net` file with [ReactionNetworkImporters.jl](https://github.com/SciML/ReactionNetworkImporters.jl). For constrained-based modeling, please have a look at [COBREXA.jl](https://github.com/LCSB-BioCore/COBREXA.jl). We also recommend trying [SBMLImporter.jl](https://github.com/sebapersson/SBMLImporter.jl). While SBMLToolkit.jl has a slighly cleaner interface, SBMLImporter.jl respects directionality of events, can output concentrations or amounts, and provides better simulation performance for models including time-triggered events and SBML `piecewise` expressions. +SBMLToolkit uses the [SBML.jl](https://github.com/LCSB-BioCore/SBML.jl) wrapper of the [libSBML](https://model.caltech.edu/software/libsbml/) library to lower dynamical SBML models into completed dynamical systems. If you would like to import BioNetGen models use the `writeSBML()` export function or import the `.net` file with [ReactionNetworkImporters.jl](https://github.com/SciML/ReactionNetworkImporters.jl). For constrained-based modeling, please have a look at [COBREXA.jl](https://github.com/LCSB-BioCore/COBREXA.jl). We also recommend trying [SBMLImporter.jl](https://github.com/sebapersson/SBMLImporter.jl). While SBMLToolkit.jl has a slightly cleaner interface, SBMLImporter.jl respects directionality of events, can output concentrations or amounts, and provides better simulation performance for models including time-triggered events and SBML `piecewise` expressions. ## Installation From 79727d96dd981a3ddce44b01f103793bfb59d267 Mon Sep 17 00:00:00 2001 From: paulflang Date: Sat, 13 Jul 2024 19:02:44 +0200 Subject: [PATCH 07/14] remove accidentally added file --- test/mwe.jl | 3 --- test/runtests.jl | 42 +++++++++++++++++++++--------------------- 2 files changed, 21 insertions(+), 24 deletions(-) delete mode 100644 test/mwe.jl diff --git a/test/mwe.jl b/test/mwe.jl deleted file mode 100644 index 5e95ddc..0000000 --- a/test/mwe.jl +++ /dev/null @@ -1,3 +0,0 @@ -a = first(@species A [isconstantspecies = false]) -b = first(@species A [isbcspecies = true]) -isequal(a, b) diff --git a/test/runtests.jl b/test/runtests.jl index 6cafcac..ecabd09 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,28 +1,28 @@ using SafeTestsets, Test @safetestset "SBMLToolkit.jl" begin - # @safetestset "Quality Assurance" begin - # include("qa.jl") - # end - # @safetestset "Systems" begin - # include("systems.jl") - # end - # @safetestset "Reactions" begin - # include("reactions.jl") - # end - # @safetestset "Rules" begin - # include("rules.jl") - # end - # @safetestset "Events" begin - # include("events.jl") - # end - # @safetestset "Utils" begin - # include("utils.jl") - # end + @safetestset "Quality Assurance" begin + include("qa.jl") + end + @safetestset "Systems" begin + include("systems.jl") + end + @safetestset "Reactions" begin + include("reactions.jl") + end + @safetestset "Rules" begin + include("rules.jl") + end + @safetestset "Events" begin + include("events.jl") + end + @safetestset "Utils" begin + include("utils.jl") + end @safetestset "Simulation results" begin include("simresults.jl") end - # @safetestset "Wuschel" begin - # include("wuschel.jl") - # end + @safetestset "Wuschel" begin + include("wuschel.jl") + end end From 2dd2102bb40ee16551271b091644bd7b4166f5c3 Mon Sep 17 00:00:00 2001 From: paulflang Date: Sat, 13 Jul 2024 19:52:04 +0200 Subject: [PATCH 08/14] fix failing tests --- test/rules.jl | 8 ++++---- test/systems.jl | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/rules.jl b/test/rules.jl index b5935c5..8c278fe 100644 --- a/test/rules.jl +++ b/test/rules.jl @@ -59,16 +59,16 @@ m = readmodel(sbml) vc = SBMLToolkit.get_volume_correction(m, "S1") @test isnothing(vc) -# tests that non-constant parameters become nonspecies unknowns +# tests that non-constant parameters become variables sbml, _, _ = SBMLToolkitTestSuite.read_case("00033") m = readmodel(sbml) @named sys = ODESystem(m) @species k1(IV) -@test isequal(k1, nonspecies(sys)[end]) +@test isequal(k1, get_variables(sys)[end]) -# tests that non-constant compartments become nonspecies unknowns +# tests that non-constant compartments become variables sbml, _, _ = SBMLToolkitTestSuite.read_case("00051") # hOSU="true" species m = readmodel(sbml) @named sys = ODESystem(m) @species C(IV) -@test isequal(C, nonspecies(sys)[end]) +@test isequal(C, get_variables(sys)[end]) diff --git a/test/systems.jl b/test/systems.jl index accdeea..34ebac9 100644 --- a/test/systems.jl +++ b/test/systems.jl @@ -82,7 +82,7 @@ odesys = ODESystem(MODEL1) trueeqs = Equation[Differential(IV)(s1) ~ k1] @test isequal(Catalyst.get_eqs(odesys), trueeqs) @test isequal(Catalyst.get_iv(odesys), IV) -@test isequal(Catalyst.get_species(odesys), [s1]) +@test isequal(Catalyst.get_unknowns(odesys), [s1]) @test isequal(Catalyst.get_ps(odesys), [k1, c1]) u0 = [s1 => 1.0] par = [k1 => 1.0, c1 => 2.0] @@ -98,7 +98,7 @@ trueeqs = Equation[Differential(IV)(s1) ~ -(k1 * s1 * s2) / c1, Differential(IV)(s2) ~ -(k1 * s1 * s2) / c1] @test isequal(Catalyst.get_eqs(odesys), trueeqs) @test isequal(Catalyst.get_iv(odesys), IV) -@test isequal(Catalyst.get_species(odesys), [s1, s1s2, s2]) +@test isequal(Catalyst.get_unknowns(odesys), [s1, s1s2, s2]) @test isequal(Catalyst.get_ps(odesys), [k1, c1]) u0 = [s1 => 2 * 1.0, s2 => 2 * 1.0, s1s2 => 2 * 1.0] par = [k1 => 1.0, c1 => 2.0] From c3f60e8639da08cc73504da6bfb390bb6e74aa5d Mon Sep 17 00:00:00 2001 From: paulflang Date: Sun, 14 Jul 2024 21:37:11 +0200 Subject: [PATCH 09/14] fix bidirectional math and completion of ODESystems --- src/reactions.jl | 2 +- src/systems.jl | 6 ++++-- test/systems.jl | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/reactions.jl b/src/reactions.jl index 86ff18c..7a4a146 100644 --- a/src/reactions.jl +++ b/src/reactions.jl @@ -30,7 +30,7 @@ Infer forward and reverse components of bidirectional kineticLaw """ function get_unidirectional_components(bidirectional_math) bm = ModelingToolkit.value(bidirectional_math) # Symbolics.tosymbol(bidirectional_math) - bm = simplify(bm; expand = true) + bm = expand(simplify(bm)) if !SymbolicUtils.isadd(bm) @warn "Cannot separate bidirectional kineticLaw `$bidirectional_math` to forward and reverse part. Setting forward to `$bidirectional_math` and reverse to `0`. Stochastic simulations will be inexact." return (bidirectional_math, Num(0)) diff --git a/src/systems.jl b/src/systems.jl index 615629c..ffc6e2f 100644 --- a/src/systems.jl +++ b/src/systems.jl @@ -39,8 +39,9 @@ See also [`Model`](@ref) and [`ODESystemImporter`](@ref). """ function SBML.readSBML(sbmlfile::String, ::ODESystemImporter; include_zero_odes::Bool = true, kwargs...) # Returns an MTK.ODESystem - convert(ODESystem, readSBML(sbmlfile, ReactionSystemImporter(), kwargs...), + odesys = convert(ODESystem, readSBML(sbmlfile, ReactionSystemImporter(), kwargs...), include_zero_odes = include_zero_odes) + complete(odesys) end """ @@ -108,7 +109,8 @@ See also [`ReactionSystem`](@ref). function ModelingToolkit.ODESystem(model::SBML.Model; include_zero_odes::Bool = true, kwargs...) rs = ReactionSystem(model; kwargs...) - convert(ODESystem, rs; include_zero_odes = include_zero_odes) + odesys = convert(ODESystem, rs; include_zero_odes = include_zero_odes) + complete(odesys) end function get_mappings(model::SBML.Model) diff --git a/test/systems.jl b/test/systems.jl index 34ebac9..4eda7d2 100644 --- a/test/systems.jl +++ b/test/systems.jl @@ -93,9 +93,9 @@ isequal(nameof(odesys), :odesys) odesys = ODESystem(readSBML(sbmlfile)) m = readSBML(sbmlfile) -trueeqs = Equation[Differential(IV)(s1) ~ -(k1 * s1 * s2) / c1, +trueeqs = Equation[Differential(IV)(s1) ~ -((k1 * s1 * s2) / c1), Differential(IV)(s1s2) ~ (k1 * s1 * s2) / c1, - Differential(IV)(s2) ~ -(k1 * s1 * s2) / c1] + Differential(IV)(s2) ~ -((k1 * s1 * s2) / c1)] @test isequal(Catalyst.get_eqs(odesys), trueeqs) @test isequal(Catalyst.get_iv(odesys), IV) @test isequal(Catalyst.get_unknowns(odesys), [s1, s1s2, s2]) From a4dc90dd936cd39b5a776e7e14070f4e6bfeb1aa Mon Sep 17 00:00:00 2001 From: paulflang Date: Thu, 18 Jul 2024 12:47:42 +0200 Subject: [PATCH 10/14] use unknows instead of get_variables in rules.jl --- test/rules.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/rules.jl b/test/rules.jl index 8c278fe..141323d 100644 --- a/test/rules.jl +++ b/test/rules.jl @@ -64,11 +64,11 @@ sbml, _, _ = SBMLToolkitTestSuite.read_case("00033") m = readmodel(sbml) @named sys = ODESystem(m) @species k1(IV) -@test isequal(k1, get_variables(sys)[end]) +@test isequal(k1, unknowns(sys)[end]) # tests that non-constant compartments become variables sbml, _, _ = SBMLToolkitTestSuite.read_case("00051") # hOSU="true" species m = readmodel(sbml) @named sys = ODESystem(m) @species C(IV) -@test isequal(C, get_variables(sys)[end]) +@test isequal(C, unknowns(sys)[end]) From a4a46814d1d330662d5d1fab718333fcd67f6f1e Mon Sep 17 00:00:00 2001 From: paulflang Date: Thu, 18 Jul 2024 12:49:09 +0200 Subject: [PATCH 11/14] update to default_t and default_time_deriv --- src/utils.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.jl b/src/utils.jl index 4331628..29cc023 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -1,6 +1,6 @@ # Conversion to symbolics -const IV = Catalyst.DEFAULT_IV -const D = Differential(IV) +const IV = default_t() +const D = default_time_deriv() symbolicsRateOf(x) = D(x) const symbolics_mapping = Dict(SBML.default_function_mapping..., "rateOf" => symbolicsRateOf) From d46ecfb99dd758d6bab40cb3468e93a78ea1fa49 Mon Sep 17 00:00:00 2001 From: paulflang Date: Thu, 18 Jul 2024 12:49:27 +0200 Subject: [PATCH 12/14] up SBMLtkTestSuite to v0.0.4 --- Project.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 3bd083c..00110e2 100644 --- a/Project.toml +++ b/Project.toml @@ -11,14 +11,14 @@ SymbolicUtils = "d1185830-fcd6-423d-90d6-eec64667417b" [compat] Aqua = "0.8" CSV = "0.10.5" -Catalyst = "13, 14" +Catalyst = "14" DataFrames = "1" Downloads = "1" -ModelingToolkit = "8.51" +ModelingToolkit = "9" OrdinaryDiffEq = "6.42" Plots = "1.11" SBML = "1.4.4" -SBMLToolkitTestSuite = "0.0.3" +SBMLToolkitTestSuite = "0.0.4" SafeTestsets = "0.1" Sundials = "4.14" SymbolicUtils = "1, 2" From d8328748c07892b252ddc1e05448ca21d74910f1 Mon Sep 17 00:00:00 2001 From: paulflang Date: Thu, 18 Jul 2024 12:59:12 +0200 Subject: [PATCH 13/14] update to default_t and default_time_deriv --- src/reactions.jl | 2 +- test/events.jl | 2 +- test/reactions.jl | 2 +- test/rules.jl | 4 ++-- test/systems.jl | 10 +++++----- test/utils.jl | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/reactions.jl b/src/reactions.jl index 7a4a146..8bf819b 100644 --- a/src/reactions.jl +++ b/src/reactions.jl @@ -168,7 +168,7 @@ function get_massaction(kl::Num, reactants::Union{Vector{Num}, Nothing}, function check_args(::Val{true}, x::SymbolicUtils.BasicSymbolic{Real}) for arg in SymbolicUtils.arguments(x) - if isnan(check_args(arg)) || isequal(arg, Catalyst.DEFAULT_IV) + if isnan(check_args(arg)) || isequal(arg, default_t()) return NaN end end diff --git a/test/events.jl b/test/events.jl index 77b8a2a..c82d87c 100644 --- a/test/events.jl +++ b/test/events.jl @@ -2,7 +2,7 @@ using SBMLToolkit using Catalyst, SBMLToolkitTestSuite using Test -const IV = Catalyst.DEFAULT_IV +const IV = default_t() @parameters compartment @species S1(IV) S2(IV) diff --git a/test/reactions.jl b/test/reactions.jl index a39147e..0d30fbc 100644 --- a/test/reactions.jl +++ b/test/reactions.jl @@ -4,7 +4,7 @@ using Test cd(@__DIR__) sbmlfile = joinpath("data", "reactionsystem_01.xml") -const IV = Catalyst.DEFAULT_IV +const IV = default_t() @parameters k1, c1 @species s1(IV), s2(IV), s1s2(IV) diff --git a/test/rules.jl b/test/rules.jl index 141323d..52e51e0 100644 --- a/test/rules.jl +++ b/test/rules.jl @@ -3,7 +3,7 @@ using SBML, SBMLToolkitTestSuite using Catalyst, ModelingToolkit, OrdinaryDiffEq using Test -const IV = Catalyst.DEFAULT_IV +const IV = default_t() @parameters k1, compartment @species S1(IV), S2(IV) @@ -24,7 +24,7 @@ o_true = [S1 ~ 7 * compartment] sbml, _, _ = SBMLToolkitTestSuite.read_case("00031") # rateRule m = readmodel(sbml) a, o, r = SBMLToolkit.get_rules(m) -r_true = [Differential(IV)(S1) ~ 7 * compartment] +r_true = [default_time_deriv()(S1) ~ 7 * compartment] @test isequal(r, r_true) sbml, _, _ = SBMLToolkitTestSuite.read_case("00039") # algebraicRule diff --git a/test/systems.jl b/test/systems.jl index 4eda7d2..0e09c62 100644 --- a/test/systems.jl +++ b/test/systems.jl @@ -4,7 +4,7 @@ using Test cd(@__DIR__) sbmlfile = joinpath("data", "reactionsystem_01.xml") -const IV = Catalyst.DEFAULT_IV +const IV = default_t() @parameters k1, c1 @species s1(IV), s2(IV), s1s2(IV) @@ -79,7 +79,7 @@ rs = ReactionSystem(MODEL2) # Contains reversible reaction # Test ODESystem constructor odesys = ODESystem(MODEL1) -trueeqs = Equation[Differential(IV)(s1) ~ k1] +trueeqs = Equation[default_time_deriv()(s1) ~ k1] @test isequal(Catalyst.get_eqs(odesys), trueeqs) @test isequal(Catalyst.get_iv(odesys), IV) @test isequal(Catalyst.get_unknowns(odesys), [s1]) @@ -93,9 +93,9 @@ isequal(nameof(odesys), :odesys) odesys = ODESystem(readSBML(sbmlfile)) m = readSBML(sbmlfile) -trueeqs = Equation[Differential(IV)(s1) ~ -((k1 * s1 * s2) / c1), - Differential(IV)(s1s2) ~ (k1 * s1 * s2) / c1, - Differential(IV)(s2) ~ -((k1 * s1 * s2) / c1)] +trueeqs = Equation[default_time_deriv()(s1) ~ -((k1 * s1 * s2) / c1), + default_time_deriv()(s1s2) ~ (k1 * s1 * s2) / c1, + default_time_deriv()(s2) ~ -((k1 * s1 * s2) / c1)] @test isequal(Catalyst.get_eqs(odesys), trueeqs) @test isequal(Catalyst.get_iv(odesys), IV) @test isequal(Catalyst.get_unknowns(odesys), [s1, s1s2, s2]) diff --git a/test/utils.jl b/test/utils.jl index d0d68a5..0ebce46 100644 --- a/test/utils.jl +++ b/test/utils.jl @@ -25,7 +25,7 @@ MODEL1 = SBML.Model(parameters = Dict("D" => PARAM1, "Dv" => PARAM2), species = Dict("B" => SPECIES1, "Bc" => SPECIES2), rules = [RULE1]) -const IV = Catalyst.DEFAULT_IV +const IV = default_t() @species s1(IV) # Test symbolicsRateOf rate = SBMLToolkit.symbolicsRateOf(s1) From 5b38d0d5e35e113fdd0534f4575e96af9b762c7a Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Thu, 18 Jul 2024 07:19:43 -0400 Subject: [PATCH 14/14] Update wuschel.jl --- test/wuschel.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/wuschel.jl b/test/wuschel.jl index d151753..b09a11d 100644 --- a/test/wuschel.jl +++ b/test/wuschel.jl @@ -13,7 +13,7 @@ m = readSBMLFromString(sbml, doc -> begin end) sys = ODESystem(m) @test length(equations(sys)) == 1012 -@test length(states(sys)) == 1012 +@test length(unknowns(sys)) == 1012 #ssys = structural_simplify(sys) # Todo: Figure out why this complains about ExtraVariablesSystemException prob = ODEProblem(sys, [], (0, 10.0)) solve(prob, Tsit5(), save_everystep = false)