phybreakdata: Create a phybreakdata-object from raw data.

Description Usage Arguments Value Author(s) References Examples

View source: R/phybreakdata.R

Description

phybreakdata takes as data sequences and sampling times and makes a phybreakdata object. If no host names are provided, each sample is assumed to be associated with a separate host. The number of sequences should be equal to the length of the sampling time vector, and the position identifies the host (unless named vectors are provided). Sample names can be provided separately; otherwise it will be tried to extract them from the sequences or sampling times. It is also possible to include (otherwise unobserved) simulated data: sim.infection times, sim.infectors, and a (phylogenetic) sim.tree. This is done automatically when using sim.phybreak.

Usage

1
2
3
phybreakdata(sequences, sample.times, sample.names = NULL,
  host.names = sample.names, sim.infection.times = NULL,
  sim.infectors = NULL, sim.tree = NULL)

Arguments

sequences

Sequence data of class 'DNAbin', 'phyDat', or a matrix with nucleotides, each row a host, each column a nucleotide). In a matrix, nucleotides should be lower-case letters. All undefined nucleotides or ambiguity codes will be turned into 'n'.

sample.times

A vector of sampling times (numerical or Date).

sample.names

A vector with sample names.

host.names

A vector with host names. The vector identifies the host for each sample, so should be of the same length as sample.times.

sim.infection.times

A vector with infection times (numerical or Date).

sim.infectors

A vector with infectors, either by name or by position (use 0 for the index case).

sim.tree

A tree of class 'phylo', with tip names identifying the hosts.

Value

An object of class phybreakdata with the following elements

sequences

a 'phyDat'-object with the sequence data.

sample.times

a named vector with the sample times.

sample.hosts

a named vector with the hosts from whom the samples have been taken.

sim.infection.times

a named vector with the (simulated) infection times (if provided).

sim.infectors

a named vector with the (simulated) infectors (if provided).

sim.tree

a 'phylo'-object with the (simulated) phylogenetic tree (if provided).

Author(s)

Don Klinkenberg [email protected]

References

Klinkenberg et al. (2017) Simultaneous inference of phylogenetic and transmission trees in infectious disease outbreaks. PLoS Comput Biol, 13(5): e1005495.

Examples

1
2
3
4
5
6
sampletimedata <- c(0,2,2,4,4)
sampleSNPdata <- matrix(c("a","a","a","a","a",
                          "a","c","c","c","c",
                          "t","t","t","g","g"), nrow = 5, 
                          dimnames = list(LETTERS[1:5], NULL))
dataset <- phybreakdata(sequences = sampleSNPdata, sample.times = sampletimedata)

donkeyshot/phybreak documentation built on Aug. 16, 2018, noon