Learn R Programming

aphylo (version 0.2-1)

imputate_duplications: Impute duplication events based on a vector of species

Description

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.

Usage

imputate_duplications(tree, species)

Arguments

tree

An object of class ape::phylo.

species

A character vector of length ape::Ntip(tree) (see details).

Value

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

Run this code
# NOT RUN {
# Data from PANTHER
path <- system.file("tree.tree", package="aphylo")
ptree <- read_panther(path)

# Extracting the species
sp <- gsub(".+[:]|[|].+", "" , ptree$tree$tip.label)

# Imputing duplications
imputate_duplications(ptree$tree, species = sp)
# }

Run the code above in your browser using DataLab