#' plotMutTree plots phylogenetic tree of mutations
#'
#' @param maf Maf or MafList object generated by readMaf function.
#' @param patient.id Select the specific patients.
#' @param method Approach to construct phylogenetic trees.
#' Choose one of "NJ"(Neibor-Joining), "MP"(maximum parsimony),
#' "ML"(maximum likelihood), "FASTME.ols" or "FASTME.bal".
#' @param bootstrap.rep.num Bootstrap iterations. Default 500.
#' @param min.vaf The minimum value of vaf. Default 0.
#' @param group a list that used to indicate the sample groups
#' @param group.colors an array indicates the colors of sample groups.
#' @param title title of the plot.
#' @param hexpand_ratio: hexpand ratio. see \code{\link[ggtree]{hexpand}}
#'
#' @examples
#' library(MesKit)
#' data.type <- "split1"
#'
#' maf <- readMaf(
#' mafFile = system.file(package = "MPTevol", "extdata", sprintf("meskit.%s.mutation.txt", data.type)),
#' ccfFile = system.file(package = "MPTevol", "extdata", sprintf("meskit.%s.CCF.txt", data.type)),
#' clinicalFile = system.file(package = "MPTevol", "extdata", sprintf("meskit.%s.clinical.txt", data.type)),
#' refBuild = "hg19",
#' ccf.conf.level = 0.95
#' )
#'
#' # construct a group
#' group <- list(
#' Coad = paste0("Coad_", 1:5),
#' OveryLM = paste0("OveryLM_", 1:5),
#' OveryRM = paste0("OveryRM_", 1:6),
#' UterusM = paste0("UterusM_", c(1, 3))
#' )
#'
#' plotMutTree(maf, patient.id = "Met1", group = group, title = "CRC Met")
#' @param ... parameters in the getPhyloTree function.
#'
#' @export
plotMutTree <- function(maf,
patient.id,
method = "NJ",
min.vaf = 0.02,
bootstrap.rep.num = 500,
group = NULL,
group.colors = NULL,
title = "cancer",
hexpand_ratio = 0.3,
...) {
message("Building trees")
phyloTree <- MesKit::getPhyloTree(maf,
patient.id = patient.id,
method = method, min.vaf = min.vaf,
bootstrap.rep.num = bootstrap.rep.num,
...
)
message("Viewing trees")
p_trees <- viewTrees(
phyloTree = phyloTree,
group = group,
group.colors = group.colors,
title = title,
hexpand_ratio = hexpand_ratio
)
return(
list(
phyloTree = phyloTree,
plot = p_trees
)
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.