Caffeine Effects

Caffeine Effects#

Caffeine increase RyR opening sensitivity to luminal and subspace calcium In this model, we decrease the mid saturation sub-SR calcium concentration for the opening rate

using ModelingToolkit
using OrdinaryDiffEq, SteadyStateDiffEq, DiffEqCallbacks
using Plots
using CSV
using DataFrames
using Dates
using CaMKIIModel
using CaMKIIModel: second
Plots.default(lw=1.5)
sys = build_neonatal_ecc_sys(simplify=true, reduce_iso=true, reduce_camk=true)
tend = 500second
prob = ODEProblem(sys, [], tend)
stimstart = 100second
stimend = 300second
alg = KenCarp47()
function add_coffee_affect!(integrator)
    integrator.ps[sys.RyRsensitivity] = 10
end

@unpack Istim = sys
callback = build_stim_callbacks(Istim, stimend; period=1second, starttime=stimstart)
SciMLBase.CallbackSet{Tuple{}, Tuple{SciMLBase.DiscreteCallback{DiffEqCallbacks.PresetTimeFunction{StepRange{Int64, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}}, CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}, DiffEqCallbacks.PresetTimeFunction{StepRange{Int64, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}}, typeof(SciMLBase.FINALIZE_DEFAULT), Nothing}, SciMLBase.DiscreteCallback{DiffEqCallbacks.PresetTimeFunction{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}}, CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}, DiffEqCallbacks.PresetTimeFunction{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}}, typeof(SciMLBase.FINALIZE_DEFAULT), Nothing}}}((), (SciMLBase.DiscreteCallback{DiffEqCallbacks.PresetTimeFunction{StepRange{Int64, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}}, CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}, DiffEqCallbacks.PresetTimeFunction{StepRange{Int64, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}}, typeof(SciMLBase.FINALIZE_DEFAULT), Nothing}(DiffEqCallbacks.PresetTimeFunction{StepRange{Int64, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}}(100000:1000:300000, true, SciMLBase.INITIALIZE_DEFAULT, CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}(-80.0, 0.5, Istim)), CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}(-80.0, 0.5, Istim), DiffEqCallbacks.PresetTimeFunction{StepRange{Int64, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}}(100000:1000:300000, true, SciMLBase.INITIALIZE_DEFAULT, CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}(-80.0, 0.5, Istim)), SciMLBase.FINALIZE_DEFAULT, Bool[1, 1], nothing), SciMLBase.DiscreteCallback{DiffEqCallbacks.PresetTimeFunction{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}}, CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}, DiffEqCallbacks.PresetTimeFunction{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}}, typeof(SciMLBase.FINALIZE_DEFAULT), Nothing}(DiffEqCallbacks.PresetTimeFunction{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}}(100000.5:1000.0:300000.5, true, SciMLBase.INITIALIZE_DEFAULT, CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}(0.0, 0.5, Istim)), CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}(0.0, 0.5, Istim), DiffEqCallbacks.PresetTimeFunction{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}}(100000.5:1000.0:300000.5, true, SciMLBase.INITIALIZE_DEFAULT, CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}(0.0, 0.5, Istim)), SciMLBase.FINALIZE_DEFAULT, Bool[1, 1], nothing)))

Add caffeine at t = 200 econd

