Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
7 changes: 6 additions & 1 deletion src/reactions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
"""
Expand Down
11 changes: 11 additions & 0 deletions test/reactions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down