create.tree: Create a phylogenetic tree

View source: R/create_tree.R

create.treeR Documentation

Create a phylogenetic tree

Description

This function creates a tree, more a less stepwise, depending on the data in the function. The function can be run without arguments. If the desired phylogeny is already known and prepared, it is advised to prepare and save the elements used in this function, in case of small errors (yet, the function doesn't allow one to recover inputted data if there is an error).

Usage

create.tree(nbtaxa,taxa,age_taxa=NULL,nbnodes,nodes,age_nodes=NULL,node.labels=NA,tax_selection,
            ultra=FALSE,format,plot=FALSE)

Arguments

nbtaxa

Desired number of taxa; optional, especially if either taxa or age_taxa parameters are present

taxa

A vector specifying the name of all desired taxa; if not all taxa names are known, rather do not specify the known names yet and specify them by running the function without this parameter

age_taxa

A vector specifying the age of all desired taxa; if not all taxa ages are known, rather do not specify the known ages yet and specify them by running the function without this parameter

nbnodes

Desired number of nodes; optional, especially if age_nodes is present

nodes

A list of vectors; each vector is a node and must contains the names of the "targets", either the taxa (full name) or other nodes (Ni, i being the i-th node). It is advised to name each vector of the list "Ni" (i being the i-th node); if not, nodes are assumed to be hierarchized from oldest to youngest (while by naming nodes, the order does not matter).

age_nodes

A vector specifying the age of all nodes; if not all node ages are known, rather do not specify the known ages yet and specify them by running the function without this parameter. If nodes are provided, should be in the same order

node.labels

A vector specifying the labels of the tree nodes, if there are. Can be set to NA, NULL, or FALSE for no node labels (the default), to TRUE for node labels set while creating the tree (node names in the parameter nodes if present, else default node names with prefix Node), or to a vector of same length than the nodes for user-defined names.

tax_selection

The method to choose taxa if taxa and/or nodes are not specified. Can be either BYNAME (choose taxa by their name) or BYGRAPH (choose taxa by clicking them)

ultra

Logical; if the tree has to be ultrametric (i.e. without specific node ages)

format

The format of the output; can be an object of class phylo by specifying "phylo" or "phylo object" or simply a newick/parenthetic text by specifying "newick", "NEWICK" or "parenthetic"

plot

Optional. Turned to TRUE by default, meaning that the final phylogeny is plotted at the end of the execution of the function. Turn to FALSE if not desired.

Value

Returns either an object of class phylo or a text in newick/parenthetic format. If the latter, the tree can also be saved during performing the function.


jacobmaugoust/ULT documentation built on May 16, 2023, 1:29 p.m.