callback_caf = CallbackSet(build_stim_callbacks(Istim, stimend; period=1second, starttime=stimstart), PresetTimeCallback(200.0second, add_coffee_affect!))
SciMLBase.CallbackSet{Tuple{}, Tuple{SciMLBase.DiscreteCallback{DiffEqCallbacks.PresetTimeFunction{StepRange{Int64, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}}, CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}, DiffEqCallbacks.PresetTimeFunction{StepRange{Int64, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}}, typeof(SciMLBase.FINALIZE_DEFAULT), Nothing}, SciMLBase.DiscreteCallback{DiffEqCallbacks.PresetTimeFunction{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}}, CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}, DiffEqCallbacks.PresetTimeFunction{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}}, typeof(SciMLBase.FINALIZE_DEFAULT), Nothing}, SciMLBase.DiscreteCallback{DiffEqCallbacks.PresetTimeFunction{Vector{Float64}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(Main.var"##230".add_coffee_affect!)}, typeof(Main.var"##230".add_coffee_affect!), DiffEqCallbacks.PresetTimeFunction{Vector{Float64}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(Main.var"##230".add_coffee_affect!)}, typeof(SciMLBase.FINALIZE_DEFAULT), Nothing}}}((), (SciMLBase.DiscreteCallback{DiffEqCallbacks.PresetTimeFunction{StepRange{Int64, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}}, CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}, DiffEqCallbacks.PresetTimeFunction{StepRange{Int64, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}}, typeof(SciMLBase.FINALIZE_DEFAULT), Nothing}(DiffEqCallbacks.PresetTimeFunction{StepRange{Int64, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}}(100000:1000:300000, true, SciMLBase.INITIALIZE_DEFAULT, CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}(-80.0, 0.5, Istim)), CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}(-80.0, 0.5, Istim), DiffEqCallbacks.PresetTimeFunction{StepRange{Int64, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}}(100000:1000:300000, true, SciMLBase.INITIALIZE_DEFAULT, CaMKIIModel.var"#15#17"{Float64, Float64, Symbolics.Num}(-80.0, 0.5, Istim)), SciMLBase.FINALIZE_DEFAULT, Bool[1, 1], nothing), SciMLBase.DiscreteCallback{DiffEqCallbacks.PresetTimeFunction{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}}, CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}, DiffEqCallbacks.PresetTimeFunction{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}}, typeof(SciMLBase.FINALIZE_DEFAULT), Nothing}(DiffEqCallbacks.PresetTimeFunction{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}}(100000.5:1000.0:300000.5, true, SciMLBase.INITIALIZE_DEFAULT, CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}(0.0, 0.5, Istim)), CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}(0.0, 0.5, Istim), DiffEqCallbacks.PresetTimeFunction{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, typeof(SciMLBase.INITIALIZE_DEFAULT), CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}}(100000.5:1000.0:300000.5, true, SciMLBase.INITIALIZE_DEFAULT, CaMKIIModel.var"#16#18"{Float64, Float64, Symbolics.Num}(0.0, 0.5, Istim)), SciMLBase.FINALIZE_DEFAULT, Bool[1, 1], nothing), SciMLBase.DiscreteCallback{DiffEqCallbacks.PresetTimeFunction{Vector{Float64}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(Main.var"##230".add_coffee_affect!)}, typeof(Main.var"##230".add_coffee_affect!), DiffEqCallbacks.PresetTimeFunction{Vector{Float64}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(Main.var"##230".add_coffee_affect!)}, typeof(SciMLBase.FINALIZE_DEFAULT), Nothing}(DiffEqCallbacks.PresetTimeFunction{Vector{Float64}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(Main.var"##230".add_coffee_affect!)}([200000.0], true, SciMLBase.INITIALIZE_DEFAULT, Main.var"##230".add_coffee_affect!), Main.var"##230".add_coffee_affect!, DiffEqCallbacks.PresetTimeFunction{Vector{Float64}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(Main.var"##230".add_coffee_affect!)}([200000.0], true, SciMLBase.INITIALIZE_DEFAULT, Main.var"##230".add_coffee_affect!), SciMLBase.FINALIZE_DEFAULT, Bool[1, 1], nothing)))
@time sol = solve(prob, alg; callback)
@time sol_caf = solve(prob, alg; callback=callback_caf)
 12.214755 seconds (18.06 M allocations: 881.479 MiB, 4.30% gc time, 87.93% compilation time)
  4.143469 seconds (4.28 M allocations: 243.236 MiB, 2.02% gc time, 62.57% compilation time)
retcode: Success
Interpolation: 3rd order Hermite
t: 8769-element Vector{Float64}:
      0.0
      0.019333123284849308
      0.09098129546757994
      0.20735582943983855
      0.45611910276862533
      1.0472562928406122
      2.0342667657223696
      3.451776641148454
      6.733792423912806
     12.450117081023194
      ⋮
 410733.5602589652
 421223.77632240363
 432671.0101003078
 444118.243878212
 455565.4776561162
 467012.71143402037
 481612.9587027896
 498981.02841766016
 500000.0
