Skip to content

Commit 567187c

Browse files
committed
Use submodules
1 parent fb663ba commit 567187c

File tree

6 files changed

+86
-67
lines changed

6 files changed

+86
-67
lines changed

src/DiffEqProblemLibrary.jl

Lines changed: 17 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,23 @@
1-
__precompile__(false)
1+
__precompile__(true)
22

33
module DiffEqProblemLibrary
44

5-
using DiffEqBase, ParameterizedFunctions, DiffEqOperators, DiffEqBiological,
6-
LinearAlgebra
5+
const file = @__FILE__
76

8-
include("ode/ode_premade_problems.jl")
9-
include("dae_premade_problems.jl")
10-
include("dde_premade_problems.jl")
11-
include("sde_premade_problems.jl")
12-
include("jump_premade_problems.jl")
13-
14-
#ODE Example Problems
15-
export prob_ode_linear, prob_ode_bigfloatlinear, prob_ode_2Dlinear,
16-
prob_ode_large2Dlinear, prob_ode_bigfloat2Dlinear, prob_ode_rigidbody,
17-
prob_ode_2Dlinear_notinplace, prob_ode_vanderpol, prob_ode_vanderpol_stiff,
18-
prob_ode_lorenz, prob_ode_rober, prob_ode_threebody, prob_ode_mm_linear, prob_ode_pleiades,
19-
prob_ode_brusselator_1d, prob_ode_brusselator_2d, prob_ode_orego,
20-
prob_ode_hires, prob_ode_pollution, prob_ode_filament,
21-
SolverDiffEq, filament_prob
22-
23-
#SDE Example Problems
24-
export prob_sde_wave, prob_sde_linear, prob_sde_cubic, prob_sde_2Dlinear,
25-
prob_sde_lorenz, prob_sde_2Dlinear, prob_sde_additive,
26-
prob_sde_additivesystem, oval2ModelExample, prob_sde_bistable,
27-
prob_sde_bruss, prob_sde_oscilreact
28-
29-
#SDE Stratonovich Example Problems
30-
export prob_sde_linear_stratonovich, prob_sde_2Dlinear_stratonovich
31-
32-
#DAE Example Problems
33-
export prob_dae_resrob
34-
35-
# DDE Example Problems
36-
# examples with constant delays
37-
export prob_dde_1delay, prob_dde_1delay_notinplace, prob_dde_1delay_scalar_notinplace,
38-
prob_dde_2delays, prob_dde_2delays_notinplace, prob_dde_2delays_scalar_notinplace,
39-
prob_dde_1delay_long, prob_dde_1delay_long_notinplace,
40-
prob_dde_1delay_long_scalar_notinplace, prob_dde_2delays_long,
41-
prob_dde_2delays_long_notinplace, prob_dde_2delays_long_scalar_notinplace,
42-
prob_dde_mackey, prob_dde_wheldon, prob_dde_qs,
43-
# examples with vanishing time dependent delays
44-
prob_ddde_neves1, prob_dde_neves_thompson,
45-
# examples with state dependent delays
46-
prob_dde_paul1, prob_dde_paul2, prob_dde_mahaffy1, prob_dde_mahaffy2,
47-
# examples with vanishing state dependent delays
48-
prob_neves2, prob_dde_gatica
49-
50-
# Jump Example Problems
51-
export prob_jump_dnarepressor, prob_jump_constproduct, prob_jump_nonlinrxs,
52-
# examples mixing mass action and constant rate jumps
53-
prob_jump_osc_mixed_jumptypes,
54-
# examples used in published benchmarks / comparisions
55-
prob_jump_multistate, prob_jump_twentygenes, prob_jump_dnadimer_repressor,
56-
# examples approximating diffusion by continuous time random walks
57-
prob_jump_diffnetwork
7+
module ODEProblemLibrary
8+
importodeproblems() = @eval ODEProblemLibrary include(joinpath(@__DIR__, "ode/ode_premade_problems.jl"))
9+
end # module
10+
module DAEProblemLibrary
11+
importdaeproblems() = @eval DAEProblemLibrary include(joinpath(@__DIR__, "dae_premade_problems.jl"))
12+
end # module
13+
module DDEProblemLibrary
14+
importddeproblems() = @eval DDEProblemLibrary include(joinpath(@__DIR__, "dde_premade_problems.jl"))
15+
end # module
16+
module SDEProblemLibrary
17+
importsdeproblems() = @eval SDEProblemLibrary include(joinpath(@__DIR__, "sde_premade_problems.jl"))
18+
end # module
19+
module JumpProblemLibrary
20+
importjumpproblems() = @eval JumpProblemLibrary include(joinpath(@__DIR__, "src/jump_premade_problems.jl"))
21+
end # module
5822

