Commit 8d14fb90 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil
Browse files

retrieve Species initial amount

(((
Should we also take initialConcentration?

What is the purpose of hasOnlySubstanceUnits then when there's both
initialAmount and initialConcentration?
)))
parent 6fd46e64
......@@ -155,6 +155,7 @@ function extractModel(mdl::VPtr)::Model
for i = 1:ccall(sbml(:Model_getNumSpecies), Cuint, (VPtr,), mdl)
sp = ccall(sbml(:Model_getSpecies), VPtr, (VPtr, Cuint), mdl, i - 1)
sp_fbc = ccall(sbml(:SBase_getPlugin), VPtr, (VPtr, Cstring), sp, "fbc") # FbcSpeciesPlugin_t
formula = nothing
charge = nothing
if sp_fbc != C_NULL
......@@ -167,11 +168,21 @@ function extractModel(mdl::VPtr)::Model
charge = ccall(sbml(:FbcSpeciesPlugin_getCharge), Cint, (VPtr,), sp_fbc)
end
end
ia = nothing
if ccall(sbml(:Species_isSetInitialAmount), Cint, (VPtr,), sp) != 0
ia = (
ccall(sbml(:Species_getInitialAmount), Cdouble, (VPtr,), sp),
get_string(sp, :Species_getSubstanceUnits),
)
end
species[get_string(sp, :Species_getId)] = Species(
get_optional_string(sp, :Species_getName),
get_string(sp, :Species_getCompartment),
formula,
charge,
ia,
ccall(sbml(:Species_getHasOnlySubstanceUnits), Cint, (VPtr,), sp) != 0,
getNotes(sp),
getAnnotation(sp),
......
......@@ -82,10 +82,12 @@ struct Species
compartment::String
formula::Maybe{String}
charge::Maybe{Int}
initial_amount::Maybe{Tuple{Float64,String}}
only_substance_units::Bool
notes::Maybe{String}
annotation::Maybe{String}
Species(na, co, f, ch, osu, no = nothing, a = nothing) = new(na, co, f, ch, osu, no, a)
Species(na, co, f, ch, ia, osu, no = nothing, a = nothing) =
new(na, co, f, ch, ia, osu, no, a)
end
"""
......
Markdown is supported
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