u: 8769-element Vector{Vector{Float64}}:
 [150952.75035000002, 13838.37602, -68.79268, 0.12113, 0.12113, 0.12113, 0.12113, 0.12113, 0.12113, 0.12113  …  0.26081, 0.00977, 0.00188, 0.09243, 0.22156, 0.966, 0.00702, 830.0, 830.0, 0.0026]
 [150952.7504077194, 13838.375711519551, -68.79732946186226, 0.1211319185255175, 0.1211301421535992, 0.12113000811850358, 0.12113000037367234, 0.12113000001389383, 0.12113000000038378, 0.12113000000000405  …  0.2608055799112056, 0.009769882842069916, 0.001879826176081169, 0.09242766669618695, 0.2215639938807744, 0.9660018276402699, 0.007020208561323646, 829.9999654017583, 829.9994975880693, 0.0025985659590295374]
 [150952.75062244057, 13838.374513299192, -68.81607005265552, 0.12115248970210647, 0.12113624253259858, 0.12113143375871602, 0.12113027926811751, 0.12113004704056851, 0.12113000693481112, 0.12113000089551408  …  0.26078941009382306, 0.009769459049732313, 0.0018789042446514422, 0.09241901973901424, 0.2215787945110049, 0.9660085993318799, 0.00702008986027517, 829.9998348635061, 829.9976422525165, 0.002593310524681686]
 [150952.7509740238, 13838.372555328333, -68.84681913285226, 0.12118951551963696, 0.12115723910142134, 0.12114109135582982, 0.12113403405679991, 0.12113131833063846, 0.12113038966346883, 0.12113010483012127  …  0.2607638707001999, 0.009768805322556195, 0.0018766436937193197, 0.09240497563401104, 0.22160283236040595, 0.9660195931792828, 0.007017234889558555, 829.9996133960318, 829.9946506157202, 0.0025849478335103777]
 [150952.7517373371, 13838.368384399068, -68.91207316777846, 0.12125418995384041, 0.12120713813483534, 0.12117519662647316, 0.12115494411090462, 0.12114295934422187, 0.12113633873395535, 0.12113292110288301  …  0.2607122383588733, 0.00976754294689657, 0.0018699196262940568, 0.0923749578279845, 0.2216542075240971, 0.9660430731013478, 0.0070030143052343926, 829.9990964774663, 829.9883445519497, 0.00256770780104998]
 [150952.75361533565, 13838.358559292059, -69.06429960994137, 0.12136450208851983, 0.1213063255235844, 0.12125925929399752, 0.12122229800810434, 0.12119414515426227, 0.1211733598588045, 0.12115849269665879  …  0.26060507831375035, 0.009765228548607825, 0.001850533769446942, 0.09230364339951613, 0.22177624785138977, 0.9660987611411453, 0.006946470397388757, 829.9976227528975, 829.9738229154025, 0.0025298083713907005]
 [150952.75694915713, 13838.34240329337, -69.31024285744343, 0.1214919651325424, 0.12142927821043338, 0.12137426379919636, 0.12132672249013034, 0.12128628091507473, 0.12125242557826561, 0.12122454121844703  …  0.26047114911179464, 0.009763403076884485, 0.0018178174419014683, 0.09218462776986637, 0.2219798989175973, 0.9661914345949096, 0.0068337541728754475, 829.9944193668179, 829.9509077855928, 0.0024748079782158957]
 [150952.76215620188, 13838.319723120678, -69.64637448767432, 0.12162015426876954, 0.12155743299711902, 0.12149988983034497, 0.1214475947100359, 0.12140052118634262, 0.12135855488207907, 0.12132150441596071  …  0.2603648729749554, 0.009765046552800477, 0.001773815690753224, 0.09201383579531924, 0.22227216398019892, 0.9663239343003682, 0.006675512062656749, 829.9883533251192, 829.9205247545176, 0.0024106893964811324]
 [150952.77598869594, 13838.2694938995, -70.35063788657428, 0.12180447948880582, 0.12174768443532359, 0.1216934018408597, 0.12164180995533562, 0.1215930492007203, 0.12154722283384187, 0.12150439833798554  …  0.26041507667541997, 0.009786689200123853, 0.0016855899094922325, 0.09161908329520764, 0.22294828828976576, 0.9666286957812559, 0.006355039713677859, 829.9689941817725, 829.8589858006806, 0.00231065572773434]
 [150952.80529264064, 13838.18882346682, -71.35304509818071, 0.12196378364408145, 0.12191937753328307, 0.12187579038290325, 0.1218331857334072, 0.12179171693004393, 0.12175152667167352, 0.12171274673876355  …  0.26104417804603025, 0.009873892913308327, 0.0015688568862426042, 0.09093422465365385, 0.22412560303273427, 0.9671554512230358, 0.005926150085676071, 829.923524981244, 829.7704141396295, 0.00222899504022452]
 ⋮
 [151663.2776898542, 13215.513714654871, -69.70252845454962, 0.13198002880603968, 0.1319800337796511, 0.1319800346627075, 0.1319800313739467, 0.13198002382881313, 0.13198001193928965, 0.1319799956137192  …  0.0012491193019084931, 0.0016547150278794776, 0.002561357737953146, 0.0016776615775924968, 0.9997066082818867, 0.999704707787832, 0.006604834578826734, 51.645918673193584, 50.35000350965576, 0.11382553642593662]
 [151708.2629414035, 13170.537675638909, -69.61300456376314, 0.13145251807614045, 0.13145252147774816, 0.13145252099765495, 0.13145251655845902, 0.131452508079618, 0.13145249547728882, 0.13145247866415763  …  0.0012665302447971262, 0.0016657566261421696, 0.002578445594343517, 0.0016993492733827183, 0.999700823091933, 0.9996989532166448, 0.006645152461788721, 51.93681637681915, 50.65069477327812, 0.11229800455232698]
 [151754.98288079177, 13123.826398733605, -69.51889341630758, 0.13091278500620576, 0.13091278742570348, 0.13091278619698224, 0.13091278124710878, 0.1309127725001803, 0.13091275987717266, 0.13091274329577987  …  0.0012851531429686916, 0.0016774440015540953, 0.002596530129613534, 0.0017224387280891933, 0.999694620862646, 0.9996927832425093, 0.006687799827501513, 52.23928869504841, 50.96315342378411, 0.11074773321353018]
 [151799.35265924223, 13079.464292941999, -69.42844324412374, 0.13040760308867838, 0.13040760443634397, 0.13040760234906473, 0.1304075967579626, 0.1304075875913475, 0.13040757477457407, 0.1304075582298894  …  0.001303272409107182, 0.0016887522347138035, 0.0026140293555364197, 0.0017449216194817766, 0.9996885355417422, 0.999686733881154, 0.0067290443835846675, 52.52592692863264, 51.259114373412594, 0.10930787998089508]
 [151841.49185352706, 13037.33185790874, -69.34154114093742, 0.12993469775982816, 0.1299346981897259, 0.12993469538344996, 0.12993468927592436, 0.12993467979941115, 0.129934666883375, 0.1299346504543389  …  0.0013209161640952926, 0.0016996875317891508, 0.0026309517817209773, 0.0017667932845874248, 0.9996825735718403, 0.9996808095314074, 0.006768908990975426, 52.79764618173444, 51.53953743890141, 0.10796998338501547]
 [151881.51381216422, 12997.316268008604, -69.25809827526942, 0.1294916452693028, 0.12949164449842784, 0.12949164065074673, 0.12949163366422106, 0.1294916234743007, 0.12949161001379556, 0.12949159321273948  …  0.0013380148852116917, 0.0017102514363884027, 0.0026473026280010186, 0.0017880539930101094, 0.9996767365231306, 0.9996750147051691, 0.006807407502136613, 53.05424261408651, 51.80427306891949, 0.10672509452850984]
 [151929.6569576974, 12949.179991476989, -69.15648649942348, 0.1289671384253076, 0.128967136777857, 0.12896713227776588, 0.12896712486736794, 0.12896711448666834, 0.12896710107322473, 0.12896708456202102  …  0.0013592126385533, 0.0017232044272011908, 0.0026673486302105334, 0.001814273818380919, 0.9996694868486742, 0.9996678167190343, 0.0068545823361015465, 53.36317242692155, 52.12280505412663, 0.1052627000924258]
 [151982.96862916497, 12895.875212784948, -69.04237355744974, 0.1283968862061367, 0.12839688355273324, 0.12839687829346041, 0.1283968703754357, 0.1283968597436436, 0.1283968463408275, 0.12839683010737352  …  0.0013834372077787427, 0.0017378671842155945, 0.0026900389633140154, 0.0018441620748014722, 0.9996611508074204, 0.9996595440769798, 0.0069079470715669835, 53.70384029422924, 52.47388132541874, 0.10368621971187862]
 [151985.9684083778, 12892.87578996375, -69.0358962811758, 0.12836519568713572, 0.12836519309271524, 0.12836518790683366, 0.12836518007689635, 0.12836516954818591, 0.1283651562637538, 0.12836514016430503  …  0.0013848269259475758, 0.0017387034665064228, 0.0026913330030105265, 0.0018458754694505141, 0.9996606715344537, 0.9996590674128542, 0.006910989250134671, 53.722974591694815, 52.49359282442751, 0.10359900307216743]
