swapBL | R Documentation |
This function evaluates how swapping terminal or internal branch lengths affects Phylogenetic Diversity (PD) in a phylogenetic tree. It achieves this by simulating branch length modifications and assessing the resulting changes in PD.
swapBL(
tree = tree,
distribution = distribution,
model = "allswap",
nTimes = 100,
root = FALSE,
index = "PD",
branch = "terminals",
percentual = FALSE,
verbose = TRUE,
compact = TRUE
)
tree |
(required): A phylogenetic tree object in the APER format, containing terminal labels (tips). |
distribution |
(required): A matrix representing the distribution of terminal taxa across sets (rows represent sets, columns represent terminal taxa). Ensure the column names in this matrix match the terminal labels (tips) in the tree. |
model |
(optional, default="allswap"): The type of branch length swapping to perform. Valid options are: "simpleswap": Swaps the lengths of two randomly chosen branches. "allswap" (default): Randomly permutes the branch lengths within the specified branch scope (defined by the 'branch' argument). "uniform": Replaces the branch lengths of chosen nodes with random values drawn from a uniform distribution between the minimum and maximum values of the original lengths. |
nTimes |
(optional, default=100): The number of times to repeat the swapping process (iterations). |
root |
(optional, default=TRUE): A logical value indicating whether to use the root node in PD calculations. |
branch |
(optional, default="terminals"): The type of branches to swap lengths for. Valid options are: "terminals": Swaps lengths among terminal branches. "internals": Swaps lengths among internal branches. "all": Swaps lengths among all branches (terminals and internals). |
verbose |
(optional, default=TRUE): A logical value indicating whether to print informative messages during function execution. |
compact |
(optional, default=TRUE): A logical value determining the output content. If 'FALSE', all available information is returned. If 'TRUE' (default), a more concise output is provided. |
'initialPD': The PD value of the original tree.
'bestInitialArea': The set(s) with the highest PD in the initial tree.
'bestModifiedArea': A data frame summarizing the frequency of each set identified with the highest PD across iterations.
'model': The type of branch length swapping performed ("simpleswap", "allswap", or "uniform").
'nTimes': The number of times the swapping process was repeated.
'branch': The type of branches swapped ("terminals", "internals", or "all").
'root' (optional): A logical value indicating whether the root node was used during PD calculations (default: FALSE).
'index' (optional): The PD index used (currently always "PD").
Miranda-Esquivel Daniel R.
library(blepd)
data(tree)
data(distribution)
# Evaluate the effect of swapping all terminal branch lengths 100 times
swapBL(tree = tree, distribution = distribution, model = "allswap", nTimes = 100, branch = "terminals")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.