Skip to content

Commit

Permalink
fix tests (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
anandijain authored Jan 5, 2022
1 parent d1e973d commit eb458c4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 80 deletions.
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.10"
version = "0.1.11"

[deps]
Catalyst = "479239e8-5488-4da2-87a7-35f2df7eef83"
Expand Down
99 changes: 20 additions & 79 deletions test/reactionsystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@ sbmlfile = joinpath("data", "reactionsystem_01.xml")

kinetic_params = Dict{String,Tuple{Float64,String}}()

empty_units = Dict{String,Vector{SBML.UnitPart}}()
initial_assignments = Dict{String,SBML.Math}()
empty_rules = SBML.Rule[]
empty_contstraints = SBML.Constraint[]
empty_objectives = Dict{String,Float64}()
empty_geneproducts = Dict{String,SBML.GeneProduct}()
empty_functiondefs = Dict{String,SBML.FunctionDefinition}()
empty_events = Dict{String,SBML.Event}()

COMP1 = SBML.Compartment("c1", true, 3, 2.0, "nl", nothing, nothing)
SPECIES1 = SBML.Species("s1", "c1", false, nothing, nothing, (1.0, "substance"), nothing, true, nothing, nothing) # Todo: Maybe not support units in initial_concentration?
SPECIES2 = SBML.Species("s2", "c1", false, nothing, nothing, nothing, (1.0, "substance/nl"), false, nothing, nothing)
Expand All @@ -25,52 +16,22 @@ REACTION1 = SBML.Reaction(Dict(), Dict("s1" => 1), kinetic_params, "", "", nothi
REACTION2 = SBML.Reaction(Dict("s2" => 1), Dict(), kinetic_params, "", "", nothing, KINETICMATH2, false, nothing, nothing)
REACTION3 = SBML.Reaction(Dict("s2" => 1), Dict(), kinetic_params, "", "", nothing, KINETICMATH3, true, nothing, nothing)
MODEL1 = SBML.Model(
Dict("k1" => (1.0, "")),
empty_units,
Dict("c1" => COMP1),
Dict("s1" => SPECIES1),
initial_assignments,
empty_rules,
empty_contstraints,
Dict("r1" => REACTION1),
empty_objectives,
empty_geneproducts,
empty_functiondefs,
empty_events,
nothing,
nothing
parameters = Dict("k1" => (1.0, "")),
compartments = Dict("c1" => COMP1),
species = Dict("s1" => SPECIES1),
reactions = Dict("r1" => REACTION1),
) # PL: For instance in the compartments dict, we may want to enforce that key and compartment.name are identical
MODEL2 = SBML.Model(
Dict("k1" => (1.0, "")),
empty_units,
Dict("c1" => COMP1),
Dict("s2" => SPECIES2),
initial_assignments,
empty_rules,
empty_contstraints,
Dict("r2" => REACTION2),
empty_objectives,
empty_geneproducts,
empty_functiondefs,
empty_events,
nothing,
nothing
parameters = Dict("k1" => (1.0, "")),
compartments = Dict("c1" => COMP1),
species = Dict("s2" => SPECIES2),
reactions = Dict("r2" => REACTION2),
)
MODEL3 = SBML.Model(
Dict("k1" => (1.0, "")),
empty_units,
Dict("c1" => COMP1),
Dict("s2" => SPECIES2),
initial_assignments,
empty_rules,
empty_contstraints,
Dict("r3" => REACTION3),
empty_objectives,
empty_geneproducts,
empty_functiondefs,
empty_events,
nothing,
nothing
parameters = Dict("k1" => (1.0, "")),
compartments = Dict("c1" => COMP1),
species = Dict("s2" => SPECIES2),
reactions = Dict("r3" => REACTION3),
)
# MODEL2 = SBML.Model(Dict("k1" => ("", 1.0)), Dict(), Dict("c1" => COMP1), Dict("s2" => SPECIES2), Dict("r2" => REACTION2), Dict(), Dict())
# MODEL3 = SBML.Model(Dict("k1" => ("", 1.0)), Dict(), Dict("c1" => COMP1), Dict("s2" => SPECIES2), Dict("r3" => REACTION3), Dict(), Dict())
Expand Down Expand Up @@ -171,20 +132,10 @@ truereaction = Catalyst.Reaction(k1, nothing, [s1], nothing, [1]) # Todo: imple
km = SBML.MathTime("x")
reac = SBML.Reaction(Dict("s1" => 1), Dict(), kinetic_params, "", "", nothing, km, false, nothing, nothing)
mod = SBML.Model(
Dict("k1" => (1.0, "")),
empty_units,
Dict("c1" => COMP1),
Dict("s1" => SPECIES1),
initial_assignments,
empty_rules,
empty_contstraints,
Dict("r1" => reac),
empty_objectives,
empty_geneproducts,
empty_functiondefs,
empty_events,
nothing,
nothing
parameters = Dict("k1" => (1.0, "")),
compartments = Dict("c1" => COMP1),
species = Dict("s1" => SPECIES1),
reactions = Dict("r1" => reac),
)

@test isequal(Catalyst.DEFAULT_IV, SBMLToolkit.mtk_reactions(mod)[1].rate)
Expand All @@ -211,20 +162,10 @@ kineticmath = SBML.MathApply("-", SBML.Math[
constreac = SBML.Reaction(Dict("constspec" => 1), Dict(), kinetic_params, "", "", nothing, kineticmath, false, nothing, nothing)

constmod = SBML.Model(
Dict("k1" => (1.0, "")),
empty_units,
Dict("c1" => COMP1),
Dict("constspec" => constspec),
initial_assignments,
empty_rules,
empty_contstraints,
Dict("r1" => constreac),
empty_objectives,
empty_geneproducts,
empty_functiondefs,
empty_events,
nothing,
nothing
parameters = Dict("k1" => (1.0, "")),
compartments = Dict("c1" => COMP1),
species = Dict("constspec" => constspec),
reactions = Dict("r1" => constreac),
)
@test isequal(([ncs], [ncs], [1.0], [1.0]), SBMLToolkit.getreagents(constreac.reactants, constreac.products, constmod))
@test isequal((nothing, nothing, nothing, nothing), SBMLToolkit.getreagents(constreac.reactants, constreac.products, constmod; rev = true))
Expand Down

0 comments on commit eb458c4

Please sign in to comment.