i = (sys.t / 1000, sys.vm)
plot(sol, idxs=i, title="Action potential", lab="Ctl", tspan=(198second, 205second))
plot!(sol_caf, idxs=i, lab="Caf", tspan=(198second, 205second), ylabel="Voltage (mV)", xlabel="Time (s)")
_images/7e61099ebdd5249ddc737a71d987f5b9bbceca0a9d5e171f02ddd07512bb0465.png
i = (sys.t / 1000, sys.Cai_sub_SR * 1000)
plot(sol, idxs=i, title="Calcium transient (During caffeine addition)", lab="Ctl", tspan=(198second, 205second))
plot!(sol_caf, idxs=i, tspan=(198second, 205second), lab="Caf", ylabel="Subspace calcium (nM)", xlabel="Time (s)")
_images/3b825882869a7692b8fb7cdfa5896eec70567c60dcbc379b7a543e6fb6475ed0.png
i = (sys.t / 1000, sys.PO1RyR)
plot(sol, idxs=i, title="RyR open (During caffeine addition)", lab="Ctl", tspan=(198second, 205second))
plot!(sol_caf, idxs=i, tspan=(198second, 205second), lab="Caf", ylabel="Open probability", ylims=(0, 1), xlabel="Time (s)")
_images/1a12f1d7e986674dfa4f77b5578ec925084c3c310367f83d2ab2a530e3578683.png
i = (sys.t / 1000, sys.Cai_sub_SR * 1000)
plot(sol, idxs=i, title="Calcium transient (After caffeine addition)", lab="Ctl", ylabel="Subspace calcium (nM)", tspan=(198second, 205second))
plot!(sol_caf, idxs=i, lab="Caf", xlabel="Time (s)", tspan=(198second, 205second))
_images/de92e6e52d345f9f51f6de89c43b57af0c5b23077b5978ed8e958d0fe460bb5b.png
i = (sys.t / 1000, sys.CaJSR)
plot(sol, idxs=i, title="SR Calcium (During caffeine addition)", lab="Ctl", ylabel="SR calcium (μM)", tspan=(198second, 205second))
plot!(sol_caf, idxs=i, tspan=(198second, 205second), lab="Caf", ylims=(0, 850), xlabel="Time (s)")
_images/451bd9dbbac3fd5f119406f8faa5ebe0e0c9ac00373e13af71761183c666008a.png
i = (sys.t / 1000, sys.Jrel)
plot(sol, idxs=sys.Jrel, title="Ca flux", lab="Ctl  (Jrel)", tspan=(198second, 205second))
plot!(sol_caf, idxs=sys.Jrel, lab="Caf (Jrel)", tspan=(198second, 205second), ylabel="μM/ms", xlabel="Time (s)")
_images/37f80f16c59594a3283244c36e7b385d45ca12bcfd331f9fd85161f146c78bfe.png
i = (sys.t / 1000, sys.CaMKAct * 100)
plot(sol, idxs=i, title="Active CaMKII", lab="Ctl")
plot!(sol_caf, idxs=i, lab="Caf", ylabel="CaMKII activity (%)", xlabel="Time (s)")
_images/ff39e84925ddc5269e46449f57aeddd4413d844e9dfa026fd936f66b3f4b11b6.png

