Sensitivity to ISO#
using ModelingToolkit
using OrdinaryDiffEq
using SteadyStateDiffEq
using Plots
using LsqFit
using CaMKIIModel
using CaMKIIModel: μM, hil, Hz, hilr, second
Plots.default(lw=1.5)
Setup b1AR system#
@parameters ATP = 5000μM ISO = 0μM
sys = get_bar_sys(ATP, ISO; simplify=true)
\[\begin{split} \begin{align}
\frac{\mathrm{d} \mathtt{LR}\left( t \right)}{\mathrm{d}t} &= - \mathtt{kf\_bARK} \mathtt{LR}\left( t \right) - \mathtt{kr\_LR} \mathtt{LR}\left( t \right) + \mathtt{kr\_LRG} \mathtt{LRG}\left( t \right) + \mathtt{kr\_bARK} \mathtt{b1AR\_S464}\left( t \right) + \mathtt{ISO} \mathtt{kf\_LR} \mathtt{b1AR}\left( t \right) - \mathtt{kf\_LRG} \mathtt{LR}\left( t \right) \mathtt{Gs}\left( t \right) - \mathtt{kf\_PKA} \mathtt{PKACI}\left( t \right) \mathtt{LR}\left( t \right) \\
\frac{\mathrm{d} \mathtt{LRG}\left( t \right)}{\mathrm{d}t} &= - \mathtt{k\_G\_act} \mathtt{LRG}\left( t \right) - \mathtt{kf\_bARK} \mathtt{LRG}\left( t \right) - \mathtt{kr\_LRG} \mathtt{LRG}\left( t \right) + \mathtt{kf\_LRG} \mathtt{LR}\left( t \right) \mathtt{Gs}\left( t \right) - \mathtt{kf\_PKA} \mathtt{PKACI}\left( t \right) \mathtt{LRG}\left( t \right) \\
\frac{\mathrm{d} \mathtt{RG}\left( t \right)}{\mathrm{d}t} &= - \mathtt{k\_G\_act} \mathtt{RG}\left( t \right) - \mathtt{kr\_RG} \mathtt{RG}\left( t \right) + \mathtt{kf\_RG} \mathtt{Gs}\left( t \right) \mathtt{b1AR}\left( t \right) \\
\frac{\mathrm{d} \mathtt{GsaGTP}\left( t \right)}{\mathrm{d}t} &= \mathtt{k\_G\_act} \mathtt{RG}\left( t \right) + \mathtt{k\_G\_act} \mathtt{LRG}\left( t \right) - \mathtt{k\_G\_hyd} \mathtt{GsaGTP}\left( t \right) + \mathtt{kr\_AC\_Gsa} \mathtt{AC\_GsaGTP}\left( t \right) - \mathtt{kf\_AC\_Gsa} \mathtt{AC}\left( t \right) \mathtt{GsaGTP}\left( t \right) \\
\frac{\mathrm{d} \mathtt{GsaGDP}\left( t \right)}{\mathrm{d}t} &= \mathtt{k\_G\_hyd} \mathtt{AC\_GsaGTP}\left( t \right) + \mathtt{k\_G\_hyd} \mathtt{GsaGTP}\left( t \right) - \mathtt{k\_G\_reassoc} \mathtt{Gsby}\left( t \right) \mathtt{GsaGDP}\left( t \right) \\
\frac{\mathrm{d} \mathtt{b1AR\_S464}\left( t \right)}{\mathrm{d}t} &= \mathtt{kf\_bARK} \mathtt{LR}\left( t \right) + \mathtt{kf\_bARK} \mathtt{LRG}\left( t \right) - \mathtt{kr\_bARK} \mathtt{b1AR\_S464}\left( t \right) \\
\frac{\mathrm{d} \mathtt{b1AR\_S301}\left( t \right)}{\mathrm{d}t} &= - \mathtt{kr\_PKA} \mathtt{b1AR\_S301}\left( t \right) + \mathtt{kf\_PKA} \mathtt{PKACI}\left( t \right) \mathtt{LR}\left( t \right) + \mathtt{kf\_PKA} \mathtt{PKACI}\left( t \right) \mathtt{LRG}\left( t \right) + \mathtt{kf\_PKA} \mathtt{PKACI}\left( t \right) \mathtt{b1AR}\left( t \right) \\
\frac{\mathrm{d} \mathtt{AC\_GsaGTP}\left( t \right)}{\mathrm{d}t} &= - \mathtt{k\_G\_hyd} \mathtt{AC\_GsaGTP}\left( t \right) - \mathtt{kr\_AC\_Gsa} \mathtt{AC\_GsaGTP}\left( t \right) + \mathtt{kf\_AC\_Gsa} \mathtt{AC}\left( t \right) \mathtt{GsaGTP}\left( t \right) \\
\frac{\mathrm{d} \mathtt{PDEp}\left( t \right)}{\mathrm{d}t} &= - \mathtt{k\_PP\_PDE} \mathtt{PDEp}\left( t \right) + \mathtt{k\_PKA\_PDE} \mathtt{PDE}\left( t \right) \mathtt{PKACII}\left( t \right) \\
\frac{\mathrm{d} \mathtt{cAMP}\left( t \right)}{\mathrm{d}t} &= \frac{\mathtt{ATP} \mathtt{k\_AC\_basal} \mathtt{AC}\left( t \right)}{\mathtt{ATP} + \mathtt{Km\_AC\_basal}} + \frac{\mathtt{ATP} \mathtt{k\_AC\_Gsa} \mathtt{AC\_GsaGTP}\left( t \right)}{\mathtt{ATP} + \mathtt{Km\_AC\_Gsa}} + \frac{\left( - \mathtt{k\_cAMP\_PDE} \mathtt{PDE}\left( t \right) - \mathtt{k\_cAMP\_PDEp} \mathtt{PDEp}\left( t \right) \right) \mathtt{cAMP}\left( t \right)}{\mathtt{Km\_PDE\_cAMP} + \mathtt{cAMP}\left( t \right)} + \mathtt{kr\_RC\_cAMP} \mathtt{RCcAMP\_I}\left( t \right) + \mathtt{kr\_RC\_cAMP} \mathtt{RCcAMP\_II}\left( t \right) + \mathtt{kr\_RCcAMP\_cAMP} \mathtt{RCcAMPcAMP\_II}\left( t \right) + \mathtt{kr\_RCcAMP\_cAMP} \mathtt{RCcAMPcAMP\_I}\left( t \right) - \mathtt{kf\_RC\_cAMP} \mathtt{RC\_II}\left( t \right) \mathtt{cAMP}\left( t \right) - \mathtt{kf\_RC\_cAMP} \mathtt{RC\_I}\left( t \right) \mathtt{cAMP}\left( t \right) - \mathtt{kf\_RCcAMP\_cAMP} \mathtt{RCcAMP\_I}\left( t \right) \mathtt{cAMP}\left( t \right) - \mathtt{kf\_RCcAMP\_cAMP} \mathtt{RCcAMP\_II}\left( t \right) \mathtt{cAMP}\left( t \right) \\
\frac{\mathrm{d} \mathtt{RCcAMP\_I}\left( t \right)}{\mathrm{d}t} &= - \mathtt{kr\_RC\_cAMP} \mathtt{RCcAMP\_I}\left( t \right) + \mathtt{kr\_RCcAMP\_cAMP} \mathtt{RCcAMPcAMP\_I}\left( t \right) + \mathtt{kf\_RC\_cAMP} \mathtt{RC\_I}\left( t \right) \mathtt{cAMP}\left( t \right) - \mathtt{kf\_RCcAMP\_cAMP} \mathtt{RCcAMP\_I}\left( t \right) \mathtt{cAMP}\left( t \right) \\
\frac{\mathrm{d} \mathtt{RCcAMP\_II}\left( t \right)}{\mathrm{d}t} &= - \mathtt{kr\_RC\_cAMP} \mathtt{RCcAMP\_II}\left( t \right) + \mathtt{kr\_RCcAMP\_cAMP} \mathtt{RCcAMPcAMP\_II}\left( t \right) + \mathtt{kf\_RC\_cAMP} \mathtt{RC\_II}\left( t \right) \mathtt{cAMP}\left( t \right) - \mathtt{kf\_RCcAMP\_cAMP} \mathtt{RCcAMP\_II}\left( t \right) \mathtt{cAMP}\left( t \right) \\
\frac{\mathrm{d} \mathtt{RCcAMPcAMP\_I}\left( t \right)}{\mathrm{d}t} &= - \mathtt{kf\_RcAMPcAMP\_C} \mathtt{RCcAMPcAMP\_I}\left( t \right) - \mathtt{kr\_RCcAMP\_cAMP} \mathtt{RCcAMPcAMP\_I}\left( t \right) + \mathtt{kf\_RCcAMP\_cAMP} \mathtt{RCcAMP\_I}\left( t \right) \mathtt{cAMP}\left( t \right) + \mathtt{kr\_RcAMPcAMP\_C} \mathtt{PKACI}\left( t \right) \mathtt{RcAMPcAMP\_I}\left( t \right) \\
\frac{\mathrm{d} \mathtt{RCcAMPcAMP\_II}\left( t \right)}{\mathrm{d}t} &= - \mathtt{kf\_RcAMPcAMP\_C} \mathtt{RCcAMPcAMP\_II}\left( t \right) - \mathtt{kr\_RCcAMP\_cAMP} \mathtt{RCcAMPcAMP\_II}\left( t \right) + \mathtt{kf\_RCcAMP\_cAMP} \mathtt{RCcAMP\_II}\left( t \right) \mathtt{cAMP}\left( t \right) + \mathtt{kr\_RcAMPcAMP\_C} \mathtt{PKACII}\left( t \right) \mathtt{RcAMPcAMP\_II}\left( t \right) \\
\frac{\mathrm{d} \mathtt{PKACI}\left( t \right)}{\mathrm{d}t} &= \mathtt{kf\_RcAMPcAMP\_C} \mathtt{RCcAMPcAMP\_I}\left( t \right) + \mathtt{kr\_PKA\_PKI} \mathtt{PKACI\_PKI}\left( t \right) - \mathtt{kf\_PKA\_PKI} \mathtt{PKACI}\left( t \right) \mathtt{PKI}\left( t \right) - \mathtt{kr\_RcAMPcAMP\_C} \mathtt{PKACI}\left( t \right) \mathtt{RcAMPcAMP\_I}\left( t \right) \\
\frac{\mathrm{d} \mathtt{PKACII}\left( t \right)}{\mathrm{d}t} &= \mathtt{kf\_RcAMPcAMP\_C} \mathtt{RCcAMPcAMP\_II}\left( t \right) + \mathtt{kr\_PKA\_PKI} \mathtt{PKACII\_PKI}\left( t \right) - \mathtt{kf\_PKA\_PKI} \mathtt{PKI}\left( t \right) \mathtt{PKACII}\left( t \right) - \mathtt{kr\_RcAMPcAMP\_C} \mathtt{PKACII}\left( t \right) \mathtt{RcAMPcAMP\_II}\left( t \right) \\
\frac{\mathrm{d} \mathtt{PKACI\_PKI}\left( t \right)}{\mathrm{d}t} &= - \mathtt{kr\_PKA\_PKI} \mathtt{PKACI\_PKI}\left( t \right) + \mathtt{kf\_PKA\_PKI} \mathtt{PKACI}\left( t \right) \mathtt{PKI}\left( t \right) \\
\frac{\mathrm{d} \mathtt{PKACII\_PKI}\left( t \right)}{\mathrm{d}t} &= - \mathtt{kr\_PKA\_PKI} \mathtt{PKACII\_PKI}\left( t \right) + \mathtt{kf\_PKA\_PKI} \mathtt{PKI}\left( t \right) \mathtt{PKACII}\left( t \right) \\
\frac{\mathrm{d} \mathtt{I1p}\left( t \right)}{\mathrm{d}t} &= \frac{\mathtt{k\_PKA\_I1} \mathtt{PKACI}\left( t \right) \mathtt{I1}\left( t \right)}{\mathtt{Km\_PKA\_I1} + \mathtt{I1}\left( t \right)} + \frac{ - \mathtt{Vmax\_PP2A\_I1} \mathtt{I1p}\left( t \right)}{\mathtt{Km\_PP2A\_I1} + \mathtt{I1p}\left( t \right)} + \mathtt{kr\_PP1\_I1} \mathtt{I1p\_PP1}\left( t \right) - \mathtt{kf\_PP1\_I1} \mathtt{PP1}\left( t \right) \mathtt{I1p}\left( t \right) \\
\frac{\mathrm{d} \mathtt{I1p\_PP1}\left( t \right)}{\mathrm{d}t} &= - \mathtt{kr\_PP1\_I1} \mathtt{I1p\_PP1}\left( t \right) + \mathtt{kf\_PP1\_I1} \mathtt{PP1}\left( t \right) \mathtt{I1p}\left( t \right) \\
\frac{\mathrm{d} \mathtt{PLBp}\left( t \right)}{\mathrm{d}t} &= \frac{ - \mathtt{k\_PP1\_PLB} \mathtt{PP1}\left( t \right) \mathtt{PLBp}\left( t \right)}{\mathtt{Km\_PP1\_PLB} + \mathtt{PLBp}\left( t \right)} + \frac{\mathtt{k\_PKA\_PLB} \mathtt{PLB}\left( t \right) \mathtt{PKACI}\left( t \right)}{\mathtt{Km\_PKA\_PLB} + \mathtt{PLB}\left( t \right)} \\
\frac{\mathrm{d} \mathtt{PLMp}\left( t \right)}{\mathrm{d}t} &= \frac{\mathtt{k\_PKA\_PLM} \mathtt{PKACI}\left( t \right) \mathtt{PLM}\left( t \right)}{\mathtt{Km\_PKA\_PLM} + \mathtt{PLM}\left( t \right)} + \frac{ - \mathtt{k\_PP1\_PLM} \mathtt{PP1}\left( t \right) \mathtt{PLMp}\left( t \right)}{\mathtt{Km\_PP1\_PLM} + \mathtt{PLMp}\left( t \right)} \\
\frac{\mathrm{d} \mathtt{TnIp}\left( t \right)}{\mathrm{d}t} &= \frac{ - \mathtt{PP2A\_TnI} \mathtt{k\_PP2A\_TnI} \mathtt{TnIp}\left( t \right)}{\mathtt{Km\_PP2A\_TnI} + \mathtt{TnIp}\left( t \right)} + \frac{\mathtt{k\_PKA\_TnI} \mathtt{PKACI}\left( t \right) \mathtt{TnI}\left( t \right)}{\mathtt{Km\_PKA\_TnI} + \mathtt{TnI}\left( t \right)} \\
\frac{\mathrm{d} \mathtt{LCCap}\left( t \right)}{\mathrm{d}t} &= \frac{\mathtt{PKACII\_LCCtotBA} \mathtt{epsilon} \mathtt{k\_PKA\_LCC} \mathtt{PKACII}\left( t \right) \mathtt{LCCa}\left( t \right)}{\mathtt{PKAIItot} \left( \mathtt{Km\_PKA\_LCC} + \mathtt{epsilon} \mathtt{LCCa}\left( t \right) \right)} + \frac{ - \mathtt{PP2A\_LCC} \mathtt{epsilon} \mathtt{k\_PP2A\_LCC} \mathtt{LCCap}\left( t \right)}{\mathtt{Km\_PP2A\_LCC} + \mathtt{epsilon} \mathtt{LCCap}\left( t \right)} \\
\frac{\mathrm{d} \mathtt{LCCbp}\left( t \right)}{\mathrm{d}t} &= \frac{\mathtt{PKACII\_LCCtotBA} \mathtt{epsilon} \mathtt{k\_PKA\_LCC} \mathtt{LCCb}\left( t \right) \mathtt{PKACII}\left( t \right)}{\mathtt{PKAIItot} \left( \mathtt{Km\_PKA\_LCC} + \mathtt{epsilon} \mathtt{LCCb}\left( t \right) \right)} + \frac{ - \mathtt{PP1\_LCC} \mathtt{epsilon} \mathtt{k\_PP1\_LCC} \mathtt{LCCbp}\left( t \right)}{\mathtt{Km\_PP1\_LCC} + \mathtt{epsilon} \mathtt{LCCbp}\left( t \right)} \\
\frac{\mathrm{d} \mathtt{KURp}\left( t \right)}{\mathrm{d}t} &= \frac{ - \mathtt{PP1\_KURtot} \mathtt{epsilon} \mathtt{k\_pp1\_KUR} \mathtt{KURp}\left( t \right)}{\mathtt{Km\_pp1\_KUR} + \mathtt{epsilon} \mathtt{KURp}\left( t \right)} + \frac{\mathtt{PKAII\_KURtot} \mathtt{epsilon} \mathtt{k\_pka\_KUR} \mathtt{KURn}\left( t \right) \mathtt{PKACII}\left( t \right)}{\mathtt{PKAIItot} \left( \mathtt{Km\_pka\_KUR} + \mathtt{epsilon} \mathtt{KURn}\left( t \right) \right)} \\
\frac{\mathrm{d} \mathtt{RyRp}\left( t \right)}{\mathrm{d}t} &= \frac{ - \mathtt{PP1\_RyR} \mathtt{epsilon} \mathtt{kcat\_pp1\_RyR} \mathtt{RyRp}\left( t \right)}{\mathtt{Km\_pp1\_RyR} + \mathtt{epsilon} \mathtt{RyRp}\left( t \right)} + \frac{\mathtt{PKAII\_RyRtot} \mathtt{epsilon} \mathtt{kcat\_pka\_RyR} \mathtt{PKACII}\left( t \right) \mathtt{RyRn}\left( t \right)}{\mathtt{PKAIItot} \left( \mathtt{Km\_pka\_RyR} + \mathtt{epsilon} \mathtt{RyRn}\left( t \right) \right)} + \frac{ - \mathtt{PP2A\_RyR} \mathtt{epsilon} \mathtt{kcat\_pp2a\_RyR} \mathtt{RyRp}\left( t \right)}{\mathtt{Km\_pp2a\_RyR} + \mathtt{epsilon} \mathtt{RyRp}\left( t \right)}
\end{align}
\end{split}\]
prob = SteadyStateProblem(sys, [])
alg = DynamicSS(Rodas5P())
SteadyStateDiffEq.DynamicSS{OrdinaryDiffEqRosenbrock.Rodas5P{0, ADTypes.AutoForwardDiff{nothing, Nothing}, Nothing, typeof(OrdinaryDiffEqCore.DEFAULT_PRECS), Val{:forward}(), true, nothing, typeof(OrdinaryDiffEqCore.trivial_limiter!), typeof(OrdinaryDiffEqCore.trivial_limiter!)}, Float64}(OrdinaryDiffEqRosenbrock.Rodas5P{0, ADTypes.AutoForwardDiff{nothing, Nothing}, Nothing, typeof(OrdinaryDiffEqCore.DEFAULT_PRECS), Val{:forward}(), true, nothing, typeof(OrdinaryDiffEqCore.trivial_limiter!), typeof(OrdinaryDiffEqCore.trivial_limiter!)}(nothing, OrdinaryDiffEqCore.DEFAULT_PRECS, OrdinaryDiffEqCore.trivial_limiter!, OrdinaryDiffEqCore.trivial_limiter!, ADTypes.AutoForwardDiff()), Inf)
Log scale for ISO concentration
iso = logrange(1e-4μM, 1μM, length=1001)
1001-element Base.LogRange{Float64, Base.TwicePrecision{Float64}}:
0.0001, 0.000100925, 0.000101859 … 0.972747, 0.981748, 0.990832, 1.0
prob_func = (prob, i, repeat) -> remake(prob, p=[ISO => iso[i]])
trajectories = length(iso)
sol = solve(prob, alg; abstol=1e-10, reltol=1e-10) ## warmup
sim = solve(EnsembleProblem(prob; prob_func, safetycopy=false), alg; trajectories, abstol=1e-10, reltol=1e-10)
EnsembleSolution Solution of length 1001 with uType:
SciMLBase.NonlinearSolution{Float64, 1, Vector{Float64}, Vector{Float64}, SciMLBase.SteadyStateProblem{Vector{Float64}, true, ModelingToolkit.MTKParameters{Vector{Float64}, Tuple{}, Tuple{}, Tuple{}, Tuple{}}, SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#1023"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x09431187, 0x84cca6a7, 0x97413d2f, 0x7a2f8ed7, 0x776a952e), Nothing}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xc3739b69, 0x256ed108, 0x0bea72c4, 0xe929c8f5, 0xba487052), Nothing}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, ModelingToolkit.ObservedFunctionCache{ModelingToolkit.ODESystem}, Nothing, ModelingToolkit.ODESystem, Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, @NamedTuple{}}}, SteadyStateDiffEq.DynamicSS{OrdinaryDiffEqRosenbrock.Rodas5P{0, ADTypes.AutoForwardDiff{9, Nothing}, Nothing, typeof(OrdinaryDiffEqCore.DEFAULT_PRECS), Val{:forward}(), true, nothing, typeof(OrdinaryDiffEqCore.trivial_limiter!), typeof(OrdinaryDiffEqCore.trivial_limiter!)}, Float64}, SciMLBase.ODESolution{Float64, 2, Vector{Vector{Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{Float64}}}, Nothing, SciMLBase.ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, ModelingToolkit.MTKParameters{Vector{Float64}, Tuple{}, Tuple{}, Tuple{}, Tuple{}}, SciMLBase.ODEFunction{true, true, SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#1023"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x09431187, 0x84cca6a7, 0x97413d2f, 0x7a2f8ed7, 0x776a952e), Nothing}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xc3739b69, 0x256ed108, 0x0bea72c4, 0xe929c8f5, 0xba487052), Nothing}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, ModelingToolkit.ObservedFunctionCache{ModelingToolkit.ODESystem}, Nothing, ModelingToolkit.ODESystem, Nothing, Nothing}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, ModelingToolkit.ObservedFunctionCache{ModelingToolkit.ODESystem}, Nothing, ModelingToolkit.ODESystem, Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, @NamedTuple{}}, SciMLBase.StandardODEProblem}, OrdinaryDiffEqRosenbrock.Rodas5P{0, ADTypes.AutoForwardDiff{9, Nothing}, Nothing, typeof(OrdinaryDiffEqCore.DEFAULT_PRECS), Val{:forward}(), true, nothing, typeof(OrdinaryDiffEqCore.trivial_limiter!), typeof(OrdinaryDiffEqCore.trivial_limiter!)}, OrdinaryDiffEqCore.InterpolationData{SciMLBase.ODEFunction{true, true, SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#1023"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x09431187, 0x84cca6a7, 0x97413d2f, 0x7a2f8ed7, 0x776a952e), Nothing}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xc3739b69, 0x256ed108, 0x0bea72c4, 0xe929c8f5, 0xba487052), Nothing}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, ModelingToolkit.ObservedFunctionCache{ModelingToolkit.ODESystem}, Nothing, ModelingToolkit.ODESystem, Nothing, Nothing}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, ModelingToolkit.ObservedFunctionCache{ModelingToolkit.ODESystem}, Nothing, ModelingToolkit.ODESystem, Nothing, Nothing}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, Nothing, OrdinaryDiffEqRosenbrock.RosenbrockCache{Vector{Float64}, Vector{Float64}, Vector{Float64}, Matrix{Float64}, Matrix{Float64}, OrdinaryDiffEqRosenbrock.RodasTableau{Float64, Float64}, SciMLBase.TimeGradientWrapper{true, SciMLBase.ODEFunction{true, true, SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#1023"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x09431187, 0x84cca6a7, 0x97413d2f, 0x7a2f8ed7, 0x776a952e), Nothing}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xc3739b69, 0x256ed108, 0x0bea72c4, 0xe929c8f5, 0xba487052), Nothing}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, ModelingToolkit.ObservedFunctionCache{ModelingToolkit.ODESystem}, Nothing, ModelingToolkit.ODESystem, Nothing, Nothing}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, ModelingToolkit.ObservedFunctionCache{ModelingToolkit.ODESystem}, Nothing, ModelingToolkit.ODESystem, Nothing, Nothing}, Vector{Float64}, ModelingToolkit.MTKParameters{Vector{Float64}, Tuple{}, Tuple{}, Tuple{}, Tuple{}}}, SciMLBase.UJacobianWrapper{true, SciMLBase.ODEFunction{true, true, SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#1023"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x09431187, 0x84cca6a7, 0x97413d2f, 0x7a2f8ed7, 0x776a952e), Nothing}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xc3739b69, 0x256ed108, 0x0bea72c4, 0xe929c8f5, 0xba487052), Nothing}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, ModelingToolkit.ObservedFunctionCache{ModelingToolkit.ODESystem}, Nothing, ModelingToolkit.ODESystem, Nothing, Nothing}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, ModelingToolkit.ObservedFunctionCache{ModelingToolkit.ODESystem}, Nothing, ModelingToolkit.ODESystem, Nothing, Nothing}, Float64, ModelingToolkit.MTKParameters{Vector{Float64}, Tuple{}, Tuple{}, Tuple{}, Tuple{}}}, LinearSolve.LinearCache{Matrix{Float64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, LinearSolve.DefaultLinearSolver, LinearSolve.DefaultLinearSolverInit{LinearAlgebra.LU{Float64, Matrix{Float64}, Vector{Int64}}, LinearAlgebra.QRCompactWY{Float64, Matrix{Float64}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, LinearAlgebra.LU{Float64, Matrix{Float64}, Vector{Int64}}, Tuple{LinearAlgebra.LU{Float64, Matrix{Float64}, Vector{Int64}}, Vector{Int64}}, Nothing, Nothing, Nothing, LinearAlgebra.SVD{Float64, Float64, Matrix{Float64}, Vector{Float64}}, 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.QRPivoted{Float64, Matrix{Float64}, Vector{Float64}, Vector{Int64}}, Nothing, Nothing}, LinearSolve.InvPreconditioner{LinearAlgebra.Diagonal{Float64, Vector{Float64}}}, LinearAlgebra.Diagonal{Float64, Vector{Float64}}, Float64, Bool, LinearSolve.LinearSolveAdjoint{Missing}}, SparseDiffTools.ForwardColorJacCache{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 9}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 9}}, Vector{Float64}, Vector{Vector{NTuple{9, Float64}}}, UnitRange{Int64}, Nothing}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Float64, OrdinaryDiffEqRosenbrock.Rodas5P{0, ADTypes.AutoForwardDiff{9, Nothing}, Nothing, typeof(OrdinaryDiffEqCore.DEFAULT_PRECS), Val{:forward}(), true, nothing, typeof(OrdinaryDiffEqCore.trivial_limiter!), typeof(OrdinaryDiffEqCore.trivial_limiter!)}, typeof(OrdinaryDiffEqCore.trivial_limiter!), typeof(OrdinaryDiffEqCore.trivial_limiter!)}, Nothing}, SciMLBase.DEStats, Nothing, Nothing, Nothing, Nothing}, Nothing, Nothing, Nothing}
"""Extract values from ensemble simulations by a symbol"""
extract(sim, k) = map(s -> s[k], sim)
"""Calculate Root Mean Square Error (RMSE)"""
rmse(fit) = sqrt(sum(abs2, fit.resid) / length(fit.resid))
Main.var"##230".rmse
xopts = (xlims=(iso[begin], iso[end]), minorgrid=true, xscale=:log10, xlabel="ISO (μM)",)
plot(iso, extract(sim, sys.cAMP); lab="cAMP", ylabel="Conc. (μM)", legend=:topleft, xopts...)
plot(iso, extract(sim, sys.PKACI / sys.RItot); lab="PKACI", ylabel="Activation fraction")
plot!(iso, extract(sim, sys.PKACII / sys.RIItot), lab="PKACII")
plot!(iso, extract(sim, sys.PP1 / sys.PP1totBA), lab="PP1", legend=:topleft; xopts...)
Fitting active PKACI#
@. model(x, p) = p[1] * x / (x + p[2]) + p[3]
xdata = iso
ydata = extract(sim, sys.PKACI / sys.RItot)
p0 = [0.3, 0.01μM, 0.08]
lb = [0.0, 0.0, 0.0]
pkac1_fit = curve_fit(model, xdata, ydata, p0; lower=lb, autodiff=:forwarddiff)
pkac1_coef = coef(pkac1_fit)
3-element Vector{Float64}:
0.19937291922587674
0.01390618008652709
0.07340272516422842
println("PKACI")
println("Basal activity: ", pkac1_coef[3])
println("Activated activity: ", pkac1_coef[1])
println("Michaelis constant: ", pkac1_coef[2], " μM")
println("RMSE: ", rmse(pkac1_fit))
PKACI
Basal activity: 0.07340272516422842
Activated activity: 0.19937291922587674
Michaelis constant: 0.01390618008652709 μM
RMSE: 0.00032692395161732987
ypred = model.(xdata, Ref(pkac1_coef))
p1 = plot(xdata, [ydata ypred], lab=["Full model" "Fitted"], line=[:dash :dot], title="PKACI", legend=:topleft; xopts...)
p2 = plot(xdata, (ypred .- ydata) ./ ydata .* 100; title="PKACI error (%)", lab=false, xopts...)
plot(p1, p2, layout=(2, 1), size=(600, 600))
Fitting active PKACII#
xdata = iso
ydata = extract(sim, sys.PKACII / sys.RIItot)
p0 = [0.4, 0.01μM, 0.2]
lb = [0.0, 0.0, 0.0]
pkac2_fit = curve_fit(model, xdata, ydata, p0; lower=lb, autodiff=:forwarddiff)
pkac2_coef = coef(pkac2_fit)
3-element Vector{Float64}:
0.34437074646162363
0.0102510292463815
0.18399257666411384
println("PKACII")
println("Basal activity: ", pkac2_coef[3])
println("Activated activity: ", pkac2_coef[1])
println("Michaelis constant: ", pkac2_coef[2], " μM")
println("RMSE: ", rmse(pkac2_fit))
PKACII
Basal activity: 0.18399257666411384
Activated activity: 0.34437074646162363
Michaelis constant: 0.0102510292463815 μM
RMSE: 0.00024370436419444156
ypred = model.(xdata, Ref(pkac2_coef))
p1 = plot(xdata, [ydata ypred], lab=["Full model" "Fitted"], line=[:dash :dot], title="PKACII", legend=:topleft; xopts...)
p2 = plot(xdata, (ypred .- ydata) ./ ydata .* 100; title="PKACII error (%)", lab=false, xopts...)
plot(p1, p2, layout=(2, 1), size=(600, 600))
Least-square fitting of PP1 activity#
@. model_pp1(x, p) = p[1] * p[2] / (x + p[2]) + p[3]
xdata = iso
ydata = extract(sim, sys.PP1 / sys.PP1totBA)
p0 = [0.1, 3e-3μM, 0.8]
lb = [0.0, 0.0, 0.0]
pp1_fit = curve_fit(model_pp1, xdata, ydata, p0; lower=lb, autodiff=:forwarddiff)
pp1_coef = coef(pp1_fit)
3-element Vector{Float64}:
0.049191945661098316
0.00636190136348291
0.8927131197462342
println("PP1")
println("Repressible activity: ", pp1_coef[1])
println("Minimal activity: ", pp1_coef[3])
println("Repressive Michaelis constant: ", pp1_coef[2], " μM")
println("RMSE: ", rmse(pp1_fit))
PP1
Repressible activity: 0.049191945661098316
Minimal activity: 0.8927131197462342
Repressive Michaelis constant: 0.00636190136348291 μM
RMSE: 3.5404825206962226e-5
ypred = model_pp1.(xdata, Ref(pp1_coef))
p1 = plot(xdata, [ydata ypred], lab=["Full model" "Fitted"], line=[:dash :dot], title="PP1", legend=:topright; xopts...)
p2 = plot(xdata, (ypred .- ydata) ./ ydata .* 100; title="PP1 error (%)", lab=false, xopts...)
plot(p1, p2, layout=(2, 1), size=(600, 600))
Fitting PLBp#
xdata = iso
ydata = extract(sim, sys.PLBp / sys.PLBtotBA)
plot(xdata, ydata, title="PLBp fraction", lab=false; xopts...)
First try: Hill function
@. model_plb(x, p) = p[1] * hil(x, p[2], p[3]) + p[4]
p0 = [0.8, 1e-2μM, 1.0, 0.1]
lb = [0.5, 1e-9μM, 1.0, 0.0]
fit = curve_fit(model_plb, xdata, ydata, p0; lower=lb, autodiff=:forwarddiff)
pestim = coef(fit)
4-element Vector{Float64}:
0.7923203613117932
0.005936645606853195
1.8386674173101467
0.08301223334733009
println("PLBp")
println("Basal activity: ", pestim[4])
println("Activated activity: ", pestim[1])
println("Michaelis constant: ", pestim[2], " μM")
println("Hill coefficient: ", pestim[3])
println("RMSE: ", rmse(fit))
PLBp
Basal activity: 0.08301223334733009
Activated activity: 0.7923203613117932
Michaelis constant: 0.005936645606853195 μM
Hill coefficient: 1.8386674173101467
RMSE: 0.008419205624575389
ypred = model_plb.(xdata, Ref(pestim))
p1 = plot(xdata, [ydata ypred], lab=["Full model" "Fitted"], line=[:dash :dot], title="PLBp", legend=:topleft; xopts...)
p2 = plot(xdata, (ypred .- ydata) ./ ydata .* 100; title="PLBp error (%)", lab=false, xopts...)
plot(p1, p2, layout=(2, 1), size=(600, 600))
Fitting PLMp#
xdata = iso
ydata = extract(sim, sys.PLMp / sys.PLMtotBA)
plot(xdata, ydata, title="PLMp fraction", lab=false; xopts...)
@. model_plm(x, p) = p[1] * hil(x, p[2], p[3]) + p[4]
p0 = [0.8, 1e-2μM, 1.0, 0.1]
lb = [0.5, 1e-9μM, 1.0, 0.0]
fit = curve_fit(model_plm, xdata, ydata, p0; lower=lb, autodiff=:forwarddiff)
pestim = coef(fit)
4-element Vector{Float64}:
0.6617189374539953
0.008181715500075609
1.3710342445443358
0.11772727603832957
println("PLMp")
println("Basal activity: ", pestim[4])
println("Activated activity: ", pestim[1])
println("Michaelis constant: ", pestim[2], " μM")
println("Hill coefficient: ", pestim[3])
println("RMSE: ", rmse(fit))
PLMp
Basal activity: 0.11772727603832957
Activated activity: 0.6617189374539953
Michaelis constant: 0.008181715500075609 μM
Hill coefficient: 1.3710342445443358
RMSE: 0.003273838676778438
ypred = model_plm.(xdata, Ref(pestim))
p1 = plot(xdata, [ydata ypred], lab=["Full model" "Fitted"], line=[:dash :dot], title="PLMp", legend=:topleft; xopts...)
p2 = plot(xdata, (ypred .- ydata) ./ ydata .* 100; title="PLMp error (%)", lab=false, xopts...)
plot(p1, p2, layout=(2, 1), size=(600, 600))
Fitting TnIp#
xdata = iso
ydata = extract(sim, sys.TnIp / sys.TnItotBA)
plot(xdata, ydata, title="TnIp fraction", lab=false; xopts...)
@. model_tni(x, p) = p[1] * hil(x, p[2], p[3]) + p[4]
p0 = [0.8, 1e-2μM, 1.0, 0.1]
lb = [0.1, 1e-9μM, 1.0, 0.0]
fit = curve_fit(model_tni, xdata, ydata, p0; lower=lb, autodiff=:forwarddiff)
pestim = coef(fit)
4-element Vector{Float64}:
0.7481954981262161
0.007856342545580718
1.6973358042869
0.06752961853123106
println("TnIp")
println("Basal activity: ", pestim[4])
println("Activated activity: ", pestim[1])
println("Michaelis constant: ", pestim[2], " μM")
println("Hill coefficient: ", pestim[3])
println("RMSE: ", rmse(fit))
TnIp
Basal activity: 0.06752961853123106
Activated activity: 0.7481954981262161
Michaelis constant: 0.007856342545580718 μM
Hill coefficient: 1.6973358042869
RMSE: 0.007437121115766605
ypred = model_tni.(xdata, Ref(pestim))
p1 = plot(xdata, [ydata ypred], lab=["Full model" "Fitted"], line=[:dash :dot], title="TnIp", legend=:topleft; xopts...)
p2 = plot(xdata, (ypred .- ydata) ./ ydata .* 100; title="TnIp error (%)", lab=false, xopts...)
plot(p1, p2, layout=(2, 1), size=(600, 600))
Fitting LCCap#
xdata = iso
ydata = extract(sim, sys.LCCap / sys.LCCtotBA)
plot(xdata, ydata, title="LCCap fraction", lab=false; xopts...)
@. model_lcc(x, p) = p[1] * hil(x, p[2]) + p[3]
p0 = [0.8, 1e-2μM, 0.1]
lb = [0.1, 1e-9μM, 0.0]
fit = curve_fit(model_lcc, xdata, ydata, p0; lower=lb, autodiff=:forwarddiff)
pestim = coef(fit)
3-element Vector{Float64}:
0.23338200578128387
0.007263357258342696
0.2208194931437567
println("LCCap")
println("Basal activity: ", pestim[3])
println("Activated activity: ", pestim[1])
println("Michaelis constant: ", pestim[2], " μM")
println("RMSE: ", rmse(fit))
LCCap
Basal activity: 0.2208194931437567
Activated activity: 0.23338200578128387
Michaelis constant: 0.007263357258342696 μM
RMSE: 0.0001347238356812495
ypred = model_lcc.(xdata, Ref(pestim))
p1 = plot(xdata, [ydata ypred], lab=["Full model" "Fitted"], line=[:dash :dot], title="LCCap", legend=:topleft; xopts...)
p2 = plot(xdata, (ypred .- ydata) ./ ydata .* 100; title="LCCap error (%)", lab=false, xopts...)
plot(p1, p2, layout=(2, 1), size=(600, 600))
Fitting LCCbp#
xdata = iso
ydata = extract(sim, sys.LCCbp / sys.LCCtotBA)
plot(xdata, ydata, title="LCCbp fraction", lab=false; xopts...)
p0 = [0.8, 1e-2μM, 0.1]
lb = [0.1, 1e-9μM, 0.0]
fit = curve_fit(model_lcc, xdata, ydata, p0; lower=lb, autodiff=:forwarddiff)
pestim = coef(fit)
3-element Vector{Float64}:
0.24558899924906163
0.006961132215228242
0.25200802323074334
println("LCCbp")
println("Basal activity: ", pestim[3])
println("Activated activity: ", pestim[1])
println("Michaelis constant: ", pestim[2], " μM")
println("RMSE: ", rmse(fit))
LCCbp
Basal activity: 0.25200802323074334
Activated activity: 0.24558899924906163
Michaelis constant: 0.006961132215228242 μM
RMSE: 0.00013805758907275832
ypred = model_lcc.(xdata, Ref(pestim))
p1 = plot(xdata, [ydata ypred], lab=["Full model" "Fitted"], line=[:dash :dot], title="LCCbp", legend=:topleft; xopts...)
p2 = plot(xdata, (ypred .- ydata) ./ ydata .* 100; title="LCCbp error (%)", lab=false, xopts...)
plot(p1, p2, layout=(2, 1), size=(600, 600))
Fitting KURp#
xdata = iso
ydata = extract(sim, sys.KURp / sys.IKurtotBA)
plot(xdata, ydata, title="LCCbp fraction", lab=false; xopts...)
@. model_kur(x, p) = p[1] * hil(x, p[2]) + p[3]
p0 = [0.8, 1e-2μM, 0.1]
lb = [0.1, 1e-9μM, 0.0]
fit = curve_fit(model_kur, xdata, ydata, p0; lower=lb, autodiff=:forwarddiff)
pestim = coef(fit)
3-element Vector{Float64}:
0.2556572071975255
0.005578161616313779
0.4393640567201968
println("KURp")
println("Basal activity: ", pestim[3])
println("Activated activity: ", pestim[1])
println("Michaelis constant: ", pestim[2], " μM")
println("RMSE: ", rmse(fit))
KURp
Basal activity: 0.4393640567201968
Activated activity: 0.2556572071975255
Michaelis constant: 0.005578161616313779 μM
RMSE: 0.000148484283921716
ypred = model_lcc.(xdata, Ref(pestim))
p1 = plot(xdata, [ydata ypred], lab=["Full model" "Fitted"], line=[:dash :dot], title="KURp", legend=:topleft; xopts...)
p2 = plot(xdata, (ypred .- ydata) ./ ydata .* 100; title="KURp error (%)", lab=false, xopts...)
plot(p1, p2, layout=(2, 1), size=(600, 600))
Fitting RyRp#
xdata = iso
ydata = extract(sim, sys.RyR_PKAp)
plot(xdata, ydata, title="RyRp fraction", lab=false; xopts...)
@. model(x, p) = p[1] * x / (x + p[2]) + p[3]
p0 = [0.3, 1e-2μM, 0.1]
lb = [0.0, 1e-9μM, 0.0]
fit = curve_fit(model, xdata, ydata, p0; lower=lb, autodiff=:forwarddiff)
pestim = coef(fit)
3-element Vector{Float64}:
0.23988668426667809
0.00750987813984036
0.20539807148749487
println("RyRp")
println("Basal activity: ", pestim[3])
println("Activated activity: ", pestim[1])
println("Michaelis constant: ", pestim[2], " μM")
println("RMSE: ", rmse(fit))
RyRp
Basal activity: 0.20539807148749487
Activated activity: 0.23988668426667809
Michaelis constant: 0.00750987813984036 μM
RMSE: 7.686608055144195e-5
ypred = model.(xdata, Ref(pestim))
p1 = plot(xdata, [ydata ypred], lab=["Full model" "Fitted"], line=[:dash :dot], title="RyRp", legend=:topleft; xopts...)
p2 = plot(xdata, (ypred .- ydata) ./ ydata .* 100; title="RyRp error (%)", lab=false, xopts...)
plot(p1, p2, layout=(2, 1), size=(600, 600))
This notebook was generated using Literate.jl.