convert_to_cophy: Converts an object into an object of type cophy

Description Usage Arguments Details Value See Also Examples

View source: R/convert_to_cophylo.R

Description

Functions for converting either a list of three components (host_tree, symb_tree, and association_mat) into an object of class cophy Otherwise turns arguments into the cophy object if inputting a hostTree of type 'phylo', a symbiont tree of type 'phylo', and a matrix of type eventHistory.

Usage

1
2
3
convert_to_cophy(hostTree, symbTree, assocMat, eventHistory = NULL)

to_cophy(hostTree, symbTree, assocMat, eventHistory = NULL)

Arguments

hostTree

An object of type 'phylo'

symbTree

An object of type 'phylo'

assocMat

A matrix with rows being extant symbionts and columns being extant hosts

eventHistory

An optional data frame of four columns: Symbiont Index, Host Index, Event Type (see details), and Event Time

Details

The association matrix must be with rows equal to the number of extant symbionts and columns equal to the number of extant hosts. Non-zero values in this matrix indicate associations (typically this will be a matrix of just zeros and ones).

The eventHistory parameter has four columns: Symbiont Index, Host Index, Event Type (see details), and Event Time. The indexing of the first two columns should follow the indexing of the 'phylo' objects 'hostTree' and 'symbTree'. The types of events are as follows: * HG - a host speciation event * HL - a host extinction event * C - a cospeciation event * SG - a symbiont speciation event * SL - a symbiont extinction event * AG - an association gain between symbiont x and host y * AL - an association loss between symbiont x and host y

Value

An object of type cophy

See Also

is.cophy

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
gopher_lice_map_path <- system.file("extdata",
                                  "gopher_lice_mapping.txt",
                                   package = "treeducken")
gopher_lice_map <- read.table(gopher_lice_map_path,
                              stringsAsFactors = FALSE,
                              header = TRUE)
gopher_tree_path <- system.file("extdata",
                                "gophers_bd.tre",
                                 package = "treeducken")
gopher_lice_assoc_matrix <- convert_assoc_table_to_matrix(gopher_lice_map)
gopher_tree <- ape::read.nexus(gopher_tree_path)
lice_tree_path <- system.file("extdata",
                              "lice_bd.tre",
                               package = "treeducken")
lice_tree <- ape::read.nexus(lice_tree_path)
gopher_lice_cophy <- to_cophy(hostTree = gopher_tree,
                                         symbTree = lice_tree,
                                         assocMat = gopher_lice_assoc_matrix)

treeducken documentation built on March 3, 2021, 1:11 a.m.