R/getTree.R

Defines functions getTree

Documented in getTree

#' Get the Tree Object
#'
#' A convenience function to obtain a tree object from newick tree,
#' essentially wraps read.tree from the ape package.
#'
#' @param newick The newick tree to be instantiated.
#' @return a tree object
#' @export
#' @importFrom ape read.tree
#' @examples
#' taxonomy = getTaxonomy(root='Alveolata')
#' getTree(newick=taxonomy$newick)


getTree <- function(newick) {
    if (class(newick) == "list") {
        newick <- newick$newick
    }
    return(ape::read.tree(text = newick))
}
klarakaleb/roma documentation built on April 21, 2024, 8:39 a.m.