-
Notifications
You must be signed in to change notification settings - Fork 3
/
toy_pharma_model.jl
93 lines (74 loc) · 2.81 KB
/
toy_pharma_model.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
using ReactiveDynamics
# model dynamics
toy_pharma_model = @ReactionNetwork begin
α(candidate_compound, marketed_drug, κ),
3 * @conserved(scientist) + @rate(budget) --> candidate_compound,
name => discovery,
probability => 0.3,
cycletime => 10.0,
priority => 0.5
β(candidate_compound, marketed_drug),
candidate_compound + 5 * @conserved(scientist) + 2 * @rate(budget) -->
marketed_drug + 5 * budget,
name => dx2market,
probability => 0.5 + 0.001 * @t(),
cycletime => 4
γ * marketed_drug, marketed_drug --> ∅, name => drug_killed
end
@periodic toy_pharma_model 1.0 budget += 11 * marketed_drug
@register function α(number_candidate_compounds, number_marketed_drugs, κ)
return κ + exp(-number_candidate_compounds) + exp(-number_marketed_drugs)
end
@register function β(number_candidate_compounds, number_marketed_drugs)
return number_candidate_compounds + exp(-number_marketed_drugs)
end
# simulation parameters
## initial values
@prob_init toy_pharma_model candidate_compound = 5 marketed_drug = 6 scientist = 20 budget =
100
## parameters
@prob_params toy_pharma_model κ = 4 γ = 0.1
## other arguments passed to the solver
@prob_meta toy_pharma_model tspan = 250 dt = 0.1
prob = @problematize toy_pharma_model
sol = @solve prob trajectories = 20
using Plots
@plot sol plot_type = summary
@plot sol plot_type = summary show = :marketed_drug
## for deterministic rates
# model dynamics
toy_pharma_model = @ReactionNetwork begin
@per_step(α(candidate_compound, marketed_drug, κ)),
3 * @conserved(scientist) + @rate(budget) --> candidate_compound,
name => discovery,
probability => 0.3,
cycletime => 10.0,
priority => 0.5
@per_step(β(candidate_compound, marketed_drug)),
candidate_compound + 5 * @conserved(scientist) + 2 * @rate(budget) -->
marketed_drug + 5 * budget,
name => dx2market,
probability => 0.5 + 0.001 * @t(),
cycletime => 4
@per_step(γ * marketed_drug), marketed_drug --> ∅, name => drug_killed
end
@periodic toy_pharma_model 0.0 budget += 11 * marketed_drug
@register function α(number_candidate_compounds, number_marketed_drugs, κ)
return κ + exp(-number_candidate_compounds) + exp(-number_marketed_drugs)
end
@register function β(number_candidate_compounds, number_marketed_drugs)
return number_candidate_compounds + exp(-number_marketed_drugs)
end
# simulation parameters
## initial values
@prob_init toy_pharma_model candidate_compound = 5 marketed_drug = 6 scientist = 20 budget =
100
## parameters
@prob_params toy_pharma_model κ = 4 γ = 0.1
## other arguments passed to the solver
@prob_meta toy_pharma_model tspan = 250
prob = @problematize toy_pharma_model
sol = @solve prob trajectories = 20
using Plots
@plot sol plot_type = summary
@plot sol plot_type = summary show = :marketed_drug