## This code is part of the megaptera package
## © C. Heibl 2016 (last update 2017-10-18)
#' @importFrom ips unlistFirstLevel
#' @export
splitAlignment <- function(root, gt, a){
## determine clades to be split
root.descendants <- gt$edge[gt$edge[, 1] == root, 2]
## do the splitting
engine <- function(node, gt, a){
if ( node > Ntip(gt) ){
tips <- descendants(gt, node, labels = TRUE)
} else {
tips <- gt$tip.label[node]
}
deleteEmptyCells(a[tips, ], quiet = TRUE)
}
a <- lapply(root.descendants, engine, gt = gt, a = a)
## splitting can cause non-overlapping subalignments
a <- lapply(a, splitNonoverlapping)
## unlist to first level
unlistFirstLevel(a)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.