Simulation vs experimental data#

Add caffeine in the beginning of the simulation Add caffeine and nifedipine in the beginning of the simulation (nifedipine blocks 90% of L-type calcium channel)

sys = build_neonatal_ecc_sys(simplify=true, reduce_iso=true, reduce_camk=true)
tend = 205second
stimstart = 30second
stimend = 120second
alg = KenCarp47()
@unpack Istim = sys
callback = build_stim_callbacks(Istim, stimend; period=1second, starttime=stimstart)

prob = ODEProblem(sys, [], tend)
prob_caf = ODEProblem(sys, [sys.RyRsensitivity => 10], tend)
gCaL = prob.ps[sys.GCaL]
prob_nif_caf = ODEProblem(sys, [sys.RyRsensitivity => 10, sys.GCaL => 0.1 * gCaL], tend)

ssalg = DynamicSS(alg)
sprob_caf = SteadyStateProblem(prob_caf)
sssol = solve(sprob_caf, ssalg; abstol=1e-10, reltol=1e-10)

@time sol = solve(prob, alg; callback)
@time sol_caf = solve(remake(prob_caf, u0=sssol.u), alg; callback)
@time sol_nif_caf = solve(remake(prob_nif_caf, u0=sssol.u), alg; callback)
  0.634304 seconds (40.44 k allocations: 9.749 MiB)
  0.764958 seconds (338.72 k allocations: 25.890 MiB, 15.55% compilation time)
  0.386081 seconds (33.53 k allocations: 6.906 MiB)
retcode: Success
Interpolation: 3rd order Hermite
t: 2779-element Vector{Float64}:
      0.0
      0.1842516556526937
      0.9881969350093525
      4.071270299474948
     11.4688989866004
     25.163141384431494
     49.58623607693189
     83.36385642912899
    137.50365640448712
    206.18322495233974
      ⋮
 144494.23549457573
 149073.94416657407
 154337.82680355254
 162353.72697530547
 168890.98679900536
 175428.24662270525
 184108.97098046276
 195066.0949905474
 205000.0
