Unverified Commit 538c20de authored by Miroslav Kratochvil's avatar Miroslav Kratochvil Committed by GitHub
Browse files

Merge pull request #88 from paulflang/pl-fix_getInitialConcentration

fix getInitialConcentrations
parents 1e9cdb7a 379f6beb
......@@ -247,7 +247,7 @@ function extractModel(mdl::VPtr)::SBML.Model
ic = nothing
if ccall(sbml(:Species_isSetInitialConcentration), Cint, (VPtr,), sp) != 0
ic = (
ccall(sbml(:Species_getInitialAmount), Cdouble, (VPtr,), sp),
ccall(sbml(:Species_getInitialConcentration), Cdouble, (VPtr,), sp),
get_optional_string(sp, :Species_getSubstanceUnits),
)
end
......
......@@ -32,6 +32,14 @@ sbmlfiles = [
4,
3,
),
# a cool model with `initialConcentration` from SBML testsuite
(
joinpath(@__DIR__, "data", "sbml00374.xml"),
"https://raw.githubusercontent.com/sbmlteam/sbml-test-suite/master/cases/semantic/00374/00374-sbml-l3v2.xml",
"424683eea6bbb577aad855d95f2de5183a36e296b06ba18b338572cd7dba6183",
4,
2,
),
]
@testset "Loading of models from various sources" begin
......@@ -77,4 +85,12 @@ end
@test sum(ia for (sp, ia) in SBML.initial_amounts(m)) == 0.001
@test sum(ic for (sp, ic) in SBML.initial_concentrations(m, convert_amounts = true)) ==
0.001
m = readSBML(joinpath(@__DIR__, "data", "sbml00374.xml"))
@test all(isnothing(ic) for (k, ic) in SBML.initial_amounts(m))
@test length(SBML.initial_concentrations(m)) == 4
@test sum(ic for (sp, ic) in SBML.initial_concentrations(m)) == 0.0020800000000000003
@test sum(ia for (sp, ia) in SBML.initial_amounts(m, convert_concentrations = true)) ==
0.25 * 0.0020800000000000003
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment