make.phylo: Obtain phylogenies from outbreak data

Description Usage Arguments Value Author(s) See Also Examples

Description

The function make.phylo is used to obtain phylogenies for each of the genes sequenced in an obkData object. Phylogenetic trees can optionally be plotted before being returned. Colors are used to distinguish samples, individuals, dates, or any other requested information. make.phylo is a wrapper for functions from the ape package: dist.dna for computing genetic distances, and specific methods for getting trees such as nj.

Usage

1
2
3
4
5
6
7
make.phylo(x, ...)

## S4 method for signature 'obkData'
make.phylo(x, locus=NULL,
           result=c("obkData","multiPhylo"), model = "N",
           pairwise.deletion = FALSE, method=nj,
           plot=FALSE, ask=TRUE,...)

Arguments

x

an obkData object.

result

a character string indicating the type of result to be returned; if obkData, then the phylogenies are stored in x@trees, possibly removing previous phylogenies; if multiPhylo, the result is a list of phylo objects with the class multiPhylo.

locus

a character or integer vector indicating the loci to be used; if NULL, all loci are used, producing one phylogeny each; see get.dna.

model, pairwise.deletion

arguments passed to dist.dna.

method

a function producing phylogenetic trees with the class phylo (ape package) from a distance matrix with class dist; examples include nj, bionj, fastme.bal, and fastme.ols.

plot

a logical indicating whether plots of the trees should be produced.

ask

a logical indicating whether user input must be waited for before drawing new plots.

...

further graphical arguments to be passed to plot.phylo.

Value

A obkData with new phylogenies, or a list with class multiPhylo.

Author(s)

Thibaut Jombart t.jombart@imperial.ac.uk

See Also

read.annotated.tree and read.annotated.nexus to read annotated phylogenies into phylo objects.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Example using simulate outbreak ##

set.seed(3)
x <- simuEpi(N = 200, D = 20, beta = 0.002, nu = 0.1, mu = 0.002)$x
get.trees(x) # no tree here

## GET TREE AND DISPLAY IT
x <- make.phylo(x, plot=TRUE)
get.trees(x) # newly created trees


## DISPLAY TREE USING PLOTGGPHY

## root tree to first case ##
if(require(ape)){
tre <- root(get.trees(x)[[1]],1)
}

## plot tree, use color for dates ##
par(mar=c(1,1,4,1))
plot(tre, edge.width=2, type="fan", show.tip=FALSE)
title("NJ tree of a simulated outbreak")
mtext("each disk indicates 1 mutation from the root")

thibautjombart/OutbreakTools documentation built on Oct. 26, 2019, 10:56 p.m.