u: 2779-element Vector{Vector{Float64}}:
 [152640.0042112612, 12238.886159260886, -67.47381414528428, 0.12238774534090352, 0.12238774529616457, 0.12238774524114038, 0.12238774517561544, 0.12238774509936563, 0.1223877450121576, 0.12238774491374844  …  0.0017638596450064525, 0.001952346392192097, 0.003021902145994199, 0.002307168132983724, 0.9995225553916351, 0.9995225412812268, 0.007684693389176082, 57.61908320161406, 56.496755394295505, 0.08793785097064204]
 [152640.0042141091, 12238.886156491948, -67.47619475943685, 0.1223818185965825, 0.1223851950690009, 0.12238677831579461, 0.1223874199848193, 0.12238764698543343, 0.12238771819001132, 0.12238773823666656  …  0.0017638600160656548, 0.001952346221753617, 0.0030217666033719166, 0.0023071680395728308, 0.9995225553968915, 0.9995225413452139, 0.00768449829794806, 57.61908321624575, 56.49675540929363, 0.08793785091882826]
 [152640.00422878788, 12238.886147498737, -67.48645269497436, 0.12236185487337504, 0.12236852017757822, 0.12237384057761092, 0.12237796383645079, 0.12238105896017086, 0.1223833066276155, 0.12238488498679585  …  0.0017638699619140056, 0.001952328505356663, 0.0030198890222353043, 0.0023071654102667016, 0.9995225555594262, 0.999522543124083, 0.007681051616771739, 57.61908328008806, 56.49675547473479, 0.08793785069274974]
 [152640.00431924543, 12238.886180306808, -67.52386753374549, 0.12231909791279853, 0.1223275775105312, 0.1223353164374861, 0.12234233401236547, 0.1223486548328618, 0.12235430896830272, 0.12235933129445128  …  0.0017640156114249732, 0.0019519076495761074, 0.003011490018699007, 0.0023071231060288393, 0.9995225582073097, 0.9995225716050229, 0.007661818009205361, 57.619083524957574, 56.496755725674774, 0.08793784983318771]
 [152640.00473979197, 12238.886700922529, -67.60277642523533, 0.12224942510551673, 0.12225937694389216, 0.12226883719667436, 0.12227781183866258, 0.1222863079907134, 0.12229433397328028, 0.12230189929678145  …  0.0017648062287722378, 0.0019490561338360512, 0.002993777633034513, 0.0023068337967059103, 0.999522576368202, 0.9995227647549162, 0.007620323701190774, 57.61908199845374, 56.4967565633262, 0.08793691303157185]
 [152640.00614274156, 12238.889051473183, -67.71498651169316, 0.12214375740330098, 0.12215524322802843, 0.1221663610208567, 0.12217711310809014, 0.12218750220079946, 0.12219753139138598, 0.12220720414858208  …  0.0017666941214743092, 0.0019399590808876692, 0.002968722571501392, 0.002305737640309163, 0.9995226453735553, 0.9995234857193289, 0.007561675974173597, 57.6189846302126, 56.49678477383137, 0.08790203123891277]
 [152640.0100204902, 12238.896201381947, -67.83690818450387, 0.12197795303552365, 0.12199072456984728, 0.12200321332084915, 0.12201541871280648, 0.12202734026341712, 0.12203897757561831, 0.12205033032946805  …  0.0017687739001941137, 0.0019217244402520497, 0.0029416652894574897, 0.0023026090306565664, 0.9995228438968992, 0.9995254925947283, 0.007498436172285534, 57.6182283933082, 56.49720070081206, 0.08768561853823341]
 [152640.01693202136, 12238.908980729107, -67.91463718699325, 0.12176828692641892, 0.12178144622045352, 0.12179436495569337, 0.12180704090551815, 0.12181947180907807, 0.12183165536500416, 0.1218435892247961  …  0.0017684028126840336, 0.0019035888067846262, 0.002924502927002715, 0.0022970885783343466, 0.999523200609494, 0.9995289062699075, 0.007458408730688581, 57.61667735065687, 56.498943931344506, 0.08722183606147324]
 [152640.0294296765, 12238.930648230607, -67.95953340279506, 0.12145295102233668, 0.12146569008882938, 0.12147820746736533, 0.12149050026853525, 0.12150256551866555, 0.12151440015452761, 0.12152600101771875  …  0.0017641686885436231, 0.0018905740349343702, 0.0029146497154048413, 0.00228746406084038, 0.9995238453676275, 0.9995345272401215, 0.007435462113378243, 57.61559913569374, 56.50456966503896, 0.08638456134689042]
 [152640.04610748045, 12238.956084630083, -67.98534665760042, 0.12107376200718048, 0.12108565456513748, 0.12109733234232721, 0.12110879233045656, 0.12112003142670197, 0.12113104642849148, 0.1211418340279787  …  0.0017572730500318365, 0.0018848750928810657, 0.002909048565606024, 0.0022753517448559388, 0.9995247039453086, 0.9995410421905951, 0.0074223862366476785, 57.61867295983003, 56.516312346776125, 0.08533679911352007]
 ⋮
 [152693.14380011617, 12185.605748324526, -68.08143851335784, 0.11569708224455091, 0.11569707717630717, 0.11569707213693585, 0.11569706712648023, 0.11569706214496558, 0.11569705719239873, 0.11569705226876698  …  0.001606271171454166, 0.0018663668949031632, 0.0028888150515154866, 0.0021163429456537678, 0.9989949015949314, 0.9995812287223925, 0.00737400584756114, 62.65204290206649, 61.64561767778368, 0.0722466867397479]
 [152692.86425226484, 12185.884799595928, -68.08207747313097, 0.11570115698382555, 0.11570115606371316, 0.11570115518803062, 0.11570115435731909, 0.11570115357214361, 0.11570115283309423, 0.1157011521407871  …  0.0016060544834473828, 0.0018662771655717668, 0.002888680608753337, 0.002116145085135903, 0.9994077145141733, 0.9995809631193047, 0.007373684863259198, 62.65211942672219, 61.64560698602792, 0.07225732070522493]
 [152692.5496588735, 12186.199341523255, -68.0827796531144, 0.11570472460404818, 0.11570472498611221, 0.11570472541542867, 0.11570472589283075, 0.11570472641919471, 0.11570472699544207, 0.11570472762254154  …  0.0016059190773919775, 0.0018661807223807282, 0.002888528783662516, 0.002115939686412826, 0.9995385146736658, 0.99958125740998, 0.007373344291562989, 62.649863053771355, 61.64328577735816, 0.07226521040918991]
 [152692.0847807519, 12186.664327492872, -68.08382631450196, 0.11570959842741757, 0.11570959984669033, 0.11570960134521427, 0.11570960292459986, 0.11570960458653244, 0.11570960633277544, 0.11570960816517459  …  0.0016056002820292493, 0.0018660343082938721, 0.0028883100178820438, 0.002115619201479121, 0.9995759971448138, 0.9995814286938566, 0.007372787802038029, 62.64516361349072, 61.638494736453, 0.07227654570023072]
 [152691.71748643572, 12187.031476780723, -68.084603013792, 0.1157138755361523, 0.1157138779780793, 0.11571388045136272, 0.1157138829571136, 0.11571388549646733, 0.11571388807058496, 0.11571389068065467  …  0.0016055526390175861, 0.0018659315217113524, 0.0028881379957315548, 0.00211540890715682, 0.9995806886824837, 0.9995818464014947, 0.007372453624345456, 62.642718785712574, 61.63598159894787, 0.07228564493178095]
 [152691.36058198658, 12187.388501948026, -68.08546665731762, 0.1157164135495238, 0.1157164136232835, 0.1157164137626509, 0.11571641396893663, 0.11571641424351646, 0.11571641458783476, 0.1157164150034078  …  0.0016052804092790223, 0.0018658099710558132, 0.0028879538856597664, 0.0021151320881909286, 0.9995814141572061, 0.9995815759714582, 0.007371945327169291, 62.640579095566906, 61.633800883671725, 0.07229102632209657]
 [152690.90209814257, 12187.847126038254, -68.08648356740476, 0.1157211843734181, 0.115721184832464, 0.11572118534467925, 0.11572118591123151, 0.11572118653333581, 0.11572118721225669, 0.11572118794931097  …  0.0016049951717593456, 0.0018656680812101508, 0.0028877356096833804, 0.0021148191039365226, 0.9995814962225602, 0.9995815443416094, 0.00737149900777185, 62.636424126794665, 61.62956583092374, 0.07230150978479497]
 [152690.3476514688, 12188.401705554323, -68.08773200449544, 0.11572669639821097, 0.11572669680045626, 0.11572669725334163, 0.11572669775790638, 0.11572669831523502, 0.11572669892645941, 0.11572669959276125  …  0.001604653493759941, 0.0018654944165411836, 0.0028874681798945643, 0.002114437980198592, 0.9995814814446906, 0.9995814222710777, 0.0073708760437217555, 62.63177675444928, 61.62482573283979, 0.07231354878882]
 [152689.86829573885, 12188.881170472334, -68.08880911553803, 0.1157314361972457, 0.11573143646106789, 0.11573143677192477, 0.11573143713080934, 0.1157314375387555, 0.11573143799684005, 0.11573143850618497  …  0.001604418599299293, 0.0018653464645781155, 0.0028872380222799737, 0.0021141174734895123, 0.9995816833867328, 0.9995818133479581, 0.007370315279012266, 62.62775467852155, 61.620724141357464, 0.07232397977329433]
