Commit 9b8e9af2 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil
Browse files

read FBC gene products


Co-authored-by: St. Elmo's avatarst elmo <stelmozors@gmail.com>
parent 2da1a154
......@@ -217,12 +217,37 @@ function extractModel(mdl::VPtr)::Model
)
end
gene_products = Dict{String,GeneProduct}()
if mdl_fbc != C_NULL
for i = 1:ccall(sbml(:FbcModelPlugin_getNumGeneProducts), Cuint, (VPtr,), mdl_fbc)
gp = ccall(
sbml(:FbcModelPlugin_getGeneProduct),
VPtr,
(VPtr, Cuint),
mdl_fbc,
i - 1,
)
id = getOptionalString(gp, :GeneProduct_getId) # IDs don't need to be set
if id != nothing
gene_products[id] = GeneProduct(
getOptionalString(gp, :GeneProduct_getName),
getOptionalString(gp, :GeneProduct_getLabel),
getNotes(gp),
getAnnotation(gp),
)
end
end
end
return Model(
parameters,
units,
compartments,
species,
reactions,
gene_products,
getNotes(mdl),
getAnnotation(mdl),
)
......
......@@ -58,6 +58,17 @@ struct Species
Species(na, co, f, ch, no = nothing, a = nothing) = new(na, co, f, ch, no, a)
end
"""
Gene product metadata.
"""
struct GeneProduct
name::Maybe{String}
label::Maybe{String}
notes::Maybe{String}
annotation::Maybe{String}
GeneProduct(na, l, no = nothing, a = nothing) = new(na, l, no, a)
end
"""
Structure that collects the model-related data. Contains `units`,
`compartments`, `species` and `reactions`. The contained dictionaries are
......@@ -69,7 +80,8 @@ struct Model
compartments::Vector{String}
species::Dict{String,Species}
reactions::Dict{String,Reaction}
gene_products::Dict{String,GeneProduct}
notes::Maybe{String}
annotation::Maybe{String}
Model(p, u, c, s, r, n = nothing, a = nothing) = new(p, u, c, s, r, n, a)
Model(p, u, c, s, r, g, n = nothing, a = nothing) = new(p, u, c, s, r, g, n, 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