patristic_matrix_to_phylo: Convert a patristic matrix to a 'phylo' object.

View source: R/to_phylo.R

patristic_matrix_to_phyloR Documentation

Convert a patristic matrix to a phylo object.

Description

Function patristic_matrix_to_phylo is used inside summarize_datelife_result().

Usage

patristic_matrix_to_phylo(
  patristic_matrix,
  clustering_method = "nj",
  fix_negative_brlen = TRUE,
  fixing_method = 0,
  ultrametric = TRUE,
  variance_matrix = NULL
)

Arguments

patristic_matrix

A patristic matrix

clustering_method

A character vector indicating the method to construct the tree. Options are:

nj

Neighbor-Joining method applied with ape::nj().

upgma

Unweighted Pair Group Method with Arithmetic Mean method applied with phangorn::upgma().

bionj

An improved version of the Neighbor-Joining method applied with ape::bionj().

triangle

Triangles method applied with ape::triangMtd()

mvr

Minimum Variance Reduction method applied with ape::mvr().

fix_negative_brlen

Boolean indicating whether to fix negative branch lengths in resulting tree or not. Default to TRUE.

fixing_method

A character vector specifying the method to fix branch lengths: "bladj", "mrbayes" or a number to be assigned to all branches meeting fixing_criterion

ultrametric

Boolean indicating whether to force ultrametric or not.

variance_matrix

A variance matrix from a datelifeResult object, usually an output from datelife_result_variance_matrix(). Only used if clustering_method = "mvr".

Details

We might add the option to insert a function as clustering_method in the future. Before, we had hard-coded the function to try Neighbor-Joining (NJ) first; if it errors, it will try UPGMA. Now, it uses NJ for a "phylo_all" summary, and we are using our own algorithm to get a tree from a summary matrix.

Value

A rooted phylo object.


datelife documentation built on July 10, 2023, 2:02 a.m.