You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Tuple storing all registered function (for use in various functionalities).
113
+
const registered_funcs = (mm, mmr, hill, hillr, hillar)
114
+
112
115
### Custom CRN FUnction-related Functions ###
113
116
114
117
"""
115
-
expand_registered_functions(expr)
118
+
expand_registered_functions(in)
116
119
117
-
Takes an expression, and expands registered function expressions. E.g. `mm(X,v,K)` is replaced with v*X/(X+K). Currently supported functions: `mm`, `mmr`, `hill`, `hillr`, and `hill`.
120
+
Takes an expression, and expands registered function expressions. E.g. `mm(X,v,K)` is replaced
121
+
with v*X/(X+K). Currently supported functions: `mm`, `mmr`, `hill`, `hillr`, and `hill`. Can
122
+
be applied to a reaction system, a reaction, an equation, or a symbolic expression. The input
123
+
is not modified, while an output with any functions expanded is returned. If applied to a
124
+
reaction system model, any cached network properties are reset.
118
125
"""
119
126
functionexpand_registered_functions(expr)
120
-
iscall(expr) ||return expr
127
+
ifhasnode(is_catalyst_function, expr)
128
+
expr =replacenode(expr, expand_catalyst_function)
129
+
end
130
+
return expr
131
+
end
132
+
133
+
# Checks whether an expression corresponds to a catalyst function call (e.g. `mm(X,v,K)`).
134
+
functionis_catalyst_function(expr)
135
+
iscall(expr) || (returnfalse)
136
+
returnoperation(expr) in registered_funcs
137
+
end
138
+
139
+
# If the input expression corresponds to a catalyst function call (e.g. `mm(X,v,K)`), returns
140
+
# it in its expanded form. If not, returns the input expression.
141
+
functionexpand_catalyst_function(expr)
142
+
is_catalyst_function(expr) || (return expr)
121
143
args =arguments(expr)
122
144
ifoperation(expr) == Catalyst.mm
123
145
return args[2] * args[1] / (args[1] + args[3])
@@ -131,23 +153,50 @@ function expand_registered_functions(expr)
0 commit comments