-
Notifications
You must be signed in to change notification settings - Fork 1
/
NFKBExample.jl
3003 lines (2455 loc) · 124 KB
/
NFKBExample.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
### A Pluto.jl notebook ###
# v0.19.26
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
local el = $(esc(element))
global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : iv(el)
el
end
end
# ╔═╡ 074df803-6b6b-42a4-ab95-a8cd2e449003
using MinimallyDisruptiveCurves, OrdinaryDiffEq, Plots, LinearAlgebra, ModelingToolkit, QuadGK, Dierckx, JuMP, Ipopt, Printf, PlutoUI, ForwardDiff, PlotlyJS, SciMLSensitivity
# ╔═╡ eb50b30e-5d86-4a77-a729-cda305aa13e0
plotlyjs()
# ╔═╡ deb73614-2fe4-4455-8e1f-9fce99d7d929
plot = Plots.plot
# ╔═╡ 3d1ad2a6-9e43-11ec-10e7-a1ee1b96d8b7
md"""
# Analysis of NFκB regulatory module model using MinimallyDisruptiveCurves.jl
## Dhruva V. Raman
#### (github: Dhruva2, email: dvr23@cam.ac.uk)
### Introduction
- This classic model is constructed in:
**Lipniacki, Tomasz, et al. "Mathematical model of NF-κB regulatory module." Journal of theoretical biology 228.2 (2004): 195-215.**
- It models the dynamics of the intracellular NFκB regulatory module in response to a time-course of the extracellular cytokine TNF (tumour necrosis factor).
"""
# ╔═╡ 0652e329-01b8-4087-9c15-f3692244ce75
md"""
Schematic of the reaction network:
$(LocalResource("nfkb_pics/NFKB_network.png"))
- crosses denote inhibitory effects
- thick arrows are fast timescale reactions, according to the paper
"""
# ╔═╡ d0946918-96d5-4ef2-953b-b323f7a8b7bb
md"""
### What is done in this notebook
#### 1. Build NFκB model, and NFκB output map.
- The ODE model is of the form: $$\dot{x} = f(x, p, u, t)$$, and the output map is of the form $$y = g(x)$$.
- ``p`` are the parameters. $p_0$ are the initial (best-fit) parameters. ``t`` is time.
- ``u(t)`` is an autonomous input representing the time course of TNF influx. We took ``u = heaviside(3600 seconds)`` as in the paper. You can choose different, or multiple, input time-courses, if you prefer.
#### 2. Build a differentiable loss function `lossf1` of the form:
$$C(p) = \int^T_0 \| y(p,t) - y(p_0,t)\|_2^2.$$
- This quantifies the change in the output trajectory as the parameters are varied from $p_0$.
#### 3. Demonstrate **one way** of generating initial curve directions for the minimally disruptive curves.
- First we calculate the Hessian $H = \nabla^2 C(p_0)$. Note that $\nabla C(p_0) = 0$ by local minimality, and that $H$ is positive semidefinite for the same reason.
- So any direction $v$ in parameter space for which $Hv \approx 0$ corresponds to a direction that **locally** does not disrupt the cost function much.
- In this example, we look for vectors that are locally nondisruptive and also sparse in the parameters. In other words, combinations of a small number of parameters that can **locally** be changed in such a way that the cost function doesn't increase much.
- To do so, we solve the nonconvex, quadratically constrained quadratic program:
$$\min_x x^T H x + \lambda \| x \|_1 : \quad x^Tx = 1,$$
where $H$ is the hessian, and $\lambda = 1$ is a regularisation hyperparameter.
- This uses a simple approx 20 line function `sparse_init_dir` included in helper_functions.jl.
- We set $\lambda = 1.$. This $\mathcal{L}_1$ regularisation term enforces sparsity, so the initial curve directions only involve a few parameters at a time.
- This is **nonconvex**, with multiple local solutions. By randomising the initial conditions of the optimisation, we get many different solutions corresponding to different promising initial curve directions.
- We removed duplicate solutions and selected the 5 best directions
**This is one way of selecting sparse (in the number of non-neglibily changing parameters) directions without user brainpower. In specific problems you might want to have more custom ways of exploring potential initial directions**
#### 4. Generate minimally disruptive curves corresponding to each of the generated initial curve directions.
- You can run the nth curve yourself by reassigning `which_dir = n`.
- The longest curves took 410 seconds on my laptop. Most took 100-200 seconds.
- You could generate curve 6, 7, etc...there are about 20 potential directions.
#### 5. Visualisation of the curves
#### 6. Scientific analysis of the curves is provided at the bottom of the notebook
- But note that I'm not a domain expert on this system :)
"""
# ╔═╡ 6436885a-5252-41c5-ba24-f99945c6f537
md"""
# Build model
"""
# ╔═╡ 0a879b62-3b5d-4cc7-bd57-c5446c15ea67
begin
# include("helper_functions.jl")
alg = Vern7 #or eg Tsit5, used for solving ODE
solve = OrdinaryDiffEq.solve #because it clashes with JuMP.solve
end
# ╔═╡ 9eebc5eb-3765-4e54-a842-39e3b6bbca26
function NFKBModel(input)
ModelingToolkit.@variables t
D = Differential(t)
ModelingToolkit.@parameters kprod kdeg k1 k2 k3 a1 a2 a3 t1 t2 c6a i1 kv c1 c2 c3 c4 c5 c4a c5a i1a e1a c1a c2a c3a e2a c1c c2c c3c
ModelingToolkit.@variables IKKN(t) IKKa(t) IKKi(t) IKKaIkBa(t) IKKaIkBaNfKb(t) NFkB(t) NFkBn(t) A20(t) A20t(t) IkBa(t) IkBan(t) IkBat(t) IkBaNfKb(t) IkBaNfKbn(t) Cgent(t) IKKtot(t) IkBa_cyto(t)
default_ics = [
IKKN => 0.0, IKKa => 0.0, IKKi => 0.0, IKKaIkBa => 0.0, IKKaIkBaNfKb => 0.0, NFkB => 0.0, NFkBn => 0.0, A20 => 0.0, A20t => 0.0, IkBa => 0.0, IkBan => 0.0, IkBat => 0.0, IkBaNfKb => 0.06, IkBaNfKbn => 0.0, Cgent => 0.0
]
default_ps = [kprod => 2.5e-5, kdeg => 0.000125, k1 => 0.0025, k2 => 0.1, k3 => 0.0015, a1 => 0.5, a2 => 0.2, a3 => 1.0, t1 => 0.1, t2 => 0.1, c6a => 2.0e-5, i1 => 0.0025, kv => 5.0, c1 => 5.0e-7, c2 => 0.0, c3 => 0.0004, c4 => 0.5, c5 => 0.0003, c4a => 0.5, c5a => 0.0001, i1a => 0.001, e1a => 0.0005, c1a => 5.0e-7, c2a => 0.0, c3a => 0.0004, e2a => 0.01, c1c => 5.0e-7, c2c => 0.0, c3c => 0.0004]
eqs = [
D(IKKN) ~ kprod - kdeg * IKKN - k1 * IKKN * input(t),
D(IKKa) ~ -k3 * IKKa - kdeg * IKKa - a2 * IKKa * IkBa + t1 * IKKaIkBa - a3 * IKKa * IkBaNfKb + t2 * IKKaIkBaNfKb + (k1 * IKKN - k2 * IKKa * A20) * input(t),
D(IKKi) ~ k3 * IKKa - kdeg * IKKi + k2 * IKKa * A20 * input(t),
D(IKKaIkBa) ~ a2 * IKKa * IkBa - t1 * IKKaIkBa,
D(IKKaIkBaNfKb) ~ a3 * IKKa * IkBaNfKb - t2 * IKKaIkBaNfKb,
D(NFkB) ~ c6a * IkBaNfKb - a1 * NFkB * IkBa + t2 * IKKaIkBaNfKb - i1 * NFkB,
D(NFkBn) ~ i1 * kv * NFkB - a1 * IkBan * NFkBn,
D(A20) ~ c4 * A20t - c5 * A20,
D(A20t) ~ c2 + c1 * NFkBn - c3 * A20t,
D(IkBa) ~ -a2 * IKKa * IkBa - a1 * IkBa * NFkB + c4a * IkBat - c5a * IkBa - i1a * IkBa + e1a * IkBan,
D(IkBan) ~ -a1 * IkBan * NFkBn + i1a * kv * IkBa - e1a * kv * IkBan,
D(IkBat) ~ c2a + c1a * NFkBn - c3a * IkBat,
D(IkBaNfKb) ~ a1 * IkBa * NFkB - c6a * IkBaNfKb - a3 * IKKa * IkBaNfKb + e2a * IkBaNfKbn,
D(IkBaNfKbn) ~ a1 * IkBan * NFkBn - e2a * kv * IkBaNfKbn,
D(Cgent) ~ c2c + c1c * NFkBn - c3c * Cgent,
IKKtot ~ IKKN + IKKa + IKKi,
IkBa_cyto ~ IkBa + IkBaNfKb
]
# obs = [NFkBn, IkBa_cyto, A20t, IKKtot, IKKa, IkBat]
od = ODESystem(eqs, checks=false, name = :NFKB_model, defaults = Dict(default_ics...,default_ps...))
return od |> structural_simplify
end
# ╔═╡ af8a5001-c7ed-4e31-a032-a4511f75fb7e
function NFKB_output_map(x)
return [x[7], x[10] + x[13], x[9], x[1] + x[2] + x[3], x[2], x[12]]
end
# ╔═╡ d2c6c608-d99e-4443-82ba-465505a27c5f
NFKB_output_map(x, t, integrator) = output_map(x)
# ╔═╡ da52e3ac-e7d1-4c76-818a-9ecca78a63a7
md"""
- Below, we fix the parameters that are clearly non-disruptive just from inspection of the equations: they only affect system states which do not interact with or affect the output. You don't have to: then your first minimally disruptive curves would go along these parameters.
- We also transform the parameters and cost functions by using the `log_abs` transform:
$$\phi(p) = log(abs(p))$$
$$\tilde{C}(\phi(p)) = C(\phi(p))$$.
- This prevents sign changes, and allows us to consider relative changes in the parameters, i.e. we bypass the issue that the nominal parameter values span several orders of magnitude.
"""
# ╔═╡ 08da0873-c655-431a-afa6-6954330eebcb
get_param_vals(od) = [ModelingToolkit.get_defaults(od)[el] for el in parameters(od)]
# ╔═╡ 3d7c0527-5176-4a35-b4ee-dfe09ba34c4c
begin
tspan = (0.0, 50000.0)
od = NFKBModel(soft_heaviside(0.01, 3600)) #argument is input to the model
to_fix = ["c2c", "c2", "c2a", "c3c", "c1c", "a2"]
ts1 = fix_params(get_param_vals(od), get_name_ids(parameters(od), to_fix))
od = transform_ODESystem(od, ts1)
ts2 = logabs_transform(get_param_vals(od))
od = transform_ODESystem(od, ts2)
prob = ODEProblem(od, [], tspan, [])
p0 = [ModelingToolkit.get_defaults(od)[el] for el in parameters(od)]
end
# ╔═╡ f5b3757f-3806-46cd-a36d-416380207364
md"""
# Build loss function and derivatives
- below, we make a loss function on the solution. It is the l2 norm deviation of the output map of the model simulation, vs the nominal simulation at p0
- We use ForwardDiff to build a gradient function that returns the gradient of the loss function, with respect to parameters.
- We package both the loss and its gradient into a `DiffCost` struct
"""
# ╔═╡ 7ce245b4-22bf-4e2c-932f-6cf5b4ed518a
begin
om = NFKB_output_map
nom_sol = solve(prob, alg())
tsteps = nom_sol.t
integrand(el1, el2) = sum(abs2, om(el1) - om(el2))
lossf(sol, nom_sol) = sum(integrand(el1, el2) for (el1, el2) in zip(eachcol(sol), eachcol(nom_sol)))
lossf1(sol) = lossf(sol, nom_sol)
end
# ╔═╡ d3a8494e-7298-4cce-aa90-0f86f007dab1
begin
function lloss(p)
pprob = remake(prob; p=p)
psol = solve(pprob, Tsit5(), saveat=tsteps)
lossf1(psol)
end
autodiff_prototype = zero(prob.p)
autodiff_chunk = ForwardDiff.Chunk(autodiff_prototype)
cfg = ForwardDiff.GradientConfig(lloss, autodiff_prototype, autodiff_chunk)
g! = (x, out) -> ForwardDiff.gradient!(out, cost_function, x, gcfg)
function llossg(p, g)
ForwardDiff.gradient!(g, lloss, p, cfg)
lloss(p)
end
cost = DiffCost(lloss, llossg)
end
# ╔═╡ b1f0a9cf-f121-4827-a350-0e15ef1584db
md"""
- Next, we calculate the Hessian at `p0` (the **one** time we expensively calculate the Hessian).
**Warning**
For some reason, the compilation time for the function calculating the Hessian can take 5-10 minutes.
After being run (and compiled) the first time, hessian calculation takes a more reasonable 17 seconds on my computer.
To avoid you waiting around, I've hardcoded the Hessian. If you would prefer to calculate it yourself, check the tickbox below.
"""
# ╔═╡ 39afd0a0-92c4-476e-89ed-24ee2e29f1c2
nom_prob_oop = ODEProblem(od, [], tspan, []); # oop for second_order_sensitivities
# ╔═╡ 8e4bd4a6-c8b0-4c58-bdb7-e84bad206d8d
md"""
`calc_hessian = ` $(@bind calc_hessian CheckBox(default=false))
"""
# ╔═╡ 9f0b962c-ebe3-44cc-9a87-3a95b786cd60
hess_frozen = [102.12641140226053 -81.3090757608784 0.4996364246270649 -5.663595556082101 -0.2901920538817271 0.30655652328652555 6.024114842157197 -0.005307257080373959 0.07754821773825582 0.12014153759849908 0.46818866720401553 -2.0005786990861845 -5.239528495217448 4.329095461709958 -5.239541726312839 4.07494313708362 -4.600967886494771 0.14703918521993348 1.008145057287894 0.007811540903952704 -4.600954655399368 5.783859615223911 0.007311412521170705; -81.30906136008667 71.23802310347462 -0.029053009044814556 0.2473337648415032 0.02106486517746186 -0.01330595082141438 -0.26677743569138906 0.00016878027172241664 -0.02324246905384989 -0.004193439850462609 -0.04577773202832765 -0.04331291222423792 0.2311899279721555 -0.19880837142464852 0.2311906840889168 -0.18920580249193641 0.2387246467022419 -0.006960727817270917 -0.026436661082936602 -0.0001979120977526152 0.23872389058548188 -0.280350531655187 -0.0006399836195400991; 0.49963660789622 -0.029068672122727214 0.22592194177439734 -0.3280271992017482 0.014036438022369339 0.06433536217560548 0.5618006693071514 -0.00021934817738878797 0.028218033024107 0.038699789089159393 0.30136879160705365 0.1216063041730147 -0.26387761840622875 0.35384038024432185 -0.26387818548988545 0.32220712110931526 0.24100654213752312 -0.007912949804850605 0.3525172364332973 -0.012399024222268084 0.24100710922118 0.4022806817945533 -0.008417954056292842; -5.66359628365607 0.2473402148373205 -0.3280270681164339 5.276810906311112 0.2905106381144999 -0.26153264514847047 -5.4732742576043805 0.006340152151065181 -0.01811584772192227 -0.09389151123112424 -0.21555043705459423 2.2555418474309814 4.912100116173694 -3.951323846736208 4.912112176337008 -3.7194359770912584 4.5065770140014125 -0.1454270571764518 -0.8072960992965074 -0.01478391098628299 4.5065649538381 -5.300677906675369 -0.011451221477209724; -0.2900902082013329 0.02107108605240282 0.014226259180477385 0.2904333959167081 0.04333583048133787 0.005933724235704126 -0.21669468067363498 0.00014792426337918558 -0.0024566467039815994 0.013106750526239259 0.031258707816196996 -0.14438882134421252 0.2679679559424826 -0.19753494168366564 0.2679691366117273 -0.1999226815718925 0.527768567602801 -0.01519838278247893 0.1471515952889802 -0.006068246436462436 0.527767386933556 -0.27048900045389196 -0.0054801109522463415; 0.3065568708567125 -0.01332164457896609 0.06433539392794951 -0.2615323225272903 0.00574582399376338 0.13750758833074875 0.376160003873366 -7.155950133345196e-5 -0.006807120020711511 0.020438586534787355 0.014903628859257056 0.008228253300205686 -0.2294830406647824 0.3009274247861657 -0.22948311259941115 0.26859420002703926 0.19675536990394277 -0.010973289117408466 0.3521765263207357 -0.026062493539218037 0.1967554418385711 0.3936429802423298 -0.009637033750625605; 6.023899013239345 -0.2667858113345529 0.561697203271516 -5.472981428501693 -0.21638454583321606 0.3759418548758684 6.040821788339024 -0.0064397527403602306 0.03586278261746284 0.15252415931957 0.615961020281329 -1.8445592703477556 -5.061870022953742 4.315158547767322 -5.061882111924266 4.037545233990784 -3.7529384075512047 0.11677067843461876 1.2999688418194313 -0.015384185234668135 -3.7529263185806507 5.668416438233247 -0.00409796743543107; -0.005307210895774339 0.00016884296734581735 -0.00021930763331556275 0.0063401050529121716 0.00014876793295425574 -7.15463473505272e-5 -0.0064415799954059974 0.00013717664530780367 1.812053760963748e-5 -0.00013964777338976677 0.00019061583090255942 0.011655920946072734 0.005199658187368731 -0.0021697744818903165 0.005199659637068683 -0.001770716349792081 0.004240201050875664 -0.00022984676242481273 -0.0022919726148544987 -0.00013818128878339913 0.004240199601175688 -0.0038533029380658354 -1.4143423005261044e-5; 0.0776547708293972 -0.02307076412202872 0.028113369981245057 -0.01832957771993947 -0.0007711191033674461 -0.006792842111255145 0.03591359267699333 1.7104766453624778e-5 0.01718483030038949 0.003045883640928556 0.056887098777107806 0.09058807109514519 -0.012851464264763522 0.02067357081533844 -0.012851643779779742 0.022058152179302324 -0.02423472075867028 0.001147300694158847 -0.012962068635453822 0.002209756439281627 -0.02423454124361896 0.016934019161078697 0.0004075949483308286; 0.12014313846475358 -0.004219368335273456 0.03870041196020452 -0.09389313867877914 0.012793695107643766 0.02043981915867393 0.15286583857604302 -0.0001396701505416962 0.0030436894338475434 0.013541558488379485 0.06356434660007353 -0.029333945416280826 -0.07656706839226118 0.10603544797212097 -0.07656723376656722 0.09706330845868424 0.07062553774520118 -0.002248185767675531 0.105520535760549 -0.003326695912901079 0.07062570311950751 0.1227192971334589 -0.0026370878996154917; 0.4681884853817316 -0.0458253728222757 0.30137300941027484 -0.21554535366605912 0.030696890897796675 0.014904129751679072 0.616273701430376 0.00019060704597753016 0.05713853571677079 0.0635647592759266 1.024727639099573 2.0872960558228746 -0.15908764824644142 0.4808023216582521 -0.15908934280873677 0.4475098904212998 0.8507617858177846 -0.03307208052898515 0.26624572873720714 -0.016608610712716285 0.8507634803800778 0.34013078439981687 -0.0099158103331282; -2.0006322403257064 -0.04328685323047599 0.1216138206697319 2.255598320121595 -0.14409942224833444 0.008238174945595507 -1.845621242533438 0.011655691573665786 0.091252582580291 -0.02933150527370947 2.0872315696697457 14.540463673366915 1.8998238093108464 0.21511554075999928 1.8998161530362454 0.3818803190722559 2.828578742722187 -0.17435364025767533 -1.4323169554047628 -0.11342474162326144 2.828586398996787 -0.9203964216015696 -0.004673674743285693; -5.663583017414312 0.24733946351351 -0.3280264958473123 5.276798802104336 0.2905094907967421 -0.2615325603199175 -5.473262211506039 0.00634015056613794 -0.018115853204401143 -0.09389133627887582 -0.2155487448266824 2.255549287037338 4.912122167292202 -3.9513435818607774 4.912099780179707 -3.7194241474454857 4.506565795079126 -0.14542677370591545 -0.8072954147466487 -0.014783905233949091 4.506553734912142 -5.300662826055679 -0.011451190887374977; 4.586335565308482 -0.20787448530465835 0.38567506677229285 -4.1871191107745 -0.20711786058394704 0.3136984283974149 4.578494382653154 -0.00277385434179146 0.022985761763593134 0.1198513234783741 0.4884960215208066 -0.1522629044565889 -3.9513439944229747 3.752852009305208 -3.9513231213562383 3.5667924711077843 -3.062496099002926 0.08027473821351438 0.7850697861140661 -0.02915054763090035 -3.0624850132258126 4.689936025958068 -0.002380436566396278; -5.66359628224263 0.24734021405149026 -0.3280270682104682 5.27681090675001 0.2905106380540048 -0.26153264523192316 -5.473274258077811 0.006340152148155253 -0.018115847421047302 -0.09389151127777384 -0.21555043709835328 2.255541848367601 4.9121001184038136 -3.951323849980236 4.912112178567127 -3.719435979282281 4.506577009003349 -0.14542705704420614 -0.80729610479844 -0.014783910805182411 4.5065649488400465 -5.300677910539376 -0.011451221346691885; 4.290282722990687 -0.19674752587039515 0.34856197777299913 -3.9177568993948166 -0.2078208865538083 0.2795780121088446 4.2585333526585245 -0.002278022253592614 0.02386806833265435 0.10857673928325819 0.4523238381937379 0.0693085746810863 -3.71942448912633 3.566792451166095 -3.719435343812461 3.422585708518519 -3.036257606709965 0.07901282641743014 0.636088077639297 -0.024261001859835638 -3.036246752023822 4.428601365293448 1.1393164049096775e-5; -4.703105296851171 0.23582256635776988 0.18851842563576152 4.572493033663015 0.47212170114890084 0.15886111039565 -3.848222785843337 0.003946832247927675 -0.0183546298083815 0.07976326360448659 0.8044383535018842 2.586619068598722 4.506563577213726 -3.062494817745872 4.506578384723435 -3.0362564522195146 7.881789983288386 -0.25902747110571117 1.177913102437629 -0.12710815240721302 7.881775175778683 -4.394844386654702 -0.06793010850183932; 0.15883079744432957 -0.007125168393040832 -0.004280120307751863 -0.15483774642863052 -0.012993763280359671 -0.00802755884336824 0.1308425869646295 -0.0002572870819073291 0.0008790069877889547 -0.0022232674381683164 -0.02903789931945404 -0.17613098530632598 -0.14542673047459206 0.08027471853205838 -0.1454271242813084 0.07901280742787745 -0.2590274322381503 0.00453273802754445 -0.024674488039075137 0.0061345552529078464 -0.259027038431434 0.1247569402949048 0.002387111553704379; 1.2811722352350265 -0.03655376339698703 0.3864289595809419 -1.055656583248906 0.12890629863029193 0.37221569363013823 1.6391159568513152 -0.0034784901113055805 -0.007904736002430182 0.1221082629798696 0.29898420293207517 -1.869943697443534 -0.8072968503485513 0.7850696691595522 -0.8072948809761132 0.6360880094064464 1.1779103012370384 -0.024674427295546003 1.8093777383309584 -0.06395983144914104 1.1779083318645986 1.113900233087697 -0.041388127971858646; 0.01223929632169012 -0.00026169489191867437 -0.009984539630867402 -0.01756284006891596 -0.004425231136482195 -0.030850839867609527 -0.00843750181966614 -0.00012291965692713786 0.001997101919063723 -0.003480142482931312 -0.009981328946403117 -0.10034880900040406 -0.014783930575963179 -0.029150504252381238 -0.014784039363376252 -0.02426096755394096 -0.12710799067527095 0.006134552037415684 -0.06395978942781794 0.005135229914780878 -0.12710788188785746 -0.030385639086242956 0.0025618380689431093; -4.703092054840791 0.23582181776932484 0.18851888841348968 4.572480901715991 0.4721204805598978 0.15886114164448414 -3.8482103470733495 0.003946830431624424 -0.018353652547539092 0.07976335031008953 0.804439801421877 2.5866264461226147 4.506549851487337 -3.0624858159407826 4.506564658996908 -3.036247456978277 7.8817636331168615 -0.25902665266571845 1.1779052249392221 -0.1271077249732854 7.8817832728867625 -4.39486330090815 -0.06792981219472802; 6.149475922501976 -0.2918932339131516 0.457748971963162 -5.624411514923054 -0.2713308937262942 0.41734768097865155 6.054376916846093 -0.004784767730828922 0.017213026169419908 0.1347966133171138 0.36725312261821 -1.427842517101893 -5.300663284214056 4.689935226461185 -5.300677084891934 4.428600691271018 -4.394848133099298 0.12475704503587015 1.1138988043235762 -0.030385600001989053 -4.394866291265272 6.127898532671173 -0.0006313635551474841; 0.007598431129150579 -0.0006322816169578735 -0.008384836947288612 -0.011498205989071794 -0.004950878808268719 -0.009328242260949186 -0.0035549875121382844 -9.176759646242094e-6 0.0003859043203533021 -0.002743150783964886 -0.00872981728064888 -0.0024140162283707643 -0.011451138001102767 -0.002380443103913848 -0.011451240362852706 1.1386905059220335e-5 -0.0679300351611682 0.0023871100429951864 -0.0413881429859736 0.0025618427535406135 -0.0679299327994179 -0.000631416358392187 0.003782159263970804];
# ╔═╡ aa351f0a-3a71-44d2-a2e0-7156a6a802c9
if calc_hessian
hess = second_order_sensitivities(lossf1, nom_prob_oop, alg());
else
hess = hess_frozen;
end
# ╔═╡ 3b1203f4-c6a7-4c34-8dab-c9c4e04771a0
md"""
Next we generate potential directions by solving the QCQP defined in the introduction, 100 times. Random initialisation of the initial guess means that each solution is different. We then prune duplicates and order the solutions in terms of how good they are
"""
# ╔═╡ ac485dc4-415e-45ca-8709-df29d9cb45f5
function sparse_init_dir(hessian; orthogonal_to = nothing, λ = 1.0, start = randn(size(hessian)[1]), trim_level = 1e-5)
n = size(hessian)[1]
model = Model(Ipopt.Optimizer)
JuMP.set_silent(model)
JuMP.@variable(model, x[1:n])
JuMP.@variable(model, z[1:n])
for i = 1:n
set_start_value(x[i], start[i])
end
@objective(model, Min, x' * hessian * x + λ * sum(z))
@constraint(model, x' * x == 1.0)
@constraint(model, z .>= x)
@constraint(model, z .>= -x)
if !(orthogonal_to === nothing)
for el in orthogonal_to
@constraint(model, x' * el == 0)
end
end
JuMP.optimize!(model)
out = value.(x)
out[abs.(out).<trim_level] .= 0
val = out' * hessian * out
return out, val
end
# ╔═╡ ca66247d-22c1-43b0-a8e5-5137b9352db6
begin
potential_dirs = [sparse_init_dir(hess)[1] for i = 1:100]
pd_projs = [el' * hess * el for el in potential_dirs] # ie how good is each guess
inds = sortperm(pd_projs) # sort in order
potential_dirs = potential_dirs[inds]
duplicates = [] # remove potential_directions that are approximately equal (norm(a-b) < 1e-5) to previous directions
for (i, el) in enumerate(potential_dirs)
for (j, comp) in enumerate(potential_dirs[i+1:end])
if ((norm(el - comp) < 1e-5) || (norm(el + comp) < 1e-5))
push!(duplicates, i + j)
end
end
end
potential_dirs[unique(duplicates)]
potential_dirs = potential_dirs[setdiff(1:length(potential_dirs), duplicates)]
end
# ╔═╡ ec0202da-79a6-413a-b6a8-35ae2238d319
md"""
Select here which of the potential directions you would like to use as your initial direction for the minimally disruptive curve:
$(@bind which_dir NumberField(0:length(potential_dirs), default=1))
(*Calculating a curve might take a minute or two*)
"""
# ╔═╡ 631845b0-4373-416a-baf5-88f61710fa63
md"""
### Annoying Pluto.jl issue:
In Pluto, **DO NOT** set the spans to cross zero, i.e. (a,b) where $a<0$ and $b > 0$. In normal Julia this is fine. Why? MinimallyDisruptiveCurves runs two separate curves $(-a, 0)$ and $(0, b)$ on separate threads before recombining them. For some reason, this multithreading hangs in Pluto, but not in the normal Julia REPL.
"""
# ╔═╡ f198d066-af54-4e30-8251-41d167baf732
"""
spans long enough to show the behaviour of interest in the nfkb model, without unnecessarily long (to spare computation time).
"""
function default_spans(which_dir)
# dspans = [(-10.0, 10.0), (-12., 15.), (-15., 20.), (-20., 3.), (-6., 6.)]
# dspans = [(-10.0, 0.0), (-12., 0.), (-15., 0.), (-20., 0.), (-6., 0.)]
dspans = [(0.0, 10.0), (0., 15.), (0., 20.), (0., 3.), (0., 6.)]
if which_dir < 6
return dspans[which_dir]
else
return (0., 10.)
end
end
# ╔═╡ 86342eda-6179-4ad9-b5ed-5047c9d3d194
default_momentum(which_dir) = 100.
# ╔═╡ ae43c4bf-5500-4b0b-8a0f-d45ba27b2ea1
begin
dp0 = potential_dirs[which_dir]
mom = default_momentum(which_dir)
span = default_spans(which_dir) # preset to show the interesting behaviour. but make your own range by all means
eprob = MDCProblem(cost, p0, dp0, mom, span)
cb = [
Verbose([CurveDistance(0.1:0.1:span[2])])
]
end
# ╔═╡ 833d73f9-b3f0-4df9-9df5-bb68f804db25
grad_hold = deepcopy(p0)
# ╔═╡ 11aa2458-7cd0-438d-9c31-4b1f4d930365
eprob
# ╔═╡ c4d36aba-2b47-4580-a42c-210b941c6a1b
mdc = evolve(eprob, Tsit5; mdc_callback = cb);
# ╔═╡ 94e632cf-db22-4dea-a478-84d4c8e39269
md"""
# Visualising the Minimally Disruptive Curve outputs
- You can generate the nth curve yourself by running the code above, and setting which_dir = n.
- Here you can see some visualisations of the curve.
- Note that in each curve, **all** parameters of the model are free to vary. I used the purely automatic initial direction selection given in the code above. So generation of the curves required no domain knowledge.
- However, I only graphed the 5 biggest changing parameters (over each curve), to avoid cluttering the figures.
- In general, domain knowledge might be used to infer free parameters and promising initial curve directions.
"""
# ╔═╡ dc5227f4-e289-4f6b-a1b7-2fe39e76b802
parameters(od)[biggest_movers(mdc,5)]
# ╔═╡ 2c8890ac-a0a1-47eb-8f70-1cde0dc57ab1
cc = [cost(el) for el in eachcol(trajectory(mdc))];
# ╔═╡ cd442c4a-0943-4265-a256-c73612455225
plot1= Plots.plot(mdc; idxs=biggest_movers(mdc,5), pnames = parameters(od) .|> repr, what = :trajectory, linewidth=4)
# ╔═╡ b0a33577-70d9-42ca-868f-f466a1f53690
plot2 = Plots.plot(distances(mdc), log.(cc), ylabel = "log(cost)", xlabel = "distance", title = "cost over MD curve", label="cost")
# ╔═╡ f1b8c5d8-746b-4da9-800a-a789c10cc8ea
plot3 = Plots.plot(mdc; idxs=biggest_movers(mdc,5), pnames = parameters(od), what = :final_changes)
# ╔═╡ 33552dd8-a5be-45b3-812c-687722474a6e
parameters(od)[biggest_movers(mdc,5)]
# ╔═╡ 4c9f0083-c74b-441b-8e9d-4f5a0b957d09
distances(mdc)
# ╔═╡ 50d2ff8a-30b5-4fa1-9be5-f9b34c95172d
md"""
Plot following distance along curve (distance = 0 is the starting set of parameters)
$(distances(mdc)[1])
$(@bind distance_along_curve Slider(distances(mdc)[1]:0.1:distances(mdc)[end]))
$(distances(mdc)[end])
"""
# ╔═╡ 36341a58-e903-4896-9839-73131bd3a960
function sol_along_curve(s)
pac = remake(prob, p=mdc(s)[:states])
solac = solve(pac, Tsit5())
end
# ╔═╡ f1771267-926a-4694-8732-bd6955a0fc1c
current_sol = sol_along_curve(distance_along_curve);
# ╔═╡ da0ba5fb-9502-41d1-bf2b-194884f5c9a3
plot(current_sol, title = "all states: curve distance is $distance_along_curve", linewidth=2)
# ╔═╡ 08fa1a58-f0f8-44f1-a9e1-9086e4fd419b
plot(current_sol.t, transpose(hcat(om.(current_sol.u)...)), legend = false, title = "outputs at curve distance $distance_along_curve")
# ╔═╡ 36af75cf-3360-4f2f-85f8-f514d46153fc
md"""
# Scientific analysis of MD curves
- Here, I've used .png copies of the curves I generated
- You can generate them yourself by selecting which_dir = (number of analysed curve) further up.
"""
# ╔═╡ 9abbb9e8-3af0-43bb-a933-64e48e3fb5f5
md"""
## Curve 1
$(PlutoUI.LocalResource("nfkb_pics/NFKB_mdc_1.png"))
"""
# ╔═╡ b1d2ae80-5f37-4320-a43d-b223086c8bba
md"""
#### Mathematical points
- The first MDC uncovers a structural unidentifiability in the model: model output is completely invariant to changes that preserve $log(k_2) + log(c_4)$, i.e. the product $k_2c_4$.
- 'Completely' is numerical, obviously, but cost < 1e-18 is pretty close to zero.
- An algebraic method of uncovering this particular unidentifiability, in the same model, is provided in:
**Villaverde, Alejandro F., Antonio Barreiro, and Antonis Papachristodoulou. "Structural identifiability of dynamic systems biology models." PLoS computational biology 12.10 (2016): e1005153.**
#### Interpretation
- Look at the reaction network diagram at the top of the notebook:
$c_4$ determines the transcription rate of $A20$, while $k_2$ determines the efficacy of $A20$ in encouraging the inactivation of $IKK$.
- So the MDC makes sense: halving production of A20, while doubling its effect on the reaction it takes part in, doesn't alter observed dynamics.
"""
# ╔═╡ d57ec864-db10-4a95-9313-7aa96b227997
md"""
## Curve 2
$(PlutoUI.LocalResource("nfkb_pics/NFKB_mdc_2.png"))
"""
# ╔═╡ 4df5d63e-7f23-4e5b-aac2-c561bd3e1cd8
md"""
#### Mathematically
- If we increase $k_2$, but decrease $c_1$ proportionally (ie preserving $k_2c_1$), nothing happens to model behaviour.
- If we decrease $k_2$ but increase $c_1$ proportionally in the same manner: initially dynamics are preserved, but eventually they start to get perturbed. Increases in $c_3$ and $c_4$, and a decrease in $a_3$, mitigate this.
#### Scientifically
- $c_1$ is the rate of production of $A20t$ (A20 transcript) from nuclear NFkB. There is also a constitutive production rate $c_2$.
- $k_2$ determines the efficacy of $A20$ in encouraging the inactivation of $IKK$.
So the curve shows that we can decrease the production rate of $A20$ transcript from $NFKBn$ indefinitely, as long as we correspondingly increase the efficacy of $A20$ in inactivating $A20$.
On the other hand, if we **increase** the production rate of $A20$ transcript, and correspondingly **decrease** the $A20$ efficacy, an effect on dynamics is eventually felt. This is compensated by
- Decreasing $a_3$, the rate of conglomeration of activated IKK (IKKa) with IkBaNFkB complex. IE reducing the reactive power of the IKKa, whose concentration is being increased by the larger amount of $A20$
- Increasing $c_4$ and $c_3$. The first **increases** the production rate of $A20$ from $A20t$. However the second **decreases** the amount of $A20t$ by increasing degradation rate.
"""
# ╔═╡ f9985bc1-1504-42af-8763-7abdbeb13445
md"""
## Curve 3
$(PlutoUI.LocalResource("nfkb_pics/NFKB_mdc_3.png"))
"""
# ╔═╡ fdf8e7c3-9fe0-4a40-88c5-eaed2ac41fe6
md"""
#### Interpretation
- If we increase $c1a$, and decrease $c4a$ proportionately, so that the product $log(c1a) + log(c4a)$ is preserved, there is almost no effect on dynamics.
- $c1a$ is the rate of production of IkBa transcript from NFkBn. $c4a$ is the translation rate of IkBa transcript. So this makes sense: more transcript, but less translation from the transcript, equals about the same amount of IkBa.
- However, this MD curve breaks down if we instead **increase** $c1a$ and decrease $c4a$ proportionately. So more transcript production, but less translation from the transcript. This is likely caused by the difference in time constants for the two reactions. Iti s compensated in this MD Curve by increasing $c3a$, the degradation rate of the transcript.
"""
# ╔═╡ 97977339-ce59-493a-a8d3-2c498f3a5639
md"""
## Curve 4
$(PlutoUI.LocalResource("nfkb_pics/NFKB_mdc_4.png"))
"""
# ╔═╡ ee0c5bc6-6279-44df-bce4-9959241f2a88
md"""
#### Interpretation
- $t1$ is the dissociation rate of $IKKa$ from the $IKKaIkBa$ complex. It's described as a fast timescale reaction in the original modelling paper.
- It can be slowed by 20 orders of magnitude without altering observed behaviour, apparently.
- It can also be increased indefinitely. However, if it increases too much, numerical problems hit the ODE solver, as you can see at the end of the curve. Probably this is because the dynamics become stiff, as the timescale of the $t1$ reaction is so fast relative to the rest of the system.
- I manually double-checked with a stiff ODE solver that increasing $t1$ further doesn't affect dynamics.
This suggests that you could assume instant equilibration of the $t1$ reaction to simplify the model, without affecting dynamics.
"""
# ╔═╡ 5db452e1-9d52-4da9-97d3-f0af0c4bcf6d
md"""
## Curve 5
$(PlutoUI.LocalResource("nfkb_pics/NFKB_mdc_5.png"))
"""
# ╔═╡ 7b21133c-dff8-43c1-8828-298a2c42ad79
md"""
#### Interpretation
- $e2a$ is the transport rate of IkBaNfKbn from the nucleus to the cytoplasm.
- $e2a$ is described as a fast timescale reaction in the original modelling paper. Increasing it further doesn't change dynamics.
- This suggests that you could assume instant equilibration of the $e2a$ reaction to simplify the model, without affecting dynamics.
- This suggests that intrinsic variability in this transport rate wouldn't affect functionality of the regulatory module.
"""
# ╔═╡ 00000000-0000-0000-0000-000000000001
PLUTO_PROJECT_TOML_CONTENTS = """
[deps]
Dierckx = "39dd38d3-220a-591b-8e3c-4c3a8c710a94"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MinimallyDisruptiveCurves = "c6328df5-4af8-4637-a9e9-78ed74a2ae2b"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
SciMLSensitivity = "1ed8b502-d754-442c-8d5d-10ac956f44a1"
[compat]
Dierckx = "~0.5.3"
ForwardDiff = "~0.10.35"
Ipopt = "~1.3.0"
JuMP = "~1.11.1"
MinimallyDisruptiveCurves = "~0.3.2"
ModelingToolkit = "~8.57.0"
OrdinaryDiffEq = "~6.52.0"
PlotlyJS = "~0.18.10"
Plots = "~1.38.14"
PlutoUI = "~0.7.51"
QuadGK = "~2.8.2"
SciMLSensitivity = "~7.32.0"
"""
# ╔═╡ 00000000-0000-0000-0000-000000000002
PLUTO_MANIFEST_TOML_CONTENTS = """
# This file is machine-generated - editing it directly is not advised
julia_version = "1.9.0"
manifest_format = "2.0"
project_hash = "0033c40a2dc700e87a7ff32db1140bb2646d2aea"
[[deps.ADTypes]]
git-tree-sha1 = "dcfdf328328f2645531c4ddebf841228aef74130"
uuid = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
version = "0.1.3"
[[deps.ASL_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "6252039f98492252f9e47c312c8ffda0e3b9e78d"
uuid = "ae81ac8f-d209-56e5-92de-9978fef736f9"
version = "0.1.3+0"
[[deps.AbstractAlgebra]]
deps = ["GroupsCore", "InteractiveUtils", "LinearAlgebra", "MacroTools", "Preferences", "Random", "RandomExtensions", "SparseArrays", "Test"]
git-tree-sha1 = "602749d9c19dda762e58a29ea548b720b78c8530"
uuid = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
version = "0.30.8"
[[deps.AbstractFFTs]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "16b6dbc4cf7caee4e1e75c49485ec67b667098a0"
uuid = "621f4979-c628-5d54-868e-fcf4e3e8185c"
version = "1.3.1"
weakdeps = ["ChainRulesCore"]
[deps.AbstractFFTs.extensions]
AbstractFFTsChainRulesCoreExt = "ChainRulesCore"
[[deps.AbstractPlutoDingetjes]]
deps = ["Pkg"]
git-tree-sha1 = "8eaf9f1b4921132a4cff3f36a1d9ba923b14a481"
uuid = "6e696c72-6542-2067-7265-42206c756150"
version = "1.1.4"
[[deps.AbstractTrees]]
git-tree-sha1 = "faa260e4cb5aba097a73fab382dd4b5819d8ec8c"
uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
version = "0.4.4"
[[deps.Adapt]]
deps = ["LinearAlgebra", "Requires"]
git-tree-sha1 = "76289dc51920fdc6e0013c872ba9551d54961c24"
uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
version = "3.6.2"
weakdeps = ["StaticArrays"]
[deps.Adapt.extensions]
AdaptStaticArraysExt = "StaticArrays"
[[deps.ArgCheck]]
git-tree-sha1 = "a3a402a35a2f7e0b87828ccabbd5ebfbebe356b4"
uuid = "dce04be8-c92d-5529-be00-80e4d2c0e197"
version = "2.3.0"
[[deps.ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
version = "1.1.1"
[[deps.ArnoldiMethod]]
deps = ["LinearAlgebra", "Random", "StaticArrays"]
git-tree-sha1 = "62e51b39331de8911e4a7ff6f5aaf38a5f4cc0ae"
uuid = "ec485272-7323-5ecc-a04f-4719b315124d"
version = "0.2.0"
[[deps.ArrayInterface]]
deps = ["Adapt", "LinearAlgebra", "Requires", "SparseArrays", "SuiteSparse"]
git-tree-sha1 = "d3f758863a47ceef2248d136657cb9c033603641"
uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
version = "7.4.8"
[deps.ArrayInterface.extensions]
ArrayInterfaceBandedMatricesExt = "BandedMatrices"
ArrayInterfaceBlockBandedMatricesExt = "BlockBandedMatrices"
ArrayInterfaceCUDAExt = "CUDA"
ArrayInterfaceGPUArraysCoreExt = "GPUArraysCore"
ArrayInterfaceStaticArraysCoreExt = "StaticArraysCore"
ArrayInterfaceTrackerExt = "Tracker"
[deps.ArrayInterface.weakdeps]
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
BlockBandedMatrices = "ffab5731-97b5-5995-9138-79e8c1846df0"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527"
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
[[deps.ArrayInterfaceCore]]
deps = ["LinearAlgebra", "SnoopPrecompile", "SparseArrays", "SuiteSparse"]
git-tree-sha1 = "e5f08b5689b1aad068e01751889f2f615c7db36d"
uuid = "30b0a656-2188-435a-8636-2ec0e6a096e2"
version = "0.1.29"
[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
[[deps.AssetRegistry]]
deps = ["Distributed", "JSON", "Pidfile", "SHA", "Test"]
git-tree-sha1 = "b25e88db7944f98789130d7b503276bc34bc098e"
uuid = "bf4720bc-e11a-5d0c-854e-bdca1663c893"
version = "0.1.0"
[[deps.Atomix]]
deps = ["UnsafeAtomics"]
git-tree-sha1 = "c06a868224ecba914baa6942988e2f2aade419be"
uuid = "a9b6321e-bd34-4604-b9c9-b65b8de01458"
version = "0.1.0"
[[deps.BangBang]]
deps = ["Compat", "ConstructionBase", "InitialValues", "LinearAlgebra", "Requires", "Setfield", "Tables"]
git-tree-sha1 = "54b00d1b93791f8e19e31584bd30f2cb6004614b"
uuid = "198e06fe-97b7-11e9-32a5-e1d131e6ad66"
version = "0.3.38"
[deps.BangBang.extensions]
BangBangChainRulesCoreExt = "ChainRulesCore"
BangBangDataFramesExt = "DataFrames"
BangBangStaticArraysExt = "StaticArrays"
BangBangStructArraysExt = "StructArrays"
BangBangTypedTablesExt = "TypedTables"
[deps.BangBang.weakdeps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
TypedTables = "9d95f2ec-7b3d-5a63-8d20-e2491e220bb9"
[[deps.Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
[[deps.Baselet]]
git-tree-sha1 = "aebf55e6d7795e02ca500a689d326ac979aaf89e"
uuid = "9718e550-a3fa-408a-8086-8db961cd8217"
version = "0.1.1"
[[deps.BenchmarkTools]]
deps = ["JSON", "Logging", "Printf", "Profile", "Statistics", "UUIDs"]
git-tree-sha1 = "d9a9701b899b30332bbcb3e1679c41cce81fb0e8"
uuid = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
version = "1.3.2"
[[deps.Bijections]]
git-tree-sha1 = "fe4f8c5ee7f76f2198d5c2a06d3961c249cce7bd"
uuid = "e2ed5e7c-b2de-5872-ae92-c73ca462fb04"
version = "0.1.4"
[[deps.BitFlags]]
git-tree-sha1 = "43b1a4a8f797c1cddadf60499a8a077d4af2cd2d"
uuid = "d1d4a3ce-64b1-5f1a-9ba4-7e7e69966f35"
version = "0.1.7"
[[deps.BitTwiddlingConvenienceFunctions]]
deps = ["Static"]
git-tree-sha1 = "0c5f81f47bbbcf4aea7b2959135713459170798b"
uuid = "62783981-4cbd-42fc-bca8-16325de8dc4b"
version = "0.1.5"
[[deps.Blink]]
deps = ["Base64", "Distributed", "HTTP", "JSExpr", "JSON", "Lazy", "Logging", "MacroTools", "Mustache", "Mux", "Pkg", "Reexport", "Sockets", "WebIO"]
git-tree-sha1 = "f3f568766c0e3646501d257b039dd48f18aba887"
uuid = "ad839575-38b3-5650-b840-f874b8c74a25"
version = "0.12.7"
[[deps.Bzip2_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "19a35467a82e236ff51bc17a3a44b69ef35185a2"
uuid = "6e34b625-4abd-537c-b88f-471c36dfa7a0"
version = "1.0.8+0"
[[deps.CEnum]]
git-tree-sha1 = "eb4cb44a499229b3b8426dcfb5dd85333951ff90"
uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82"
version = "0.4.2"
[[deps.CPUSummary]]
deps = ["CpuId", "IfElse", "PrecompileTools", "Static"]
git-tree-sha1 = "89e0654ed8c7aebad6d5ad235d6242c2d737a928"
uuid = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9"
version = "0.2.3"
[[deps.CSTParser]]
deps = ["Tokenize"]
git-tree-sha1 = "3ddd48d200eb8ddf9cb3e0189fc059fd49b97c1f"
uuid = "00ebfdb7-1f24-5e51-bd34-a7502290713f"
version = "3.3.6"
[[deps.Cairo_jll]]
deps = ["Artifacts", "Bzip2_jll", "CompilerSupportLibraries_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "JLLWrappers", "LZO_jll", "Libdl", "Pixman_jll", "Pkg", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Zlib_jll", "libpng_jll"]
git-tree-sha1 = "4b859a208b2397a7a623a03449e4636bdb17bcf2"
uuid = "83423d85-b0ee-5818-9007-b63ccbeb887a"
version = "1.16.1+1"
[[deps.Calculus]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "f641eb0a4f00c343bbc32346e1217b86f3ce9dad"
uuid = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
version = "0.5.1"
[[deps.Cassette]]
git-tree-sha1 = "a70f220ea09ec61401745ff338f8fb340420165c"
uuid = "7057c7e9-c182-5462-911a-8362d720325c"
version = "0.3.11"
[[deps.ChainRules]]
deps = ["Adapt", "ChainRulesCore", "Compat", "Distributed", "GPUArraysCore", "IrrationalConstants", "LinearAlgebra", "Random", "RealDot", "SparseArrays", "Statistics", "StructArrays"]
git-tree-sha1 = "8bae903893aeeb429cf732cf1888490b93ecf265"
uuid = "082447d4-558c-5d27-93f4-14fc19e9eca2"
version = "1.49.0"
[[deps.ChainRulesCore]]
deps = ["Compat", "LinearAlgebra", "SparseArrays"]
git-tree-sha1 = "e30f2f4e20f7f186dc36529910beaedc60cfa644"
uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
version = "1.16.0"
[[deps.CloseOpenIntervals]]
deps = ["Static", "StaticArrayInterface"]
git-tree-sha1 = "70232f82ffaab9dc52585e0dd043b5e0c6b714f1"
uuid = "fb6a15b2-703c-40df-9091-08a04967cfa9"
version = "0.1.12"
[[deps.CodecBzip2]]
deps = ["Bzip2_jll", "Libdl", "TranscodingStreams"]
git-tree-sha1 = "2e62a725210ce3c3c2e1a3080190e7ca491f18d7"
uuid = "523fee87-0ab8-5b00-afb7-3ecf72e48cfd"
version = "0.7.2"
[[deps.CodecZlib]]
deps = ["TranscodingStreams", "Zlib_jll"]
git-tree-sha1 = "9c209fb7536406834aa938fb149964b985de6c83"
uuid = "944b1d66-785c-5afd-91f1-9de20f533193"
version = "0.7.1"
[[deps.ColorSchemes]]
deps = ["ColorTypes", "ColorVectorSpace", "Colors", "FixedPointNumbers", "PrecompileTools", "Random"]
git-tree-sha1 = "be6ab11021cd29f0344d5c4357b163af05a48cba"
uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
version = "3.21.0"
[[deps.ColorTypes]]
deps = ["FixedPointNumbers", "Random"]
git-tree-sha1 = "eb7f0f8307f71fac7c606984ea5fb2817275d6e4"
uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
version = "0.11.4"
[[deps.ColorVectorSpace]]
deps = ["ColorTypes", "FixedPointNumbers", "LinearAlgebra", "SpecialFunctions", "Statistics", "TensorCore"]
git-tree-sha1 = "600cc5508d66b78aae350f7accdb58763ac18589"
uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4"
version = "0.9.10"
[[deps.Colors]]
deps = ["ColorTypes", "FixedPointNumbers", "Reexport"]
git-tree-sha1 = "fc08e5930ee9a4e03f84bfb5211cb54e7769758a"
uuid = "5ae59095-9a9b-59fe-a467-6f913c188581"
version = "0.12.10"
[[deps.Combinatorics]]
git-tree-sha1 = "08c8b6831dc00bfea825826be0bc8336fc369860"
uuid = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
version = "1.0.2"
[[deps.CommonMark]]
deps = ["Crayons", "JSON", "PrecompileTools", "URIs"]
git-tree-sha1 = "532c4185d3c9037c0237546d817858b23cf9e071"
uuid = "a80b9123-70ca-4bc0-993e-6e3bcb318db6"
version = "0.8.12"
[[deps.CommonSolve]]
git-tree-sha1 = "9441451ee712d1aec22edad62db1a9af3dc8d852"
uuid = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2"
version = "0.2.3"
[[deps.CommonSubexpressions]]
deps = ["MacroTools", "Test"]
git-tree-sha1 = "7b8a93dba8af7e3b42fecabf646260105ac373f7"
uuid = "bbf7d656-a473-5ed7-a52c-81e309532950"
version = "0.3.0"
[[deps.Compat]]
deps = ["UUIDs"]
git-tree-sha1 = "7a60c856b9fa189eb34f5f8a6f6b5529b7942957"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "4.6.1"
weakdeps = ["Dates", "LinearAlgebra"]
[deps.Compat.extensions]
CompatLinearAlgebraExt = "LinearAlgebra"
[[deps.CompilerSupportLibraries_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
version = "1.0.2+0"
[[deps.CompositeTypes]]
git-tree-sha1 = "02d2316b7ffceff992f3096ae48c7829a8aa0638"
uuid = "b152e2b5-7a66-4b01-a709-34e65c35f657"
version = "0.1.3"
[[deps.CompositionsBase]]
git-tree-sha1 = "802bb88cd69dfd1509f6670416bd4434015693ad"
uuid = "a33af91c-f02d-484b-be07-31d278c5ca2b"
version = "0.1.2"
[deps.CompositionsBase.extensions]
CompositionsBaseInverseFunctionsExt = "InverseFunctions"
[deps.CompositionsBase.weakdeps]
InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112"
[[deps.ConcurrentUtilities]]
deps = ["Serialization", "Sockets"]
git-tree-sha1 = "96d823b94ba8d187a6d8f0826e731195a74b90e9"
uuid = "f0e56b4a-5159-44fe-b623-3e5288b988bb"
version = "2.2.0"
[[deps.ConstructionBase]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "738fec4d684a9a6ee9598a8bfee305b26831f28c"
uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
version = "1.5.2"
weakdeps = ["IntervalSets", "StaticArrays"]
[deps.ConstructionBase.extensions]
ConstructionBaseIntervalSetsExt = "IntervalSets"
ConstructionBaseStaticArraysExt = "StaticArrays"
[[deps.Contour]]
git-tree-sha1 = "d05d9e7b7aedff4e5b51a029dced05cfb6125781"
uuid = "d38c429a-6771-53c6-b99e-75d170b6e991"
version = "0.6.2"
[[deps.CpuId]]
deps = ["Markdown"]
git-tree-sha1 = "fcbb72b032692610bfbdb15018ac16a36cf2e406"
uuid = "adafc99b-e345-5852-983c-f28acb93d879"
version = "0.3.1"
[[deps.Crayons]]
git-tree-sha1 = "249fe38abf76d48563e2f4556bebd215aa317e15"
uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f"
version = "4.1.1"
[[deps.DataAPI]]
git-tree-sha1 = "8da84edb865b0b5b0100c0666a9bc9a0b71c553c"
uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
version = "1.15.0"
[[deps.DataStructures]]
deps = ["Compat", "InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "d1fff3a548102f48987a52a2e0d114fa97d730f0"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.18.13"
[[deps.DataValueInterfaces]]
git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6"
uuid = "e2d170a0-9d28-54be-80f0-106bbe20a464"
version = "1.0.0"
[[deps.Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
[[deps.DefineSingletons]]
git-tree-sha1 = "0fba8b706d0178b4dc7fd44a96a92382c9065c2c"
uuid = "244e2a9f-e319-4986-a169-4d1fe445cd52"
version = "0.1.2"
[[deps.DelimitedFiles]]
deps = ["Mmap"]
git-tree-sha1 = "9e2f36d3c96a820c678f2f1f1782582fcf685bae"
uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab"
version = "1.9.1"
[[deps.Dierckx]]
deps = ["Dierckx_jll"]
git-tree-sha1 = "d1ea9f433781bb6ff504f7d3cb70c4782c504a3a"
uuid = "39dd38d3-220a-591b-8e3c-4c3a8c710a94"
version = "0.5.3"
[[deps.Dierckx_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "6596b96fe1caff3db36415eeb6e9d3b50bfe40ee"
uuid = "cd4c43a9-7502-52ba-aa6d-59fb2a88580b"
version = "0.1.0+0"
[[deps.DiffEqBase]]
deps = ["ArrayInterface", "ChainRulesCore", "DataStructures", "DocStringExtensions", "EnumX", "FastBroadcast", "ForwardDiff", "FunctionWrappers", "FunctionWrappersWrappers", "LinearAlgebra", "Logging", "Markdown", "MuladdMacro", "Parameters", "PreallocationTools", "Printf", "RecursiveArrayTools", "Reexport", "Requires", "SciMLBase", "SciMLOperators", "Setfield", "SparseArrays", "Static", "StaticArraysCore", "Statistics", "Tricks", "TruncatedStacktraces", "ZygoteRules"]
git-tree-sha1 = "1c03e389a28be70cd9049f98ff0b84cf7539d959"
uuid = "2b5f629d-d688-5b77-993f-72d75c75574e"
version = "6.125.0"
[deps.DiffEqBase.extensions]
DiffEqBaseDistributionsExt = "Distributions"
DiffEqBaseGeneralizedGeneratedExt = "GeneralizedGenerated"
DiffEqBaseMPIExt = "MPI"
DiffEqBaseMeasurementsExt = "Measurements"
DiffEqBaseMonteCarloMeasurementsExt = "MonteCarloMeasurements"
DiffEqBaseReverseDiffExt = "ReverseDiff"
DiffEqBaseTrackerExt = "Tracker"
DiffEqBaseUnitfulExt = "Unitful"
DiffEqBaseZygoteExt = "Zygote"
[deps.DiffEqBase.weakdeps]
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
GeneralizedGenerated = "6b9d7cbe-bcb9-11e9-073f-15a7a543e2eb"
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
[[deps.DiffEqCallbacks]]
deps = ["DataStructures", "DiffEqBase", "ForwardDiff", "LinearAlgebra", "Markdown", "NLsolve", "Parameters", "RecipesBase", "RecursiveArrayTools", "SciMLBase", "StaticArraysCore"]
git-tree-sha1 = "63b6be7b396ad395825f3cc48c56b53bfaf7e69d"
uuid = "459566f4-90b8-5000-8ac3-15dfb0a30def"
version = "2.26.1"
[[deps.DiffEqNoiseProcess]]
deps = ["DiffEqBase", "Distributions", "GPUArraysCore", "LinearAlgebra", "Markdown", "Optim", "PoissonRandom", "QuadGK", "Random", "Random123", "RandomNumbers", "RecipesBase", "RecursiveArrayTools", "Requires", "ResettableStacks", "SciMLBase", "StaticArrays", "Statistics"]
git-tree-sha1 = "2c4ed3eedb87579bfe9f20ecc2440de06b9f3b89"
uuid = "77a26b50-5914-5dd7-bc55-306e6241c503"
version = "5.16.0"
weakdeps = ["ReverseDiff"]
[deps.DiffEqNoiseProcess.extensions]
DiffEqNoiseProcessReverseDiffExt = "ReverseDiff"
[[deps.DiffResults]]
deps = ["StaticArraysCore"]
git-tree-sha1 = "782dd5f4561f5d267313f23853baaaa4c52ea621"
uuid = "163ba53b-c6d8-5494-b064-1a9d43ac40c5"
version = "1.1.0"
[[deps.DiffRules]]
deps = ["IrrationalConstants", "LogExpFunctions", "NaNMath", "Random", "SpecialFunctions"]
git-tree-sha1 = "a4ad7ef19d2cdc2eff57abbbe68032b1cd0bd8f8"
uuid = "b552c78f-8df3-52c6-915a-8e097449b14b"
version = "1.13.0"
[[deps.Distances]]