5923
end # module

src/dae_premade_problems.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
using DiffEqBase
2+
3+
#DAE Example Problems
4+
export prob_dae_resrob
5+
16
### DAE Problems
27

38
f = function (r, yp, y, p, tres)

src/dde_premade_problems.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
module DAEProblemLibrary
2+
using DiffEqBase
3+
# DDE Example Problems
4+
# examples with constant delays
5+
export prob_dde_1delay, prob_dde_1delay_notinplace, prob_dde_1delay_scalar_notinplace,
6+
prob_dde_2delays, prob_dde_2delays_notinplace, prob_dde_2delays_scalar_notinplace,
7+
prob_dde_1delay_long, prob_dde_1delay_long_notinplace,
8+
prob_dde_1delay_long_scalar_notinplace, prob_dde_2delays_long,
9+
prob_dde_2delays_long_notinplace, prob_dde_2delays_long_scalar_notinplace,
10+
prob_dde_mackey, prob_dde_wheldon, prob_dde_qs,
11+
# examples with vanishing time dependent delays
12+
prob_ddde_neves1, prob_dde_neves_thompson,
13+
# examples with state dependent delays
14+
prob_dde_paul1, prob_dde_paul2, prob_dde_mahaffy1, prob_dde_mahaffy2,
15+
# examples with vanishing state dependent delays
16+
prob_neves2, prob_dde_gatica
17+
18+
119
# DDE examples with analytical solution
220

321
## Single constant delay
@@ -640,3 +658,4 @@ prob_dde_qs = build_prob_dde_qs([1; 8.4e8; 2.5e-9; 7.6e-8; 5e-15], # initial val
640658
0.1, 1.3e-12, 0.38, 1.3, 0.66, 2.3e-19, 2.3e-18, 70e-9,
641659
2.3, 0.05, 4e4, 5e-7, 0.080, 1.5e-4, 1.1e-8, 70e-9, 2.5,
642660
0.005)
661+
end # module

