-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sim.inner.tree() modifies its input #119
Comments
I couldn't reproduce this issue because a different exception gets thrown: > settings <- yaml.load_file('~/git/twt/working/issue119.yaml')
> model <- Model$new(settings)
Error in FUN(X[[i]], ...) :
ID7316 of Lineage 16 is not a specified Compartment object.
Available compartments:
ID18_1ID277_1ID165_1ID221_1ID190_1ID105_1ID188_1ID406_1ID192_1ID97_1ID207_1ID399_1ID56_1ID57_1ID218_1ID228_1ID335_1ID149_1ID235_1ID281_1ID288_1ID233_1ID152_1ID260_1ID418_1ID84_1ID237_1ID1_1ID212_1ID463_1ID389_1ID93_1ID372_1ID214_1ID474_1ID295_1ID100_1ID21_1ID225_1ID529_1ID210_1ID426_1ID183_1ID316_1ID61_1ID553_1ID102_1ID229_1ID274_1ID191_1ID104_1ID430_1ID113_1ID117_1ID337_1ID33_1ID560_1ID73_1 |
Never mind - this is a copy-paste error of the MRE |
Ran into a different problem: > set.seed(1234)
> outer.tree <- load.outer.tree(model)
> plot(outer.tree)
Error in max(sapply(comp$get.lineages(), function(line) line$get.sampling.time())) :
invalid 'type' (list) of argument This occurs because the > node
[1] "ID316_1"
> comp
<Compartment>
Public:
add.lineage: function (new.lineage)
clone: function (deep = FALSE)
copy: function (deep = FALSE)
get.branching.time: function ()
get.lineages: function ()
get.name: function ()
get.sampling.time: function ()
get.source: function ()
get.type: function ()
initialize: function (name = NA, type = NA, source = NA, branching.time = NA,
is.unsampled: function ()
remove.lineage: function (ex.lineage)
set.branching.time: function (new.branching.time)
set.sampling.time: function ()
set.source: function (new.source)
set.type: function (new.type)
set.unsampled: function (is.unsampled)
Private:
branching.time: 519
deep_clone: function (name, value)
lineages: list
name: ID316_1
sampling.time: NA
source: Compartment, R6
type: CompartmentType, R6
unsampled: FALSE
> comp$get.lineages()
list() |
Reproduced the problem: > library(twt)
> set.seed(1234)
> #settings <- yaml.load_file('../data/sampled-hosts-1.yaml')
> settings <- yaml.load_file('issue119.yaml')
> m <- Model$new(settings)
>
> run <- twt::load.outer.tree(model = m)
> plot(run) # <-- OK
>
> events <- run$get.eventlog()$get.all.events()
> dim(events)
[1] 57 8
>
> inner <- sim.inner.tree(run)
>
> plot(run) # <-- fails
Error in .plot.outer.tree(run, ...) :
Detected multiple roots in Run object: ID73_1, ID529_1
>
> events2 <- run$get.eventlog()$get.events('transmission')
> dim(events2)
[1] 38 8 Very strange - |
@ewong347 ran into the same problem mentioned above in PoonLab/simclone#4 (private repo) |
Another Yaml specification MRE #Modelling from initial infection
InitialConditions:
originTime: 10.0 #
size:
Active: 1000 # number of susceptible at the origin time of the simulation for Type `active`
latent: 100
indexType: Active
CompartmentTypes:
'Active':
branching.rates: (Active=0.5, latent=0.05)
transition.rates: () #
coalescent.rate: 1.5
migration.rates: ()
generation.time: 1
bottleneck.size: 1 # bottleneck size when transmission event occurs
effective.size : 2
'latent':
branching.rates: (Active=0.0005, latent= 0.00005)
transition.rates: ()
migration.rates: () # no migration (assume no superinfection)
generation.time: 1
bottleneck.size: 1 # bottleneck size when transmission event occurs
effective.size : 2
Compartments:
'Active':
type: Active # CompartmentType
replicates: 1
source: NA
branching.time: 0
'Latent':
type: latent
replicates: 1
source: NA #try dropping me
branching.time: 0
Lineages:
'A':
type: virus
sampling.time: 0
location: Active
replicates: 1 # Starts in the Active compartment |
I think this is related to #92. We should probably be cloning the Run object produced by |
This is a follow-up of #118 where host "ID73" was the index case of the entire epidemic. My output from the ABM did not identify this host, as spotted by @ArtPoon , now the code is fixed.
I have noticed a strange behaviour, that is probably unintentional. It seems that
sim.inner.tree()
modifies its input. Below is the MRE. I would not expect the second callplot(outer.tree)
to fail -- likely thatouter.tree
was changed on the way... Thanks!and the associated YAML file:
The text was updated successfully, but these errors were encountered: