as.phylo.EventLogger | R Documentation |
An S3 method converts events stored in the EventLogger object into an inner coalescent tree w/ option to include/exclude transmission events.
## S3 method for class 'EventLogger'
as.phylo(
eventlog,
transmissions = FALSE,
migrations = FALSE,
transitions = FALSE
)
eventlog: |
EventLogger object |
transmissions: |
logical; if TRUE, include transmission events as singleton nodes in tree. |
migrations: |
logical; if TRUE, include migration events as singleton nodes in tree. |
transitions: |
logical, if TRUE, include transition events as singletone nodes in tree. |
ape::phylo object
path <- system.file('extdata', 'structSI.yaml', package='twt')
settings <- yaml.load_file(path)
structSI <- Model$new(settings)
run <- sim.outer.tree(structSI)
eventlog <- sim.inner.tree(run)
tr <- as.phylo(eventlog, transmissions=TRUE, migrations=TRUE)
tr
# make a nice plot
require(ggfree)
l <- tree.layout(structSI, type='r')
plot(l)
cex <- as.integer(structSI$event.type %in% c('transmission', 'migration'))
bg <- ifelse(structSI$event.type=='transmission', 'dodgerblue', 'salmon')
points(l, cex=cex, pch=21, bg=bg)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.