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
#Structure containing information about one reactant in one reaction.
144
144
struct ReactantStruct
145
145
reactant::Symbol
146
-
stoichiometry::Int64
146
+
stoichiometry::Int
147
147
end
148
148
149
149
#Structure containing information about one Reaction. Contain all its substrates and products as well as its rate. Contains an specialized constructor.
@@ -193,7 +193,7 @@ function push_reactions(reactions::Vector{ReactionStruct}, sub_line::Any, prod_l
193
193
end
194
194
195
195
#Recursive function that loops through the reactants in an reaction line and finds the reactants and their stochiometry. Recursion makes it able to handle e.g. 2(X+Y+3(Z+XY)) (probably one will not need it though).
#From the vector with all reactions, generates a dictionary with all reactants. Each reactant will point to a number so that X --> means X will be replaced with u[1] in the equations.
#Produces an array of expressions. Each entry corresponds to a line in the function f, which constitutes the deterministic part of the system. The Expressions can be used for debugging, making LaTex code, or creating the real f function for simulating the network.
@@ -254,7 +254,7 @@ function get_f(reactions::Vector{ReactionStruct}, reactants::OrderedDict{Symbol,
254
254
end
255
255
256
256
#Produces an array of expressions. Each entry corresponds to a line in the function g, which constitutes the stochastic part of the system. Uses the Guillespie Approach for creating Langevin equations. The Expressions can be used for debugging, making LaTex code, or creating the real f function for simulating the network.
g =Vector{Expr}(length(reactions)*length(reactants))
259
259
idx =0
260
260
for reactant inkeys(reactants), i =1:length(reactions)
@@ -276,7 +276,7 @@ function get_stoch_diff(reaction::ReactionStruct, reactant::Symbol)
276
276
end
277
277
278
278
#Creates an expression which can be evaluated to an actual function. Input is an array of expression were each entry is a line in the function. Uses the array of expressions generated in either get_f or get_g.
@@ -285,7 +285,7 @@ function make_func(func_expr::Vector{Expr},reactants::OrderedDict{Symbol,Int64},
285
285
end
286
286
287
287
#Generates two tuples, each with N entries corresponding to the N reactions in the reaction network. The first tuple contains expressions corresponding to reaction rates, the second contains arrays of expressions corresponding to the affect functions. These expressions can be used for debugging, making LaTex code, or creating Cosnstant Rate Jumps for Guilespie simulations.
@@ -304,7 +304,7 @@ function get_jump_expr(reactions::Vector{ReactionStruct}, reactants::OrderedDict
304
304
end
305
305
306
306
#From the tuples created in get_jump_expr, generates an expression which when evaluated will become a tuple of ConstantRateJumps to be used for Guillespie Simulations.
@@ -355,7 +355,7 @@ function recursive_clean!(expr::Any)
355
355
end
356
356
357
357
#Recursively traverses an expression and replace instances of variables and parmaters with things that the DifferentialEquations packakes simulation algorithms can understand. E.g. X --> u[1], kB1 --> p[1] etc.
0 commit comments