i = (sys.t / 1000, sys.vm)
tspan = (100second, 102second)
plot(sol, idxs=i, title="Action potential", lab="Ctl"; tspan)
plot!(sol_caf, idxs=i, lab="Caf"; tspan)
plot!(sol_nif_caf, idxs=i, lab="Caf + Nif", tspan=tspan, ylabel="Voltage (mV)", xlabel="Time (s)")
_images/4e50708c6ab4dd84594dbb9063b4c6212f3063f64585d378239f6db213b40927.png
savefig("caf-ap.pdf")
savefig("caf-ap.png")
"/home/github/actions-runner-2/_work/camkii-cardiomyocyte-model/camkii-cardiomyocyte-model/.cache/docs/caf-ap.png"
i = (sys.t / 1000, sys.Cai_sub_SR * 1000)
tspan = (100second, 102second)
plot(sol, idxs=i, title="Calcium transient", lab="Ctl"; tspan)
plot!(sol_caf, idxs=i, lab="Caf"; tspan)
plot!(sol_nif_caf, idxs=i, lab="Caf + Nif", ylabel="Subspace calcium (nM)", xlabel="Time (s)"; tspan)

savefig("caf-cat.pdf")
savefig("caf-cat.png")
"/home/github/actions-runner-2/_work/camkii-cardiomyocyte-model/camkii-cardiomyocyte-model/.cache/docs/caf-cat.png"
i = (sys.t / 1000, sys.CaJSR)
tspan = (100second, 102second)
plot(sol, idxs=i, title="SR Calcium", lab="Ctl", ylabel="SR calcium (μM)"; tspan)
plot!(sol_caf, idxs=i, lab="Caf"; tspan)
plot!(sol_nif_caf, idxs=i, lab="Caf + Nif", ylims=(0, 850), xlabel="Time (s)"; tspan)
_images/ddf2142304bd9d8cc9df6c41c059eb1513611ea77d6f729ee5790beff082e05d.png
i = (sys.t / 1000, sys.CaMKAct * 100)
plot(sol, idxs=i, title="Simulation", lab="Ctl")
plot!(sol_caf, idxs=i, lab="Caf")
plot!(sol_nif_caf, idxs=i, lab="Caf + Nif", ylabel="CaMKII active fraction (%)", xlabel="Time (s)")
_images/dad4a382b5ebb570676faf096b7400310d5378251850552e2e745b1c3754ec24.png
savefig("caf-camkact.pdf")
savefig("caf-camkact.png")
"/home/github/actions-runner-2/_work/camkii-cardiomyocyte-model/camkii-cardiomyocyte-model/.cache/docs/caf-camkact.png"

