From 0ed186971d0ba9b58a4a4e10f83da2f0d0ac006a Mon Sep 17 00:00:00 2001 From: paulflang Date: Mon, 24 Jul 2023 03:14:51 +0000 Subject: [PATCH 1/3] support kinetic laws with only cn elements --- src/reactions.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/reactions.jl b/src/reactions.jl index 61915cc..15df555 100644 --- a/src/reactions.jl +++ b/src/reactions.jl @@ -53,7 +53,7 @@ function get_unidirectional_components(bidirectional_math) end function add_reaction!(rxs::Vector{Reaction}, - kl::Num, + kl::Union{Num, Float64}, reactant_references::Vector{SBML.SpeciesReference}, product_references::Vector{SBML.SpeciesReference}, model::SBML.Model; @@ -157,6 +157,11 @@ function use_rate(kl::Num, react::Union{Vector{Num}, Nothing}, return (kl, our) end +function use_rate(kl::Float64, ::Union{Vector{Num}, Nothing}, + ::Union{Vector{<:Real}, Nothing}) + (kl, true) +end + """ Get rate constant of mass action kineticLaws """ From 80c1ee8e16533329bae6175dc02bc61761c6bb10 Mon Sep 17 00:00:00 2001 From: paulflang Date: Mon, 24 Jul 2023 14:24:54 +0000 Subject: [PATCH 2/3] add test --- test/reactions.jl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/reactions.jl b/test/reactions.jl index 36f48a2..6b5dcc2 100644 --- a/test/reactions.jl +++ b/test/reactions.jl @@ -51,6 +51,17 @@ model = SBML.Model(parameters = Dict("k1" => PARAM1), reactions = Dict("r1" => reac)) @test isequal(IV, SBMLToolkit.get_reactions(model)[1].rate) +km = SBML.MathVal(1.0) +reac = SBML.Reaction(products = [ + SBML.SpeciesReference(species = "s1", stoichiometry = 1), + ], + kinetic_math = km, + reversible = false) +model = SBML.Model(compartments = Dict("c1" => COMP1), + species = Dict("s1" => SPECIES1), + reactions = Dict("r2" => reac)) +@test isequal(1, SBMLToolkit.get_reactions(model)[1].rate) + # Test get_unidirectional_components km = SBML.MathApply("-", SBML.Math[KINETICMATH1, SBML.MathIdent("c1")]) sm = SBMLToolkit.interpret_as_num(km, MODEL1) From fe2a939ed42bdde8b94fda751a55cc367eaf0e79 Mon Sep 17 00:00:00 2001 From: paulflang Date: Mon, 24 Jul 2023 14:26:18 +0000 Subject: [PATCH 3/3] update patcch version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index d590228..f51a3c5 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.24" +version = "0.1.25" [deps] Catalyst = "479239e8-5488-4da2-87a7-35f2df7eef83"