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

load FBC charges

parent 31e63fe7
......@@ -82,16 +82,28 @@ function extractModel(mdl::VPtr)::Model
sp = ccall(sbml(:Model_getSpecies), VPtr, (VPtr, Cuint), mdl, i - 1)
sp_fbc = ccall(sbml(:SBase_getPlugin), VPtr, (VPtr, Cstring), sp, "fbc")
formula = ""
if sp_fbc != C_NULL &&
0 != ccall(sbml(:FbcSpeciesPlugin_isSetChemicalFormula), Cint, (VPtr,), sp_fbc)
formula = unsafe_string(
ccall(sbml(:FbcSpeciesPlugin_getChemicalFormula), Cstring, (VPtr,), sp_fbc),
)
charge = nothing
if sp_fbc != C_NULL
if 0 !=
ccall(sbml(:FbcSpeciesPlugin_isSetChemicalFormula), Cint, (VPtr,), sp_fbc)
formula = unsafe_string(
ccall(
sbml(:FbcSpeciesPlugin_getChemicalFormula),
Cstring,
(VPtr,),
sp_fbc,
),
)
end
if 0 != ccall(sbml(:FbcSpeciesPlugin_isSetCharge), Cint, (VPtr,), sp_fbc)
charge = ccall(sbml(:FbcSpeciesPlugin_getCharge), Cint, (VPtr,), sp_fbc)
end
end
species[unsafe_string(ccall(sbml(:Species_getId), Cstring, (VPtr,), sp))] = Species(
unsafe_string(ccall(sbml(:Species_getName), Cstring, (VPtr,), sp)),
unsafe_string(ccall(sbml(:Species_getCompartment), Cstring, (VPtr,), sp)),
formula,
charge,
)
end
......
......@@ -42,7 +42,8 @@ struct Species
name::String
compartment::String
formula::String
Species(n, c, f) = new(n, c, f)
charge::Union{Nothing,Int}
Species(n, co, f, ch) = new(n, co, f, ch)
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