experiments

chemicaldf = CSV.read(joinpath(@__DIR__, "data/CaMKAR-chemical.csv"), DataFrame)
ts = Dates.value.(chemicaldf[!, "Time"]) ./ 10^9
ctl = chemicaldf[!, "Ctrl Mean"]
ctl_error = chemicaldf[!, "Ctrl SD"] ./ sqrt.(chemicaldf[!, "Ctrl N"])

caf = chemicaldf[!, "caffeine 20mM Mean"]
caf_error = chemicaldf[!, "caffeine 20mM SD"] ./ sqrt.(chemicaldf[!, "caffeine 20mM N"])

plot(ts, ctl, yerr=ctl_error, lab="Control", color=:blue, markerstrokecolor=:blue)
plot!(ts, caf, yerr=caf_error, lab="Caffeine 20mM", color=:red, markerstrokecolor=:red)
plot!(xlabel="Time (s)", ylabel="CaMKII activity (A.U.)", title= "Experiment")
_images/c1d50585135f3fae158c7d5d9bc48b7ddad93745fb72f8b005b27093602d1c5b.png
savefig("caf-exp.pdf")
"/home/github/actions-runner-2/_work/camkii-cardiomyocyte-model/camkii-cardiomyocyte-model/.cache/docs/caf-exp.pdf"

This notebook was generated using Literate.jl.