Unverified Commit cfe20e2a authored by Laurent Heirendt's avatar Laurent Heirendt Committed by GitHub
Browse files

Merge pull request #547 from LCSB-BioCore/mk-fix-544-remove

Revert "Merge pull request #544 from LCSB-BioCore/mk-sbml-091"
parents 553ed70c 462538fc
Pipeline #51145 passed with stages
in 16 minutes and 53 seconds
......@@ -133,7 +133,6 @@ windows10:julia1.7:
mac:julia1.7:
stage: test-compat
allow_failure: true
<<: *global_trigger_compat_tests
<<: *global_julia17
<<: *global_env_mac
......@@ -152,7 +151,6 @@ windows10:julia1.6:
mac:julia1.6:
stage: test-compat
allow_failure: true
<<: *global_trigger_compat_tests
<<: *global_julia16
<<: *global_env_mac
......
......@@ -28,7 +28,7 @@ MAT = "0.10"
MacroTools = "0.5.6"
OSQP = "0.6"
OrderedCollections = "1.4"
SBML = "0.9.1"
SBML = "0.7, 0.8.2"
StableRNGs = "1.0"
Tulip = "0.7"
julia = "1.5"
......
......@@ -165,54 +165,65 @@ function Base.convert(::Type{SBMLModel}, mm::MetabolicModel)
rxns = reactions(mm)
stoi = stoichiometry(mm)
(lbs, ubs) = bounds(mm)
ocs = objective(mm)
comps = _default.("", metabolite_compartment.(Ref(mm), mets))
compss = Set(comps)
return SBMLModel(
SBML.Model(
units = Dict("" => []), # units
compartments = Dict(comp => SBML.Compartment() for comp in compss),
species = Dict(
Dict(), # parameters
Dict("" => 1), # units
Dict(
comp =>
SBML.Compartment(nothing, nothing, nothing, nothing, nothing, nothing)
for comp in compss
),
Dict(
mid => SBML.Species(
compartment = _default("", comps[mi]), # compartment
formula = metabolite_formula(mm, mid),
charge = metabolite_charge(mm, mid),
notes = _sbml_export_notes(metabolite_notes(mm, mid)),
annotation = _sbml_export_annotation(metabolite_annotations(mm, mid)),
nothing, # name
_default("", comps[mi]), # compartment
nothing, # no information about boundary conditions
metabolite_formula(mm, mid),
metabolite_charge(mm, mid),
nothing, # initial amount
nothing, # initial concentration
nothing, # only substance unit flags
_sbml_export_notes(metabolite_notes(mm, mid)),
_sbml_export_annotation(metabolite_annotations(mm, mid)),
) for (mi, mid) in enumerate(mets)
),
reactions = Dict(
Dict(
rid => SBML.Reaction(
reactants = Dict(
Dict(
mets[i] => -stoi[i, ri] for
i in SparseArrays.nonzeroinds(stoi[:, ri]) if stoi[i, ri] <= 0
),
products = Dict(
Dict(
mets[i] => stoi[i, ri] for
i in SparseArrays.nonzeroinds(stoi[:, ri]) if stoi[i, ri] > 0
),
kinetic_parameters = Dict(
"LOWER_BOUND" => (lbs[ri], ""),
"UPPER_BOUND" => (ubs[ri], ""),
),
gene_product_association = _maybemap(
(lbs[ri], ""),
(ubs[ri], ""),
ocs[ri],
_maybemap(
x -> _unparse_grr(SBML.GeneProductAssociation, x),
reaction_gene_association(mm, rid),
),
reversible = true,
notes = _sbml_export_notes(reaction_notes(mm, rid)),
annotation = _sbml_export_annotation(reaction_annotations(mm, rid)),
nothing, # no kinetic math
true, # reversible by default
_sbml_export_notes(reaction_notes(mm, rid)),
_sbml_export_annotation(reaction_annotations(mm, rid)),
) for (ri, rid) in enumerate(rxns)
),
gene_products = Dict(
Dict(
gid => SBML.GeneProduct(
notes = _sbml_export_notes(gene_notes(mm, gid)),
annotation = _sbml_export_annotation(gene_annotations(mm, gid)),
nothing,
nothing,
_sbml_export_notes(gene_notes(mm, gid)),
_sbml_export_annotation(gene_annotations(mm, gid)),
) for gid in genes(mm)
),
objective = Dict(
rid => oc for (rid, oc) in zip(rxns, objective(mm)) if oc != 0
),
Dict(), # function definitions
),
)
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