diff --git a/DESCRIPTION b/DESCRIPTION index 1f1dfd9..4e9888d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -5,9 +5,10 @@ Authors@R: person("Kari", "Lavikka", , "kari.lavikka@helsinki.fi", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-4163-4945")) Description: - 'Jellyfisher' creates Jellyfish plots using the JavaScript based - 'Jellyfish' library. Jellyfish plots integrate both phylogenetic - and sample tree structures in a single visualization. + Jellyfisher creates interactive Jellyfish plots for tumor evolution + visualization. These plots integrate a hierarchical sample structure + and tumor phylogeny into a single visualization, allowing for the + display of both spatial and temporal dimensions of the tumor evolution. License: MIT Encoding: UTF-8 Roxygen: list(markdown = TRUE) @@ -27,4 +28,4 @@ VignetteBuilder: knitr biocViews: Visualization, Phylogenetics, - Software \ No newline at end of file + Software diff --git a/R/clonevol_functions.R b/R/clonevol_functions.R index 0786209..da6cea3 100644 --- a/R/clonevol_functions.R +++ b/R/clonevol_functions.R @@ -3,16 +3,26 @@ #' Extracts data frames that can be used to create a Jellyfish plot. #' #' @param y A ClonEvol object -#' @param model The model to extract from +#' @param model The model to extract. Defaults to 1 #' #' @return A named list with three data frames: samples, phylogeny, and compositions #' #' @import dplyr #' @import stringr #' +#' @examples +#' if (requireNamespace("clonevol", quietly = TRUE)) { +#' # Run ClonEvol. Check the ClonEvol documentation for details. +#' y <- infer.clonal.models(...) +#' +#' # Plot the results +#' extract_tables_from_clonevol(y, model = 1) |> +#' jellyfisher() +#' } +#' #' @export #' -extract_tables_from_clonevol <- function(y, model = 1, explicit_parents = list()) { +extract_tables_from_clonevol <- function(y, model = 1) { if (!requireNamespace("clonevol", quietly = TRUE)) { stop("The clonevol package must be installed to use this functionality") } diff --git a/R/jellyfisher.R b/R/jellyfisher.R index a42103b..41050bb 100644 --- a/R/jellyfisher.R +++ b/R/jellyfisher.R @@ -1,4 +1,3 @@ - # Auto-generated by generate-R-code.mjs # Do not edit this file manually @@ -64,12 +63,14 @@ #' #' @examples #' # Plot the bundled example data +#' data(jellyfisher_example_tables) #' jellyfisher(jellyfish_example_tables, -#' options = list( -#' sampleHeight = 70, -#' sampleTakenGuide = "none", -#' showLegend = FALSE -#' )) +#' options = list( +#' sampleHeight = 70, +#' sampleTakenGuide = "none", +#' showLegend = FALSE +#' ) +#' ) #' #' @import htmlwidgets #' @export @@ -194,7 +195,7 @@ jellyfisher <- function(tables, x <- list( tables = tables, options = options, - controls = controls + controls = controls ) # Create widget @@ -213,4 +214,3 @@ jellyfisher <- function(tables, ) ) } - diff --git a/R/utils.R b/R/utils.R index 7a6b4ae..a76e3fb 100644 --- a/R/utils.R +++ b/R/utils.R @@ -7,6 +7,11 @@ #' #' @return A list of tables filtered by patient #' +#' @examples +#' data(jellyfisher_example_tables) +#' jellyfisher_example_tables |> +#' select_patients("EOC809") +#' #' @export #' select_patients <- function(tables, patient) { @@ -24,6 +29,10 @@ select_patients <- function(tables, patient) { #' #' @param tables A list of tables (samples, phylogeny, compositions) #' +#' @examples +#' data(jellyfisher_example_tables) +#' validate_tables(jellyfisher_example_tables) +#' validate_tables <- function(tables) { stopifnot( is.data.frame(tables$samples), diff --git a/man/extract_tables_from_clonevol.Rd b/man/extract_tables_from_clonevol.Rd index 24445f9..a5ab43e 100644 --- a/man/extract_tables_from_clonevol.Rd +++ b/man/extract_tables_from_clonevol.Rd @@ -4,12 +4,12 @@ \alias{extract_tables_from_clonevol} \title{Extract samples, phylogeny, and subclonal compositions from ClonEvol results} \usage{ -extract_tables_from_clonevol(y, model = 1, explicit_parents = list()) +extract_tables_from_clonevol(y, model = 1) } \arguments{ \item{y}{A ClonEvol object} -\item{model}{The model to extract from} +\item{model}{The model to extract. Defaults to 1} } \value{ A named list with three data frames: samples, phylogeny, and compositions @@ -17,3 +17,14 @@ A named list with three data frames: samples, phylogeny, and compositions \description{ Extracts data frames that can be used to create a Jellyfish plot. } +\examples{ +if (requireNamespace("clonevol", quietly = TRUE)) { + # Run ClonEvol. Check the ClonEvol documentation for details. + y <- infer.clonal.models(...) + + # Plot the results + extract_tables_from_clonevol(y, model = 1) |> + jellyfisher() +} + +} diff --git a/man/jellyfisher.Rd b/man/jellyfisher.Rd index 9631722..6579147 100644 --- a/man/jellyfisher.Rd +++ b/man/jellyfisher.Rd @@ -82,11 +82,13 @@ https://github.com/HautaniemiLab/jellyfish?tab=readme-ov-file#input-data } \examples{ # Plot the bundled example data +data(jellyfisher_example_tables) jellyfisher(jellyfish_example_tables, - options = list( - sampleHeight = 70, - sampleTakenGuide = "none", - showLegend = FALSE - )) + options = list( + sampleHeight = 70, + sampleTakenGuide = "none", + showLegend = FALSE + ) +) } diff --git a/man/select_patients.Rd b/man/select_patients.Rd index 99469ff..fbccd5b 100644 --- a/man/select_patients.Rd +++ b/man/select_patients.Rd @@ -17,3 +17,9 @@ A list of tables filtered by patient \description{ Given a list of tables, filter them by patient. } +\examples{ +data(jellyfisher_example_tables) +jellyfisher_example_tables |> + select_patients("EOC809") + +} diff --git a/man/validate_tables.Rd b/man/validate_tables.Rd index 9293663..0ad315b 100644 --- a/man/validate_tables.Rd +++ b/man/validate_tables.Rd @@ -12,3 +12,8 @@ validate_tables(tables) \description{ Superficially validate that the tables are in the correct format. } +\examples{ +data(jellyfisher_example_tables) +validate_tables(jellyfisher_example_tables) + +} diff --git a/tools/generate-R-code.mjs b/tools/generate-R-code.mjs index 7d8419e..43d9d2a 100755 --- a/tools/generate-R-code.mjs +++ b/tools/generate-R-code.mjs @@ -145,6 +145,7 @@ ${roxygenOptions.join("\n")} #' #' @examples #' # Plot the bundled example data +#' data(jellyfisher_example_tables) #' jellyfisher(jellyfish_example_tables, #' options = list( #' sampleHeight = 70,