Skip to content
Snippets Groups Projects
Commit b4521042 authored by Bentriou Mahmoud's avatar Bentriou Mahmoud
Browse files

Implementation of the macro @biochemical_network. It gives an easy way

to define CTMC with the biochemical network.
parent 48a39408
No related branches found
No related tags found
No related merge requests found
......@@ -40,11 +40,15 @@ export load_model, load_automaton, load_plots
# Algorithms
export automaton_abc, abc_smc
# About biochemical networks
export @biochemical_network
include("common.jl")
include("trajectory.jl")
include("lha.jl")
include("model.jl")
include("utils.jl")
include("biochemical_network.jl")
include("../algorithms/abc_smc.jl")
end
......
......@@ -14,13 +14,13 @@ function ER_f!(xnplus1::Vector{Int}, l_t::Vector{Float64}, l_tr::Vector{Union{No
a1 = p[1] * xn[1] * xn[2]
a2 = p[2] * xn[3]
a3 = p[3] * xn[3]
l_a = SVector(a1, a2, a3)
l_a = (a1, a2, a3)
asum = sum(l_a)
nu_1 = SVector(-1, -1, 1, 0)
nu_2 = SVector(1, 1, -1, 0)
nu_3 = SVector(1, 0, -1, 1)
l_nu = SVector(nu_1, nu_2, nu_3)
l_str_R = SVector("R1", "R2", "R3")
nu_1 = (-1, -1, 1, 0)
nu_2 = (1, 1, -1, 0)
nu_3 = (1, 0, -1, 1)
l_nu = (nu_1, nu_2, nu_3)
l_str_R = ("R1", "R2", "R3")
u1 = rand()
u2 = rand()
......
......@@ -13,13 +13,13 @@ function SIR_f!(xnplus1::Vector{Int}, l_t::Vector{Float64}, l_tr::Vector{Union{N
xn::Vector{Int}, tn::Float64, p::Vector{Float64})
a1 = p[1] * xn[1] * xn[2]
a2 = p[2] * xn[2]
l_a = SVector(a1, a2)
l_a = (a1, a2)
asum = sum(l_a)
# column-major order
nu_1 = SVector(-1, 1, 0)
nu_2 = SVector(0, -1, 1)
l_nu = SVector(nu_1, nu_2)
l_str_R = SVector("R1","R2")
nu_1 = (-1, 1, 0)
nu_2 = (0, -1, 1)
l_nu = (nu_1, nu_2)
l_str_R = ("R1","R2")
u1 = rand()
u2 = rand()
......
......@@ -26,6 +26,7 @@ using Test
@test include("unit/load_module.jl")
@test include("unit/long_sim_er.jl")
@test include("unit/macro_biochemical_network.jl")
@test include("unit/model_prior.jl")
@test include("unit/models_exps_er_1d.jl")
@test include("unit/observe_all.jl")
......
using MarkovProcesses
model_SIR = @biochemical_network "SIR" begin
R1: (S+I => 2I, ki*S*I)
R2: (I => R, kr*I)
end
set_x0!(model_SIR, [95,5,0])
set_param!(model_SIR, [0.012, 0.05])
model_ER = @biochemical_network "ER" begin
R1: (E+S => ES, k1*E*S)
R2: (ES => E+S, k2*ES)
R3: (ES => E+P, k3*ES)
end
set_x0!(model_ER, [100,100,0,0])
set_param!(model_ER, [1.0,1.0,1.0])
return true
#=
@biochemical_network "test1" begin
R1: (S+I => 2I+Z, ki*S*I)
R2: (I => R, kr*I)
end
@biochemical_network "test2" begin
R1: (S+I => 2I, ki*S*I)
R2: (I => R, kr*I)
end
@biochemical_network "test3" begin
R1: (S+I => I, ki)
R2: (2I => R, kr*I*c)
end
=#
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment