Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LCSB-BioCore
COBREXA.jl
Commits
c7339ee0
Commit
c7339ee0
authored
Aug 10, 2021
by
Miroslav Kratochvil
Browse files
bump SBML compat to 0.7.x
Also closes #427
parent
60a1abab
Pipeline
#45229
passed with stages
in 28 minutes and 19 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Project.toml
View file @
c7339ee0
...
...
@@ -30,7 +30,7 @@ MAT = "0.10"
MacroTools
=
"0.5.6"
OSQP
=
"0.6"
OrderedCollections
=
"1.4"
SBML
=
"0.
6
"
SBML
=
"0.
7
"
Tulip
=
"0.7"
julia
=
"1"
...
...
src/base/types/SBMLModel.jl
View file @
c7339ee0
...
...
@@ -140,8 +140,16 @@ const _sbml_export_notes = _sbml_export_annotation
Return the stoichiometry of reaction with ID `rid`.
"""
reaction_stoichiometry
(
m
::
SBMLModel
,
rid
::
String
)
::
Dict
{
String
,
Float64
}
=
m
.
sbml
.
reactions
[
rid
]
.
stoichiometry
function
reaction_stoichiometry
(
m
::
SBMLModel
,
rid
::
String
)
::
Dict
{
String
,
Float64
}
s
=
Dict
{
String
,
Float64
}()
for
(
mid
,
x
)
in
m
.
sbml
.
reactions
[
rid
]
.
reactants
s
[
mid
]
=
get
(
s
,
mid
,
0.0
)
-
x
end
for
(
mid
,
x
)
in
m
.
sbml
.
reactions
[
rid
]
.
products
s
[
mid
]
=
get
(
s
,
mid
,
0.0
)
+
x
end
return
s
end
"""
Base.convert(::Type{SBMLModel}, mm::MetabolicModel)
...
...
@@ -186,10 +194,14 @@ function Base.convert(::Type{SBMLModel}, mm::MetabolicModel)
),
Dict
(
rid
=>
SBML
.
Reaction
(
Dict
([
Dict
(
mets
[
i
]
=>
-
stoi
[
i
,
ri
]
for
i
in
SparseArrays
.
nonzeroinds
(
stoi
[
:
,
ri
])
if
stoi
[
i
,
ri
]
<=
0
),
Dict
(
mets
[
i
]
=>
stoi
[
i
,
ri
]
for
i
in
SparseArrays
.
nonzeroinds
(
stoi
[
:
,
ri
])
],
),
i
in
SparseArrays
.
nonzeroinds
(
stoi
[
:
,
ri
])
if
stoi
[
i
,
ri
]
>
0
),
(
lbs
[
ri
],
""
),
(
ubs
[
ri
],
""
),
ocs
[
ri
],
...
...
test/base/types/SBMLModel.jl
View file @
c7339ee0
...
...
@@ -8,7 +8,8 @@
@test
Set
(
reactions
(
sbmlm
))
==
Set
(
reactions
(
sm
))
@test
Set
(
metabolites
(
sbmlm
))
==
Set
(
metabolites
(
sbmlm2
))
@test
all
([
sbmlm
.
sbml
.
reactions
[
i
]
.
stoichiometry
==
sbmlm2
.
sbml
.
reactions
[
i
]
.
stoichiometry
for
sbmlm
.
sbml
.
reactions
[
i
]
.
reactants
==
sbmlm2
.
sbml
.
reactions
[
i
]
.
reactants
&&
sbmlm
.
sbml
.
reactions
[
i
]
.
products
==
sbmlm2
.
sbml
.
reactions
[
i
]
.
products
for
i
in
reactions
(
sbmlm2
)
])
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment