#' Generate boxplots of TMB distribution versus clinical response
#'
#' This function generates boxplots representing the distribution of TMB
#' values between immunotherapy responders and nonresponders.
#'
#' @param TMB_clinical dataframe generated by annotateTMB()
#'
#' @return boxplot
#' @export
#' @examples
#' #' # Import datasets
#' data(TMB_VanAllen)
#' data("VanAllen_Clinical")
#' # Annotate TMB with clinical reponse
#' TMB_clincal_response <- annotateTMB(TMB_df = TMB_VanAllen, ClinicalData = VanAllen_Clinical )
#'
#' # generate plot
#' generateBoxplot(TMB_clincal_response)
generateBoxplot <- function(TMB_clinical){
# sanity check
if (nrow(TMB_clinical) == 0) stop("TMB_clinical should have at least one row")
if (!methods::is(TMB_clinical, "data.frame")) stop("ClinicalData should be a data.frame")
if (!any(colnames(TMB_clinical) %in% "ClinicalResponse")) stop("TMB_clinical did not have a column named ClinicalResponse")
if (!any(colnames(TMB_clinical) %in% "Sample")) stop("TMB_clinical did not have a column named TMB_per_Mb")
if (!any(colnames(TMB_clinical) %in% "Sample")) stop("TMB_clinical did not have a column named Filter")
if (!any(colnames(TMB_clinical) %in% "Sample")) stop("TMB_clinical did not have a column named Panel")
ggplot2::ggplot(TMB_clinical, ggplot2::aes(x = .data$ClinicalResponse, y = .data$TMB_per_Mb)) +
ggplot2::geom_boxplot(ggplot2::aes(fill = .data$ClinicalResponse)) +
ggplot2::facet_grid(.data$Filter ~ .data$Design) +
ggplot2::ggtitle("compare TMB distribution from responders and non-responders")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.