model of synthetic band detector system
using OrdinaryDiffEq
using SteadyStateDiffEq
using ComponentArrays: ComponentArray
using SimpleUnPack
using CairoMakiefunction model730!(D, u, p, t)
hil(x, k) = x / (x + k)
hil(x, k, n) = hil(x^n, k^n)
@unpack aG, bG, KL, aL1, aL2, KC, bL, aC, bC, k1, k2, KR, RT, A = p
@unpack G, L, C, R = u
D.G = -bG * G + aG * hil(KL, L, 2)
D.L = -bL * L + aL1 * hil(KC, C, 2) + aL2 * hil(R, KR)
D.C = -bC * C + aC * hil(R, KR)
D.R = -k2 * R + k1 * (RT - 2 * R)^2 * A^2
nothing
end
p0_730 = ComponentArray(
aG=2.0, # muM/min
bG=0.07, # /min
KL=0.8, # muM
aL1=1, # muM/min
aL2=1, # muM/min
KC=0.008, # muM
bL=0.02, # /min
aC=1, # muM/min
bC=0.07, # /min
k1=0.5, # /muM^3 /min
k2=0.02, # /min
KR=0.01, # muM
RT=0.5, # muM
A=0.1,
)
u0 = ComponentArray(
G=0.0,
L=0.0,
C=0.0,
R=0.0,
)ComponentVector{Float64}(G = 0.0, L = 0.0, C = 0.0, R = 0.0)N = 1:100
as = [exp10(-4 + 4*(i-1)/length(N)) for i in N]
prob = SteadyStateProblem(model730!, u0, p0_730)
prob_func = (prob, i, repeat) -> remake(prob, p=ComponentArray(p0_730; A=as[i]))
eprob = EnsembleProblem(prob; prob_func)
@time sol = solve(eprob, DynamicSS(KenCarp47()); trajectories=length(N)) 3.727455 seconds (19.82 M allocations: 1.042 GiB, 14.98% gc time, 175.19% compilation time)
EnsembleSolution Solution of length 100 with uType:
SciMLBase.NonlinearSolution{Float64, 1, ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, SciMLBase.SteadyStateProblem{ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, true, ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(aG = 1, bG = 2, KL = 3, aL1 = 4, aL2 = 5, KC = 6, bL = 7, aC = 8, bC = 9, k1 = 10, k2 = 11, KR = 12, RT = 13, A = 14)}}}, SciMLBase.ODEFunction{true, SciMLBase.FullSpecialize, typeof(Main.var"##250".model730!), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, @NamedTuple{}}}, SteadyStateDiffEq.DynamicSS{OrdinaryDiffEqSDIRK.KenCarp47{0, ADTypes.AutoForwardDiff{nothing, ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}}, Nothing, OrdinaryDiffEqNonlinearSolve.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Nothing}, typeof(OrdinaryDiffEqCore.DEFAULT_PRECS), Val{:forward}(), true, nothing}, Float64}, SciMLBase.ODESolution{Float64, 2, Vector{ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}}}, Nothing, SciMLBase.ODEProblem{ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, Tuple{Float64, Float64}, true, ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(aG = 1, bG = 2, KL = 3, aL1 = 4, aL2 = 5, KC = 6, bL = 7, aC = 8, bC = 9, k1 = 10, k2 = 11, KR = 12, RT = 13, A = 14)}}}, SciMLBase.ODEFunction{true, true, SciMLBase.ODEFunction{true, SciMLBase.FullSpecialize, typeof(Main.var"##250".model730!), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing, Nothing}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, @NamedTuple{}}, SciMLBase.StandardODEProblem}, OrdinaryDiffEqSDIRK.KenCarp47{0, ADTypes.AutoForwardDiff{nothing, ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}}, Nothing, OrdinaryDiffEqNonlinearSolve.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Nothing}, typeof(OrdinaryDiffEqCore.DEFAULT_PRECS), Val{:forward}(), true, nothing}, OrdinaryDiffEqCore.InterpolationData{SciMLBase.ODEFunction{true, true, SciMLBase.ODEFunction{true, SciMLBase.FullSpecialize, typeof(Main.var"##250".model730!), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing, Nothing}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing, Nothing}, Vector{ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}}, Vector{Float64}, Vector{Vector{ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}}}, Nothing, OrdinaryDiffEqSDIRK.KenCarp47Cache{ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, OrdinaryDiffEqNonlinearSolve.NLSolver{OrdinaryDiffEqNonlinearSolve.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Nothing}, true, ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, Float64, Nothing, Float64, OrdinaryDiffEqNonlinearSolve.NLNewtonCache{ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, Float64, Float64, ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, ComponentArrays.ComponentMatrix{Float64, Matrix{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}, ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, ComponentArrays.ComponentMatrix{Float64, Matrix{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}, ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, SciMLBase.UJacobianWrapper{true, SciMLBase.ODEFunction{true, true, SciMLBase.ODEFunction{true, SciMLBase.FullSpecialize, typeof(Main.var"##250".model730!), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing, Nothing}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing, Nothing}, Float64, ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(aG = 1, bG = 2, KL = 3, aL1 = 4, aL2 = 5, KC = 6, bL = 7, aC = 8, bC = 9, k1 = 10, k2 = 11, KR = 12, RT = 13, A = 14)}}}}, Tuple{DifferentiationInterfaceForwardDiffExt.ForwardDiffTwoArgJacobianPrep{Nothing, ForwardDiff.JacobianConfig{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 4, Tuple{ComponentArrays.ComponentVector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 4}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 4}}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, ComponentArrays.ComponentVector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 4}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 4}}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}}}, Tuple{}}, DifferentiationInterfaceForwardDiffExt.ForwardDiffTwoArgJacobianPrep{Nothing, ForwardDiff.JacobianConfig{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 4, Tuple{ComponentArrays.ComponentVector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 4}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 4}}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, ComponentArrays.ComponentVector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 4}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 4}}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}}}, Tuple{}}}, LinearSolve.LinearCache{ComponentArrays.ComponentMatrix{Float64, Matrix{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}, ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, SciMLBase.NullParameters, LinearSolve.DefaultLinearSolver, LinearSolve.DefaultLinearSolverInit{LinearAlgebra.LU{Float64, ComponentArrays.ComponentMatrix{Float64, Matrix{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}, ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, Vector{Int64}}, LinearAlgebra.QRCompactWY{Float64, Matrix{Float64}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Krylov.GmresWorkspace{Float64, Float64, Vector{Float64}}, Tuple{LinearAlgebra.LU{Float64, ComponentArrays.ComponentMatrix{Float64, Matrix{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}, ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, Vector{Int64}}, Vector{Int64}}, Tuple{LinearAlgebra.LU{Float64, ComponentArrays.ComponentMatrix{Float64, Matrix{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}, ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}, Vector{Int64}}, Vector{Int64}}, Nothing, Nothing, Nothing, Nothing, LinearAlgebra.Cholesky{Float64, Matrix{Float64}}, LinearAlgebra.Cholesky{Float64, Matrix{Float64}}, Tuple{LinearAlgebra.LU{Float64, Matrix{Float64}, Vector{Int32}}, Base.RefValue{Int32}}, Tuple{LinearAlgebra.LU{Float64, Matrix{Float64}, Vector{Int64}}, Base.RefValue{Int64}}, LinearAlgebra.QRCompactWY{Float64, Matrix{Float64}, Matrix{Float64}}, Krylov.CraigmrWorkspace{Float64, Float64, Vector{Float64}, Vector{Float64}}, Krylov.LsmrWorkspace{Float64, Float64, Vector{Float64}, Vector{Float64}}, Nothing, Nothing, Nothing, ComponentArrays.ComponentMatrix{Float64, Matrix{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}, ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}}, LinearSolve.InvPreconditioner{LinearAlgebra.Diagonal{Float64, ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}}}, LinearAlgebra.Diagonal{Float64, ComponentArrays.ComponentVector{Float64, Vector{Float64}, Tuple{ComponentArrays.Axis{(G = 1, L = 2, C = 3, R = 4)}}}}, Float64, LinearSolve.LinearVerbosity{SciMLLogging.Silent, SciMLLogging.Silent, SciMLLogging.Silent, SciMLLogging.Silent, SciMLLogging.Silent, SciMLLogging.Silent, SciMLLogging.Silent, SciMLLogging.Silent, SciMLLogging.WarnLevel, SciMLLogging.WarnLevel, SciMLLogging.Silent, SciMLLogging.Silent, SciMLLogging.Silent, SciMLLogging.Silent, SciMLLogging.Silent, SciMLLogging.Silent}, Bool, LinearSolve.LinearSolveAdjoint{Missing}}}, Float64}, OrdinaryDiffEqSDIRK.KenCarp47Tableau{Float64, Float64}, Nothing}, Nothing}, SciMLBase.DEStats, Nothing, Nothing, Nothing, Nothing}, Nothing, Nothing, Nothing}luxI = map(s -> s.u.L, sol)
CI = map(s -> s.u.C, sol)
GFP = map(s -> s.u.G, sol)
fig = Figure()
ax = Axis(fig[1, 1],
xlabel = "External AHL concentration (μM)",
ylabel = "Concentration (μM)",
title = "Fig 7.30",
xscale = log10,
)
lines!(ax, as, GFP, label = "GFP")
lines!(ax, as, CI, label = "cI")
lines!(ax, as, luxI, label = "LuxI")
axislegend(ax, position = :lc)
fig
This notebook was generated using Literate.jl.