Usage

Chemostats.jl simulates individual cells in a Chemostat object.

Chemostats

Chemostats.ChemostatType
struct Chemostat{C,P}
    pop::Vector{C}
    p::P
    snaps::Vector{Snapshot}
end

Chemostat object. The field pop contains the current population of cells. The field p can be a user-defined parameter object (defaults to nothing). snaps contains a list of Snapshots saved at different times.

source
Chemostats.simulate!Function
simulate!(chem, tmax, alg, ensalg = EnsembleThreads(); saveat = [])

Simulates the chemostat until time tmax with algorithm alg (see Simulation Algorithms for a list of algorithms). ensalg can be EnsembleSerial() for single-threaded simulations, or EnsembleThreads() for multithreading (if alg support multithreading). The default ensalg is EnsembleThreads() for multithreaded algorithms, or EnsembleSerial() for single-threaded algorithms.

source
Chemostats.get_snapshotFunction
get_snapshot(chem::Chemostat, t = chem.t)
get_snapshot(snaps::AbstractVector{Snapshot}, t = snaps[end].t)

Searches and returns for a population snapshot saved at time t. Errors if no snapshots are found. If multiple snapshots at time t exist, this function returns the last one.

source

Estimating population sizes

Chemostats.SnapshotType
struct Snapshot
    t::Float64
    N::Int 
    nsim::Int
    log_f::Float64
end

Saves the state of a simulate dpopulation at a fixed time t. Here N is the observed size of the population, and log_f is minus the log fraction of the true population observed. This allows us to use subsampling algorithms (see Simulation Algorithms) that only track a small subset of a full population and extrapolate.

The true population size can be estimated using est_logN or est_N. The field nsim counts the number of cells simulated until the current snapshot (including partially simulated and removed cells).

source
Chemostats.est_ΛFunction
est_Λ(snap1::Snapshot, snap2::Snapshot)

Estimates the growth rates from two snapshots at times $t_1$ and $t_2$ via

$\hat \Lambda(t_1, t_2) = \frac{\log \hat N(t_2) - \log \hat N(t_1)}{t_2 - t_1}$

Here $\hat N(t_1)$ and $\hat N(t_2)$ are estimated via est_N.

source
est_Λ(snaps::AbstractVector{Snapshot}, t1 = 0., t2)

Estimates the growth rate of a population between times t1 and t2 by combining get_snapshot and est_Λ. snaps can alternatively be a Chemostat instance.

source
Chemostats.est_logNFunction
est_logN(snap::Snapshot)

Estimates the true log-population size from a snapshot.

source
est_logN(snaps::AbstractVector{Snapshot}, t)

Estimates the log-size of a population at time t by combining get_snapshot and est_logN. snaps can alternatively be a Chemostat instance.

source

The Cell API

Cells in Chemostat.jl can be of an user-defined type that implements the following functions. For models defined using DifferentialEquations.jl, the DECell class provides a direct wrapper.

(Mention step!)

Chemostats.kill!Function
kill!(cell, t)

Called when a cell is killed by the simulation algorithm. The argument t is the time at which a cell is killed. After this call, Chemostats.get_state should return Killed.

source
Chemostats.get_offspringFunction
get_offspring(chem, cell; save_lineages=false)

Returns an array of cells representing the offspring of the given cell. Here chem is the surrounding chemostat. If save_lineages is true, the resulting offspring should keep track of the parent cell.

source
Chemostats.CellStateModule
@enumx CellState

The current state of a cell as returned by Chemostats.get_state.

  • Newborn: Newborn cell that has not been simulated yet.
  • Alive: Cell that is currently being simulated, but has not reached its end of life.
  • EndOfLive: Cell that has reached its end of life, before its offspring are determined.
  • Dead: Cell that has died, leaving no offspring.
  • Divided: Cell that has divided into daughter cells.
  • Killed: Cell that has been killed (e.g. removed), by the Simulation Algorithm.
source