Learn R Programming

outbreaker (version 1.1-8)

get.tTree: Simple transmission tree from outreaber's output

Description

The S3 class tTree is used for storing simplified transmission trees, obtained from outbreaker's ouptput (functions outbreaker and outbreaker.parallel) using get.tTree. Some additional features are available for tTree objects, including plotting (plot), conversion to igraph graphs (as.igraph), and identification of mutations on the branches of the tree (findMutations).

Usage

get.tTree(x, burnin = 20000, best = c("ancestries", "tree"))

# S3 method for tTree as.igraph(x, edge.col = "black", col.edge.by = "prob", col.pal = NULL, annot = c("dist", "n.gen", "prob"), sep = "/", ...)

# S3 method for tTree findMutations(x, dna, ...)

# S3 method for tTree plot(x, y = NULL, edge.col = "black", col.edge.by = "prob", col.pal = NULL, annot = c("dist", "n.gen", "prob"), sep = "/", ...)

Arguments

x

for get.tTree, the output of outbreaker or outbreaker.parallel. For other functions, a tTree object.

burnin

an integer indicating the number of steps of the MCMC to be discarded as burnin period. Defaults to 20,000.

best

a character string matching "ancestries" or "tree", indicating which criterion is used to define the consensus tree; "ancestries" retains, for each case, the most supported ancestor; "tree" retains the most supported tree; note that the latter may exist only in the case of very small epidemics.

edge.col

the color used for the edges; overriden if col.edge.by is provided.

col.edge.by

a character string indicating how edges should be colored. Can be "dist" (by number of mutations), "n.gen" (by number of generations), or "prob" (by posterior support for the ancestries).

col.pal

the palette of colors to be used for edges; if NULL, a grey palette is used, with larger values in darker shades.

annot

same as col.edge.by, but specifies the information used to annotated the edges; several values can be provided, in which case different fields will be concatenated to generate the annotation.

sep

a character indicating the separator for different field (see annot).

further arguments to be passed to other functions.

dna

a DNAbin object containing the aligned sequences of the isolates in the tree.

y

unused - there for compatibility with the generic of plot.

Value

tTree objects are lists with the following components:

  • idx: integer, the index of the cases

  • collec.dates: the collection dates of the isolates

  • idx.dna: the index of the cases to which each DNA sequence corresponds

  • ances: the index of the inferred ancestor, for each case

  • inf.dates: the inferred infection date, for each case

  • p.ances: the posterior probability of the inferred ancestor (i.e., proportion in the posterior distribution of ancestors)

  • nb.mut: the number of mutations between isolates and their inferred ancestor, for each isolate

  • n.gen: the number of generations between isolates and their inferred ancestor, for each isolate

  • p.gen: the posterior probability of the inferred number of generations between each case and its inferred ancestor

  • inf.curves: the infectivity curves for each case

The plot function invisibly returns the conversion of the tTree object into a igraph graph.

Examples

Run this code
# NOT RUN {
data(fakeOutbreak)
attach(fakeOutbreak)

## represent posterior ancestries
if(require(adegenet)){
transGraph(res, annot="", main="Posterior ancestries - support > 0.01",
   threshold=0.01, col.pal=spectral)
}
## get consensus ancestries
tre <- get.tTree(res)
plot(tre, annot="", main="Consensus ancestries")

## show match data/consensus ancestries
col <- rep("lightgrey", 30)
col[which(dat$ances != tre$ances)] <- "pink"
plot(tre, annot="", vertex.color=col, main="Consensus ancestries")
mtext(side=3, text="cases with erroneous ancestries in pink")


detach(fakeOutbreak)


# }

Run the code above in your browser using DataLab