src/jump_premade_problems.jl

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
"""
1+
using DiffEqBase, DiffEqBiological
2+
# Jump Example Problems
3+
export prob_jump_dnarepressor, prob_jump_constproduct, prob_jump_nonlinrxs,
4+
# examples mixing mass action and constant rate jumps
5+
prob_jump_osc_mixed_jumptypes,
6+
# examples used in published benchmarks / comparisions
7+
prob_jump_multistate, prob_jump_twentygenes, prob_jump_dnadimer_repressor,
8+
# examples approximating diffusion by continuous time random walks
9+
prob_jump_diffnetwork
10+
11+
"""
212
General structure to hold JumpProblem info. Needed since
3-
the JumpProblem constructor requires the algorithm, so we
13+
the JumpProblem constructor requires the algorithm, so we
414
don't create the JumpProblem here.
515
"""
6-
struct JumpProblemNetwork
16+
struct JumpProblemNetwork
717
network # DiffEqBiological network
818
rates # vector of rate constants or nothing
919
tstop # time to end simulation
@@ -28,7 +38,7 @@ Nsims = 8000
2838
expected_avg = 5.926553750000000e+02
2939
prob_data = Dict("num_sims_for_mean" => Nsims, "expected_mean" => expected_avg)
3040
"""
31-
DNA negative feedback autoregulatory model. Protein acts as repressor.
41+
DNA negative feedback autoregulatory model. Protein acts as repressor.
3242
"""
3343
prob_jump_dnarepressor = JumpProblemNetwork(dna_rs, rates, tf, u0, prob, prob_data)
3444

@@ -50,7 +60,7 @@ prob_jump_constproduct = JumpProblemNetwork(bd_rs, rates, tf, u0, prob, prob_dat
5060

5161
nonlin_rs = @reaction_network dtype begin
5262
k1, 2A --> B
53-
k2, B --> 2A
63+
k2, B --> 2A
5464
k3, A + B --> C
5565
k4, C --> A + B
5666
k5, 3C --> 3A
@@ -132,12 +142,12 @@ u0[ findfirst(rs.syms, :S3) ] = params[3]
132142
tf = 100.
133143
prob = DiscreteProblem(u0, (0., tf), rates)
134144
"""
135-
Multistate model from Gupta and Mendes,
145+
Multistate model from Gupta and Mendes,
136146
"An Overview of Network-Based and -Free Approaches for Stochastic Simulation of Biochemical Systems",
137147
Computation 2018, 6, 9; doi:10.3390/computation6010009
138148
Translated from supplementary data file: Models/Multi-state/fixed_multistate.xml
139149
"""
140-
prob_jump_multistate = JumpProblemNetwork(rs, rates, tf, u0, prob,
150+
prob_jump_multistate = JumpProblemNetwork(rs, rates, tf, u0, prob,
141151
Dict("specs_to_sym_name" => specs_sym_to_name, "rates_sym_to_idx" => rates_sym_to_idx, "params" => params))
142152

143153

@@ -162,14 +172,14 @@ genenetwork *= "end"
162172
rs = eval( parse(genenetwork) )
163173
u0 = zeros(Int, length(rs.syms))
164174
for i = 1:(2*N)
165-
u0[findfirst(rs.syms, Symbol("G$(i)"))] = 1
175+
u0[findfirst(rs.syms, Symbol("G$(i)"))] = 1
166176
end
167177
tf = 2000.0
168178
prob = DiscreteProblem(u0, (0.0, tf))
169179
"""
170-
Twenty-gene model from McCollum et al,
180+
Twenty-gene model from McCollum et al,
171181
"The sorting direct method for stochastic simulation of biochemical systems with varying reaction execution behavior"
172-
Comp. Bio. and Chem., 30, pg. 39-49 (2006).
182+
Comp. Bio. and Chem., 30, pg. 39-49 (2006).
173183
"""
174184
prob_jump_twentygenes = JumpProblemNetwork(rs, nothing, tf, u0, prob, nothing)
175185

@@ -191,11 +201,11 @@ tf = 4000.
191201
prob = DiscreteProblem(u0, (0.0, tf), rnpar)
192202
"""
193203
Negative feedback autoregulatory gene expression model. Dimer is the repressor.
194-
Taken from Marchetti, Priami and Thanh,
195-
"Simulation Algorithms for Comptuational Systems Biology",
204+
Taken from Marchetti, Priami and Thanh,
205+
"Simulation Algorithms for Comptuational Systems Biology",
196206
Springer (2017).
197207
"""
198-
prob_jump_dnadimer_repressor = JumpProblemNetwork(rn, rnpar, tf, u0, prob,
208+
prob_jump_dnadimer_repressor = JumpProblemNetwork(rn, rnpar, tf, u0, prob,
199209
Dict("specs_names" => varlabels))
200210

201211

@@ -217,7 +227,7 @@ end
217227
tf = 10.
218228
"""
219229
Continuous time random walk (i.e. diffusion approximation) example.
220-
Here the network in the JumpProblemNetwork is a function that returns a
230+
Here the network in the JumpProblemNetwork is a function that returns a
221231
network given the number of lattice sites.
222232
u0 is a similar function that returns the initial condition vector.
223233
"""

src/ode/ode_premade_problems.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1+
using DiffEqBase, ParameterizedFunctions, DiffEqOperators, Random, LinearAlgebra
2+
13
srand(100)
24

5+
#ODE Example Problems
6+
export prob_ode_linear, prob_ode_bigfloatlinear, prob_ode_2Dlinear,
7+
prob_ode_large2Dlinear, prob_ode_bigfloat2Dlinear, prob_ode_rigidbody,
8+
prob_ode_2Dlinear_notinplace, prob_ode_vanderpol, prob_ode_vanderpol_stiff,
9+
prob_ode_lorenz, prob_ode_rober, prob_ode_threebody, prob_ode_mm_linear, prob_ode_pleiades,
10+
prob_ode_brusselator_1d, prob_ode_brusselator_2d, prob_ode_orego,
11+
prob_ode_hires, prob_ode_pollution, prob_ode_filament,
12+
SolverDiffEq, filament_prob
13+
314
include("ode_linear_prob.jl")
415
include("ode_simple_nonlinear_prob.jl")
516
include("brusselator_prob.jl")

src/sde_premade_problems.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
using DiffEqBase, ParameterizedFunctions, DiffEqBiological
2+
#SDE Example Problems
3+
export prob_sde_wave, prob_sde_linear, prob_sde_cubic, prob_sde_2Dlinear,
4+
prob_sde_lorenz, prob_sde_2Dlinear, prob_sde_additive,
5+
prob_sde_additivesystem, oval2ModelExample, prob_sde_bistable,
6+
prob_sde_bruss, prob_sde_oscilreact
7+
#SDE Stratonovich Example Problems
8+
export prob_sde_linear_stratonovich, prob_sde_2Dlinear_stratonovich
9+
10+
111
### SDE Examples
212

313
f = (u,p,t) -> 1.01u

0 commit comments

Comments
 (0)