Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -797,9 +797,9 @@ version = "1.11.0"

[[deps.GLFW_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Libglvnd_jll", "Xorg_libXcursor_jll", "Xorg_libXi_jll", "Xorg_libXinerama_jll", "Xorg_libXrandr_jll", "libdecor_jll", "xkbcommon_jll"]
git-tree-sha1 = "fcb0584ff34e25155876418979d4c8971243bb89"
git-tree-sha1 = "b7bfd56fa66616138dfe5237da4dc13bbd83c67f"
uuid = "0656b61e-2033-5cc2-a64a-77c0f6c09b89"
version = "3.4.0+2"
version = "3.4.1+0"

[[deps.GPUArraysCore]]
deps = ["Adapt"]
Expand Down Expand Up @@ -2819,9 +2819,9 @@ version = "1.28.1+0"

[[deps.libpng_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Zlib_jll"]
git-tree-sha1 = "5cb3c5d039f880c0b3075803c8bf45cb95ae1e91"
git-tree-sha1 = "de8ab4f01cb2d8b41702bab9eaad9e8b7d352f73"
uuid = "b53b4c65-9356-5827-b1ea-8c7a1a84506f"
version = "1.6.51+0"
version = "1.6.53+0"

[[deps.libvorbis_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Ogg_jll"]
Expand Down
287 changes: 287 additions & 0 deletions docs/bcl-data-fit.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "e39c5573",
"metadata": {},
"source": [
"# Pacing data\n",
"\n",
"Experiments vs simulations."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "83bfe6d9",
"metadata": {},
"outputs": [],
"source": [
"using ModelingToolkit\n",
"using OrdinaryDiffEq, SteadyStateDiffEq, DiffEqCallbacks\n",
"using Plots\n",
"using CSV\n",
"using DataFrames\n",
"using CaMKIIModel\n",
"using CaMKIIModel: second\n",
"Plots.default(lw=1.5)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a2f8930a",
"metadata": {},
"outputs": [],
"source": [
"sys = build_neonatal_ecc_sys(simplify=true, reduce_iso=true, reduce_camk=true)\n",
"tend = 500second\n",
"prob = ODEProblem(sys, [], tend)\n",
"stimstart = 100second\n",
"stimend = 300second\n",
"@unpack Istim = sys\n",
"alg = KenCarp47()"
]
},
{
"cell_type": "markdown",
"id": "4913c735",
"metadata": {},
"source": [
"## Pacing duration and CaMKII activity\n",
"\n",
"### Experiments"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "24c3f0e3",
"metadata": {},
"outputs": [],
"source": [
"durationdf = CSV.read(joinpath(@__DIR__, \"data/CaMKAR-duration.csv\"), DataFrame)\n",
"ts = durationdf[!, \"Time(sec)\"]\n",
"fifteen = durationdf[!, \"1Hz 15sec (Mean)\"]\n",
"fifteen_error = durationdf[!, \"1Hz 15sec (SD)\"] ./ sqrt.(durationdf[!, \"1Hz 15sec (N)\"])\n",
"thirty = durationdf[!, \"1Hz 30sec (Mean)\"] .+ 0.25\n",
"thirty_error = durationdf[!, \"1Hz 30sec (SD)\"] ./ sqrt.(durationdf[!, \"1Hz 30sec (N)\"])\n",
"sixty = durationdf[!, \"1Hz 60sec (Mean)\"]\n",
"sixty_error = durationdf[!, \"1Hz 60sec (SD)\"] ./ sqrt.(durationdf[!, \"1Hz 60sec (N)\"])\n",
"ninety = durationdf[!, \"1Hz 90sec (Mean)\"] .- 0.25\n",
"ninety_error = durationdf[!, \"1Hz 90sec (SD)\"] ./ sqrt.(durationdf[!, \"1Hz 90sec (N)\"])\n",
"\n",
"## 30 sec timeseries +0.25 and 90 sec timeseries -0.25 for a consistent baseline before pacing.\n",
"plot(ts, fifteen, yerr=fifteen_error, lab=\"15 sec\", color=:blue, markerstrokecolor=:blue)\n",
"plot!(ts, thirty, yerr=thirty_error, lab=\"30 sec\", color=:red, markerstrokecolor=:red)\n",
"plot!(ts, sixty, yerr=sixty_error, lab=\"60 sec\", color=:orange, markerstrokecolor=:orange)\n",
"plot!(ts, ninety, yerr=ninety_error, lab=\"90 sec\", color=:green, markerstrokecolor=:green)\n",
"plot!(title=\"Experiment\", xlabel=\"Time (s)\", ylabel=\"CaMKII activity (AU)\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5a5465b5",
"metadata": {},
"outputs": [],
"source": [
"savefig(\"pacing-duration-exp.pdf\")"
]
},
{
"cell_type": "markdown",
"id": "6179dde0",
"metadata": {},
"source": [
"### Simulation"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1135d95a",
"metadata": {},
"outputs": [],
"source": [
"stimstart = 30second\n",
"callback15 = build_stim_callbacks(Istim, stimstart + 15second; period=1second, starttime=stimstart)\n",
"sol15 = solve(prob, alg; callback=callback15)\n",
"callback30 = build_stim_callbacks(Istim, stimstart + 30second; period=1second, starttime=stimstart)\n",
"sol30 = solve(prob, alg; callback=callback30)\n",
"callback60 = build_stim_callbacks(Istim, stimstart + 60second; period=1second, starttime=stimstart)\n",
"sol60 = solve(prob, alg; callback=callback60)\n",
"callback90 = build_stim_callbacks(Istim, stimstart + 90second; period=1second, starttime=stimstart)\n",
"sol90 = solve(prob, alg; callback=callback90)\n",
"idxs = (sys.t / 1000, sys.CaMKAct * 100)\n",
"\n",
"plot(sol15, idxs=idxs, tspan=(0second, 205second), lab=\"15 sec\", color=:blue)\n",
"plot!(sol30, idxs=idxs, tspan=(0second, 205second), lab=\"30 sec\", color=:red)\n",
"plot!(sol60, idxs=idxs, tspan=(0second, 205second), lab=\"60 sec\", color=:orange)\n",
"plot!(sol90, idxs=idxs, tspan=(0second, 205second), lab=\"90 sec\", color=:green)\n",
"plot!(title=\"Simulation\", xlabel=\"Time (s)\", ylabel=\"CaMKII activity (%)\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5d5599f7",
"metadata": {},
"outputs": [],
"source": [
"savefig(\"pacing-duration-sim.pdf\")"
]
},
{
"cell_type": "markdown",
"id": "6209d573",
"metadata": {},
"source": [
"### Phosphorylated fraction"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2fbd5b3b",
"metadata": {},
"outputs": [],
"source": [
"idxs = (sys.t / 1000, (sys.CaMKP + sys.CaMKA + sys.CaMKA2) * 100)\n",
"plot(sol15, idxs=idxs, tspan=(0second, 205second), lab=\"15 sec\", color=:blue)\n",
"plot!(sol30, idxs=idxs, tspan=(0second, 205second), lab=\"30 sec\", color=:red)\n",
"plot!(sol60, idxs=idxs, tspan=(0second, 205second), lab=\"60 sec\", color=:orange)\n",
"plot!(sol90, idxs=idxs, tspan=(0second, 205second), lab=\"90 sec\", color=:green)\n",
"plot!(title=\"Simulation\", xlabel=\"Time (s)\", ylabel=\"Phosphorylated CaMKII (%)\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "70df2b76",
"metadata": {},
"outputs": [],
"source": [
"savefig(\"pacing-duration-phos.pdf\")"
]
},
{
"cell_type": "markdown",
"id": "6df99024",
"metadata": {},
"source": [
"## Pacing frequency and CaMKII activity\n",
"\n",
"### Experiments"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ba30e1bc",
"metadata": {},
"outputs": [],
"source": [
"freqdf = CSV.read(joinpath(@__DIR__, \"data/CaMKAR-freq.csv\"), DataFrame)\n",
"ts = 0:5:205\n",
"onehz = freqdf[!, \"1Hz (Mean)\"]\n",
"onehz_error = freqdf[!, \"1Hz (SD)\"] ./ sqrt.(freqdf[!, \"1Hz (N)\"])\n",
"twohz = freqdf[!, \"2Hz (Mean)\"]\n",
"twohz_error = freqdf[!, \"2Hz (SD)\"] ./ sqrt.(freqdf[!, \"2Hz (N)\"])\n",
"\n",
"plot(ts, onehz, yerr=onehz_error, lab=\"1 Hz\", color=:blue, markerstrokecolor=:blue)\n",
"plot!(ts, twohz, yerr=twohz_error, lab=\"2 Hz\", color=:red, markerstrokecolor=:red)\n",
"plot!(title=\"Experiment\", xlabel=\"Time (s)\", ylabel=\"CaMKII activity (AU)\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b5f1b294",
"metadata": {},
"outputs": [],
"source": [
"savefig(\"pacing-frequency-exp.pdf\")"
]
},
{
"cell_type": "markdown",
"id": "588d3456",
"metadata": {},
"source": [
"### Simulations"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "18df9887",
"metadata": {},
"outputs": [],
"source": [
"tend = 205.0second\n",
"prob = ODEProblem(sys, [], tend)\n",
"stimstart = 30.0second\n",
"stimend = 120.0second\n",
"callback = build_stim_callbacks(Istim, stimend; period=1second, starttime=stimstart)\n",
"sol1 = solve(prob, alg; callback)\n",
"\n",
"callback2 = build_stim_callbacks(Istim, stimend; period=0.5second, starttime=stimstart)\n",
"sol2 = solve(prob, alg; callback=callback2)\n",
"idxs = (sys.t / 1000, sys.CaMKAct * 100)\n",
"\n",
"plot(sol1, idxs=idxs, lab=\"1 Hz\", color=:blue)\n",
"plot!(sol2, idxs=idxs, lab=\"2 Hz\", color=:red)\n",
"plot!(title=\"Pacing frequency\", xlabel=\"Time (s)\", ylabel=\"CaMKII activity (%)\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "326ddd77",
"metadata": {},
"outputs": [],
"source": [
"savefig(\"pacing-frequency-sim.pdf\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "81231962",
"metadata": {},
"outputs": [],
"source": [
"idxs = (sys.t / 1000, (sys.CaMKP + sys.CaMKA + sys.CaMKA2) * 100)\n",
"plot(sol1, idxs=idxs, lab=\"1 Hz\", color=:blue)\n",
"plot!(sol2, idxs=idxs, lab=\"2 Hz\", color=:red)\n",
"plot!(title=\"Pacing frequency\", xlabel=\"Time (s)\", ylabel=\"Phosphorylated CaMKII (%)\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "eae708c7",
"metadata": {},
"outputs": [],
"source": [
"savefig(\"pacing-frequency-phos.pdf\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.12.2",
"language": "julia",
"name": "julia-1.12"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.12.2"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading