evalBranch: evalBranch

View source: R/evalBranch.R

evalBranchR Documentation

evalBranch

Description

This function evaluates the effect of modifying a single branch length on Phylogenetic Diversity (PD) and the selection of sets with the highest PD. It allows for both decreasing (to zero) and increasing (to a user-defined maximum).

Usage

evalBranch(
  tree = tree,
  distribution = distribution,
  branchToEval = "terminals",
  approach = "upper",
  root = FALSE,
  index = "PD",
  maxMultiplier = 1.01,
  redondeo = 3,
  verbose = FALSE,
  compact = TRUE,
  printNames = FALSE
)

Arguments

tree

A single phylogenetic tree in APER format.

distribution

A matrix indicating the distribution of terminal taxa across sets.

branchToEval

The branch(es) to evaluate (can be a numeric vector of node numbers, "terminals", "internals", or "all", default = "terminals").

approach

The type of branch length modification: "lower" (decrease to zero), "upper" (increase to maximum), or "all" for both (default = "upper").

root

Logical indicating whether to use the root in PD calculation (default = FALSE).

index

The index used for PD calculation (e.g., "PD").

maxMultiplier

Multiplier for determining the upper limit of branch length modification (BL_sum * maxMultiplier, default = 1.01).

redondeo

Number of decimal places for rounding.

verbose

Logical indicating whether to print verbose output (default = FALSE).

compact

Logical indicating whether to return a compact output (default = TRUE).

printNames

Logical indicating whether to print terminal names in output.

Value

The function returns a list containing information about the effect of branch length modifications on set selection, including:

'branchToEval': The evaluated branch(es).

'bestInitialArea': The set(s) with the highest PD in the initial tree.

'bestModifiedArea': The set(s) with the highest PD in the modified tree.

'approach': The type of branch length modification used.

'delta': The percentage change in branch length.

'initialPD': The initial PD value.

'modifiedPD': The PD value after the branch length modification.

'initialLength': The initial branch length.

'finalLength': The final branch length after modification.

'areas': A vector of set names.

'terminals': A vector of terminal taxa names.

'root': Logical indicating whether the root was used in PD calculation.

'index': The PD index used.

Author(s)

Miranda-Esquivel Daniel R.

Examples

library(blepd) 
data(tree)
data(distribution)

# Evaluate the effect of increasing the length of terminal branches

result_upper <- evalBranch(tree = tree, distribution = distribution, 
                         branchToEval = "terminals", approach = "upper") 


Dmirandae/blepd documentation built on Jan. 17, 2025, 3:08 p.m.