Impute duplication events based on a vector of species
Impute duplication events based on a vector of species
Uses a simple algorithm to impute duplication events based on the terminal genes of the tree. An interior node is a duplication event if a specie has two or more leafs within its clade.
imputate_duplications(tree, species)
Arguments
tree: An object of class ape::phylo .
species: A character vector of length ape::Ntip(tree) (see details).
Returns
A logical vector of length ape::Nnode(tree, internal.only = FALSE)
with TRUE to indicate that the corresponding node is a duplication event. The order matches that in the input tree.
Details
This function will take a vector of species and, based on that, assign duplication events throughout the interior nodes. An interior node is labeled as a duplication event if two or more of the leaves within it are from the same species.
Examples
# Data from PANTHERpath <- system.file("tree.tree", package="aphylo")ptree <- read_panther(path)# Extracting the speciessp <- gsub(".+[:]|[|].+","", ptree$tree$tip.label)# Imputing duplicationsimputate_duplications(ptree$tree, species = sp)