Skip to content

Commit 751c5c5

Browse files
committed
format
1 parent 5b52c81 commit 751c5c5

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

src/rules.jl

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -21,49 +21,49 @@ function get_rules(model)
2121
algeqs, obseqs, raterules
2222
end
2323

24-
25-
extensive_kinetic_math(m::SBML.Model, formula::SBML.Math) = SBML.interpret_math( # TODO: move this to SBML.jl
26-
formula,
27-
map_apply = (x, rec) -> SBML.MathApply(x.fn, rec.(x.args)),
28-
map_const = identity,
29-
map_ident = (x::SBML.MathIdent) -> begin
30-
haskey(m.reactions, x.id) && return m.reactions[x.id].kinetic_math
31-
haskey(m.species, x.id) || return x
32-
sp = m.species[x.id]
33-
sp.only_substance_units && return x
34-
if isnothing(m.compartments[sp.compartment].size) &&
35-
!seemsdefined(sp.compartment, m)
36-
if m.compartments[sp.compartment].spatial_dimensions == 0
37-
# If the compartment ID doesn't seem directly defined anywhere
38-
# and it is a zero-dimensional unsized compartment, just avoid
39-
# any sizing questions.
40-
return x
41-
else
42-
# In case the compartment is expected to be defined, complain.
43-
throw(
44-
DomainError(
24+
function extensive_kinetic_math(m::SBML.Model, formula::SBML.Math)
25+
SBML.interpret_math( # TODO: move this to SBML.jl
26+
formula,
27+
map_apply = (x, rec) -> SBML.MathApply(x.fn, rec.(x.args)),
28+
map_const = identity,
29+
map_ident = (x::SBML.MathIdent) -> begin
30+
haskey(m.reactions, x.id) && return m.reactions[x.id].kinetic_math
31+
haskey(m.species, x.id) || return x
32+
sp = m.species[x.id]
33+
sp.only_substance_units && return x
34+
if isnothing(m.compartments[sp.compartment].size) &&
35+
!seemsdefined(sp.compartment, m)
36+
if m.compartments[sp.compartment].spatial_dimensions == 0
37+
# If the compartment ID doesn't seem directly defined anywhere
38+
# and it is a zero-dimensional unsized compartment, just avoid
39+
# any sizing questions.
40+
return x
41+
else
42+
# In case the compartment is expected to be defined, complain.
43+
throw(
44+
DomainError(
4545
sp.compartment,
46-
"compartment size is insufficiently defined",
46+
"compartment size is insufficiently defined"
4747
),
48-
)
48+
)
49+
end
50+
else
51+
# Now we are sure that the model either has the compartment with
52+
# constant size, or the definition is easily reachable. So just use
53+
# the compartment ID as a variable to compute the concentration (or
54+
# area-centration etc, with different dimensionalities) by dividing
55+
# it.
56+
return SBML.MathApply("/", [x, SBML.MathIdent(sp.compartment)])
4957
end
50-
else
51-
# Now we are sure that the model either has the compartment with
52-
# constant size, or the definition is easily reachable. So just use
53-
# the compartment ID as a variable to compute the concentration (or
54-
# area-centration etc, with different dimensionalities) by dividing
55-
# it.
56-
return SBML.MathApply("/", [x, SBML.MathIdent(sp.compartment)])
57-
end
58-
end,
59-
map_lambda = (x, _) -> error(
60-
ErrorException("converting lambdas to extensive kinetic math is not supported"),
61-
),
62-
map_time = identity,
63-
map_avogadro = identity,
64-
map_value = identity,
65-
)
66-
58+
end,
59+
map_lambda = (x, _) -> error(
60+
ErrorException("converting lambdas to extensive kinetic math is not supported"),
61+
),
62+
map_time = identity,
63+
map_avogadro = identity,
64+
map_value = identity
65+
)
66+
end
6767

6868
function get_var_and_assignment(model, rule)
6969
if !haskey(merge(model.species, model.compartments, model.parameters), rule.variable)

0 commit comments

Comments
 (0)