This seems to be related to superinfection. Here is a small reproducing example:
Parameters:
simTime: 10.0 # simulation time units before most recent sample date
lambda: 1e-3 # birth rate (susceptibles only)
mu: 5e-4 # baseline death rate
mu2: 0.01 # infected death rate
beta: 1e-4 # transmission rate
gamma: 0.1 # clearance rate
psi: 0.05 # sampling rate
omega: 0.01 # loss of immunity
Compartments:
S:
infected: false
transmission:
I: {I: beta*S*I} # S becomes I due to infection by member of I
size: 9999 # initial
I:
infected: true
migration:
I_samp: psi*I
transmission:
I: {I: beta*I*I} # superinfection
size: 1
bottleneck.size: 1
coalescent.rate: 1.0
I_samp:
infected: true
size: 0
Sampling:
mode: compartment
targets:
I_samp: 10
> setwd("~/git/twt")
> require(twt)
> settings <- read_yaml("iss172.yaml")
> mod <- Model$new(settings)
> set.seed(32)
> dyn <- sim.dynamics(mod)
> outer <- sim.outer.tree(dyn)
> inner <- sim.inner.tree(outer)
Error in recipient$count.pathogens() : attempt to apply non-function
In addition: Warning message:
In active$get.host.by.name(e$to.host) :
HostSet does not contain Host US_I_8
This seems to be related to superinfection. Here is a small reproducing example: