Test superinf#180
Conversation
…direct method; add pathogen registry to InnerTree; add tests
| public = list( | ||
| initialize = function(outer, prefix='P', p.index=1) { | ||
| private$inner.log <- data.frame( | ||
| time=numeric(), # time of event |
There was a problem hiding this comment.
please restore these inline comments
|
|
||
| # accessor functions | ||
| get.log = function() { private$inner.log }, | ||
| set.log = function(new.log) { private$inner.log <- new.log }, |
There was a problem hiding this comment.
please specify that this is for testing purposes
| name=paste(private$prefix, private$p.index, sep="_"), | ||
| end.time=time, | ||
| ) | ||
| private$p.index <- private$p.index + 1 # increment counter |
There was a problem hiding this comment.
again please restore inline comment
|
|
||
|
|
||
| #' Modify Pathogen names in the inner tree event log to make them unique. | ||
| #' This makes it easier to label single nodes (transmission, migration events) |
| cat(" Parent:", self$get.parent()$get.name(), "\n") | ||
| children <- sapply(self$get.children(), function(child) child$get.name()) | ||
| cat(" Children:", children, "\n") | ||
| cat(" Parents:", sapply(self$get.parents(), function(p) p$get.name()), "\n") |
There was a problem hiding this comment.
I would prefer these to be listed on the same line (whitespace separated)
| set.parent = function(parent) { private$parent <- parent }, | ||
| get.parents = function() { private$parents }, | ||
| get.parent = function() { private$parents[[1]] }, | ||
| set.parent = function(parent) { private$parents <- list(parent) }, |
There was a problem hiding this comment.
need to handle different input types. What if user passes a character or a list?
| export(sim.dynamics) | ||
| export(sim.inner.tree) | ||
| export(sim.outer.tree) | ||
| export(plot.OuterTree.with.dynamics) |
There was a problem hiding this comment.
there should only be one plot.OuterTree method (which is a generic method). Is it possible to modify the existing method to give the user the option to add dynamics with dynamics=TRUE?
There was a problem hiding this comment.
i.e., tuck additional code into an if statement
| expect_true(all(bps == as.integer(bps))) | ||
| }) | ||
|
|
||
| test_that("breakpoint positions are unique", { |
There was a problem hiding this comment.
I don't think breakpoints have to be unique across recombination events.
| #' @export | ||
| #' @noRd | ||
| print.InnerTree <- function(obj) { | ||
| cat("twt InnerTree\n") # bold color! |
There was a problem hiding this comment.
We can leave this comment out - no longer using bold type face.
issues #175 #176 #177, unit tests for simARG