Main API
DelaySSAToolkit.DelayJumpSet
— Typemutable struct DelayJumpSet{T1, T2, T3<:Function}
A delay jump set that consists of five inputs, namely delay_trigger
, delay_interrupt
, delay_complete
, delay_trigger_set
and delay_interrupt_set
. One only need to specify the first three inputs and the rest two can be automatically generated.
Fields
delay_trigger
: reactions in the Markovian part that trigger the change of the state of the delay channels or/and the state of the reactants upon initiation.delay_complete
: reactions in the Markovian part that change the state of the delay channels or/and the state of the reactants in the middle of on-going delay reactions.delay_interrupt
: reactions that are initiated by delay trigger reactions and change the state of the delay channels or/and the state of the reactants upon completion.delay_trigger_set
: collection of indices of reactions that can interrupt the delay reactions. ofdelay_trigger
.delay_interrupt_set
: collection of indices ofdelay_interrupt
.
Notes
delay_trigger::Dict{Int,T}
: reactions in the Markovian part that trigger the change of the state of the delay channels or/and the state of the reactants upon initiation.- Keys: Indices of reactions defined in the Markovian part that can trigger the delay reactions;
- Values: value type
T
can be eitherFunction
: a function that decides how to update the delay channel and/or the state of the reactants. For example, one can define
which means adding a random number (with a given random seeddelay_trigger_affect! = function(integrator, rng) append!(integrator.de_chan[1], rand(rng)) integrator.u[2] +=1 end
rng
) in (0,1) to the first delay channel, and adding 1 individual to the second species.Vector{Pair{Int,T2}}
where T2<:Union{Real, Vector{Real}} a pair type is a simplified update function for only changing the delay channel (which will render better performance). For example, settingdelay_trigger_affect! = [1=>τ]
is equivalent todelay_trigger_affect! = function(integrator, rng) append!(integrator.de_chan[1], τ) end
delay_interrupt::Dict{Int,Function}
: reactions in the Markovian part that change the state of the delay channels or/and the state of the reactants in the middle of on-going delay reactions.- Keys: Indices of reactions defined in the Markovian part that can interrupt the delay reactions;
- Values: value type
T
can be an update function ofFunction
type that decides how to update the delay channel or the state of the reactants.
delay_complete::Dict{Int,T}
: reactions that are initiated by delay trigger reactions and change the state of the delay channels or/and the state of the reactants upon completion.- Keys: Indices of the delay channel;
- Values: value type
T
can be either an update function ofFunction
type or aVector{Pair{Int,Int}}
type that decides how to update the delay channel or the state of the reactants upon completion
delay_trigger_set::Vector{Int}
: collection of indices of reactions that can trigger the delay reaction.delay_interrupt_set::Vector{Int}
: collection of indices of reactions that can interrupt the delay reactions.
We take this model for example.
# Take the following example
# C: 0 --> X_A
# γ: X_A --> 0
# β: X_A --> X_I, which triggers X_I ==> 0 after time τ
# γ: X_I -->0
# the 3rd reaction will trigger a delay reaction
delay_trigger_affect! = function (integrator, rng)
append!(integrator.de_chan[1], τ)
end
# this is equivalent to
# delay_trigger = Dict(3=>[1=>τ])
delay_trigger = Dict(3=>delay_trigger_affect!)
# the 1st delay reaction will cause the 2nd species of molecule to degrade
delay_complete = Dict(1=>[2=>-1])
# the 4th reaction will interrupt the delay reactions
delay_interrupt_affect! = function (integrator, rng)
i = rand(rng, 1:length(integrator.de_chan[1]))
deleteat!(integrator.de_chan[1],i)
end
delay_interrupt = Dict(4=>delay_interrupt_affect!)
delaysets = DelayJumpSet(delay_trigger,delay_complete,delay_interrupt)
DelaySSAToolkit.DelayJumpProblem
— Typefunction DelayJumpProblem(prob::DiscreteProblem, aggregator::AbstractDelayAggregatorAlgorithm, jumps::JumpSet, delayjumpset::DelayJumpSet, de_chan0)
Fields
prob::DiscreteProblem
A discrete problem defined by the initial values.
aggregator::AbstractDelayAggregatorAlgorithm
A given algorithm to solve the DelaySSA problem.
jumps::JumpSet
A jumpset containing the information of Markovian part.
delayjumpset::DelayJumpSet
A delay jumpset containing the information of Non-Markovian part.
de_chan0::Vector{Vector{T}}
The initial condition of the delay channel.
function DelayJumpProblem(js::JumpSystem, prob, aggregator, delayjumpset, de_chan0; kwargs...)
Fields
js::JumpSystem
A jump system containing the information of Markovian part, defined by
Catalyst
.prob::DiscreteProblem
A discrete problem defined by the initial values.
aggregator::AbstractDelayAggregatorAlgorithm
A given algorithm to solve the DelaySSA problem.
delayjumpset::DelayJumpSet
A delay jumpset containing the information of Non-Markovian part.
de_chan0::Vector{Vector{T}}
The initial condition of the delay channel.
Types and Algorithms
DelaySSAToolkit.AbstractDelayAggregatorAlgorithm
— Typeabstract type AbstractDelayAggregatorAlgorithm
An abstract type that contains delay stochastic simulation algorithms:
- DelayDirect
- DelayRejection
- DelayMNRM
- DelayDirectCR
- DelayCoevolve
DelaySSAToolkit.DelayDirect
— Typestruct DelayDirect <: DelaySSAToolkit.AbstractDelayAggregatorAlgorithm
Delay Direct Method from Xiaodong Cai, "Exact stochastic simulation of coupled chemical reactions with delays", The Journal of Chemical Physics 126, 124108(2007).
DelaySSAToolkit.DelayRejection
— Typestruct DelayRejection <: DelaySSAToolkit.AbstractDelayAggregatorAlgorithm
Delay Rejection Method from Barrio, Manuel, Kevin Burrage, André Leier, and Tianhai Tian. "Oscillatory regulation of Hes1: discrete stochastic delay modelling and simulation." PLoS computational biology 2, no. 9 (2006): e117..
DelaySSAToolkit.DelayMNRM
— Typestruct DelayMNRM <: DelaySSAToolkit.AbstractDelayAggregatorAlgorithm
A modifed version of the Delay Next Reaction Method from David F. Anderson, "A modified Next Reaction Method for simulating chemical systems with time dependent propensities and delays", The Journal of Chemical Physics 128, 109903(2008).
DelaySSAToolkit.DelayDirectCR
— Typestruct DelayDirectCR <: DelaySSAToolkit.AbstractDelayAggregatorAlgorithm
A modifed Composition-Rejection Direct Method with delays (DelayDirectCR), implementation combining features from the original article and from the code in JumpProcesses
package: DirectCR : A constant-time kinetic Monte Carlo algorithm for simulation of large biochemical reaction networks, by A. Slepoy, A.P. Thompson and S.J. Plimpton, J. Chem. Phys, 128, 205101 (2008). and Efficient Formulations for Exact Stochastic Simulation of Chemical Systems, by S. Mauch and M. Stalzer, ACM Trans. Comp. Biol. and Bioinf., 8, No. 1, 27-35 (2010).