Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LCSB-BioCore
SBML.jl
Commits
67f64299
Commit
67f64299
authored
Jul 13, 2021
by
Miroslav Kratochvil
🚴
Browse files
allow rescue in extensive_kinetic_math
closes #117
parent
ea39152c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/utils.jl
View file @
67f64299
...
...
@@ -111,18 +111,21 @@ from amounts to concentrations.
Handling of units in the conversion process is ignored in this version.
"""
function
extensive_kinetic_math
(
m
::
SBML
.
Model
,
formula
::
SBML
.
Math
)
function
extensive_kinetic_math
(
m
::
SBML
.
Model
,
formula
::
SBML
.
Math
;
handle_empty_compartment_size
=
(
id
::
String
)
->
throw
(
DomainError
(
"Non-substance-only-unit reference to species `
$
id' in an unsized compartment `
$
(m.species[id].compartment)'"
,
),
),
)
conv
(
x
::
SBML
.
MathIdent
)
=
begin
haskey
(
m
.
species
,
x
.
id
)
||
return
x
sp
=
m
.
species
[
x
.
id
]
sp
.
only_substance_units
&&
return
x
sz
=
m
.
compartments
[
sp
.
compartment
]
.
size
isnothing
(
sz
)
&&
throw
(
DomainError
(
formula
,
"Non-substance-only-unit reference to species `
$
(x.id)' in an unsized compartment `
$
(sp.compartment)'."
,
),
)
isnothing
(
sz
)
&&
(
sz
=
handle_empty_compartment_size
(
x
.
id
))
SBML
.
MathApply
(
"/"
,
[
x
,
SBML
.
MathVal
(
sz
)])
end
conv
(
x
::
SBML
.
MathApply
)
=
SBML
.
MathApply
(
x
.
fn
,
conv
.
(
x
.
args
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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