From eabfa41a2afb554a89b2d06375f8fd28fe9266df Mon Sep 17 00:00:00 2001 From: m7pr Date: Fri, 30 Jun 2023 15:53:49 +0200 Subject: [PATCH 01/27] reduce the content of WORDLIST --- NEWS.md | 4 ++-- R/adtteSpec.R | 14 +++++++------- R/argument_convention.R | 6 +++--- R/checkmate.R | 4 ++-- R/km.R | 6 +++--- README.md | 10 +++++----- inst/WORDLIST | 9 --------- man/adtteSpecInput.Rd | 4 ++-- man/adtteSpecServer.Rd | 12 ++++++------ man/assert_adtte_vars.Rd | 4 ++-- man/assertion_arguments.Rd | 2 +- man/check_tag.Rd | 2 +- man/h_km_mae_to_adtte.Rd | 2 +- man/module_arguments.Rd | 4 ++-- man/tm_g_forest_tte.Rd | 4 ++-- man/tm_g_km.Rd | 10 +++++----- tests/testthat/setup-skip_if_too_deep.R | 2 +- 17 files changed, 45 insertions(+), 54 deletions(-) diff --git a/NEWS.md b/NEWS.md index 87dda4a7..8e089934 100644 --- a/NEWS.md +++ b/NEWS.md @@ -21,7 +21,7 @@ * Rewrote modules to use `moduleServer` and updated call to `plot_with_settings_srv` after changes in `teal.devel`. * Replaced calls to `teal::root_modules` with `teal::modules` following deprecation of `teal::root_modules`. * Added basic logging to the modules. -* Fixed the `geneSpecInput` so that the hermes app doesn't fail anymore (on chrome) on an experiment with no genes. +* Fixed the `geneSpecInput` so that the `hermes` app doesn't fail anymore (on chrome) on an experiment with no genes. # teal.modules.hermes 0.1.1 @@ -43,7 +43,7 @@ * `tm_g_barplot` is a barplot module for RNA-seq gene expression analysis. * `tm_g_boxplot` is a boxplot module for RNA-seq gene expression analysis. * `tm_g_forest_tte` is a survival forest plot module to analyze RNA-seq gene expression data together with survival data. -* `tm_g_km` is a Kaplan-Meier plot module to analyze RNA-seq gene expression data together with survival data. +* `tm_g_km` is a `Kaplan-Meier` plot module to analyze RNA-seq gene expression data together with survival data. * `tm_g_pca` is a principal components analysis plot module for RNA-seq gene expression analysis. * `tm_g_quality` is a quality control module for RNA-seq gene expression data. * `tm_g_scatterplot` is a scatterplot module for RNA-seq gene expression analysis. diff --git a/R/adtteSpec.R b/R/adtteSpec.R index 3856672f..d0fe8dc8 100644 --- a/R/adtteSpec.R +++ b/R/adtteSpec.R @@ -1,4 +1,4 @@ -#' Data Preprocessing for ADTTE Module +#' Data Preprocessing for `ADTTE` Module #' #' @description `r lifecycle::badge("experimental")` #' @@ -88,11 +88,11 @@ h_km_mae_to_adtte <- function(adtte, ) } -#' Module Input for ADTTE Specification +#' Module Input for `ADTTE` Specification #' #' @description `r lifecycle::badge("experimental")` #' -#' This defines the input for the ADTTE specification. +#' This defines the input for the `ADTTE` specification. #' #' @inheritParams module_arguments #' @param label_paramcd (`string`)\cr label for the endpoint (`PARAMCD`) selection. @@ -114,12 +114,12 @@ adtteSpecInput <- function(inputId, # nolint ) } -#' Module Server for ADTTE Specification +#' Module Server for `ADTTE` Specification #' #' @description `r lifecycle::badge("experimental")` #' -#' This defines the server part for the ADTTE specification. The resulting data -#' set `binned_adtte_subset` contains the subset of ADTTE selected by the time-to-event +#' This defines the server part for the `ADTTE` specification. The resulting data +#' set `binned_adtte_subset` contains the subset of `ADTTE` selected by the time-to-event #' endpoint, joined together with the gene information extracted from specified assay #' and experiment, as numeric and factor columns. The factor column is created by binning #' the numeric column according to the quantile cutoffs specified in `probs`. @@ -133,7 +133,7 @@ adtteSpecInput <- function(inputId, # nolint #' into. #' #' @return List with the following elements: -#' - `binned_adtte_subset`: reactive containing the joined ADTTE and gene data. +#' - `binned_adtte_subset`: reactive containing the joined `ADTTE` and gene data. #' - `gene_col`: reactive containing the string with the column name of the original #' numeric gene variable. #' - `gene_factor`: string with the variable name for the binned gene data. diff --git a/R/argument_convention.R b/R/argument_convention.R index 06f44ee9..ad264677 100644 --- a/R/argument_convention.R +++ b/R/argument_convention.R @@ -13,9 +13,9 @@ #' @param inputId (`string`)\cr #' the ID used to call the module input. #' @param adtte_name (`string`)\cr -#' name of the ADTTE dataset. +#' name of the `ADTTE` dataset. #' @param adtte_vars (named `list` of `string`)\cr -#' names of the variables to use in the ADTTE dataset. It should comprise elements: +#' names of the variables to use in the `ADTTE` dataset. It should comprise elements: #' - `aval`: the numeric time-to-event variable. #' - `avalu`: the variable holding the unit of `aval`. #' - `is_event`: the logical event variable. It needs to be `TRUE` @@ -63,7 +63,7 @@ NULL #' @param add (`AssertCollection` or `NULL`)\cr collection to store #' assertion messages, see [`checkmate::AssertCollection`]. #' @param info (`string`)\cr extra information to be included in the -#' message for the testthat reporter, see [testthat::expect_that()]. +#' message for the `testthat` reporter, see [testthat::expect_that()]. #' @param label (`string`)\cr name of the checked object to print in #' messages. Defaults to the heuristic implemented in [checkmate::vname()]. #' diff --git a/R/checkmate.R b/R/checkmate.R index 979363c5..717025d5 100644 --- a/R/checkmate.R +++ b/R/checkmate.R @@ -120,11 +120,11 @@ assert_summary_funs <- function(x, null.ok = FALSE) { # nolint # assert_adtte_vars ---- -#' Check for ADTTE Variables +#' Check for `ADTTE` Variables #' #' @description `r lifecycle::badge("experimental")` #' -#' Check whether `x` is a list of ADTTE variables. +#' Check whether `x` is a list of `ADTTE` variables. #' #' @inheritParams assertion_arguments #' @seealso [`assertions`] for more details. diff --git a/R/km.R b/R/km.R index 40baf460..963b503f 100644 --- a/R/km.R +++ b/R/km.R @@ -1,9 +1,9 @@ -#' Teal Module for Kaplan-Meier Plot +#' Teal Module for `Kaplan-Meier` Plot #' #' @description `r lifecycle::badge("experimental")` #' -#' This teal module produces a grid style Kaplan-Meier plot for data with -#' ADaM structure. +#' This teal module produces a grid style `Kaplan-Meier` plot for data with +#' `ADaM` structure. #' #' @inheritParams module_arguments #' diff --git a/README.md b/README.md index 9767350e..800c9660 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Code Coverage 📔](https://raw.githubusercontent.com/insightsengineering/teal.modules.hermes/_xml_coverage_reports/data/main/badge.svg)](https://raw.githubusercontent.com/insightsengineering/teal.modules.hermes/_xml_coverage_reports/data/main/coverage.xml) ![GitHub forks](https://img.shields.io/github/forks/insightsengineering/teal.modules.hermes?style=social) -![GitHub Repo stars](https://img.shields.io/github/stars/insightsengineering/teal.modules.hermes?style=social) +![GitHub repo stars](https://img.shields.io/github/stars/insightsengineering/teal.modules.hermes?style=social) ![GitHub commit activity](https://img.shields.io/github/commit-activity/m/insightsengineering/teal.modules.hermes) ![GitHub contributors](https://img.shields.io/github/contributors/insightsengineering/teal.modules.hermes) @@ -24,21 +24,21 @@ ### What is `teal`? `teal` is a shiny-based interactive exploration framework for analyzing clinical trials data. `teal` currently provides a dynamic filtering facility and diverse data viewers. `teal` shiny applications are built using standard [shiny modules](https://shiny.rstudio.com/articles/modules.html). -See [github](https://insightsengineering.github.io/teal) for more details. +See [`teal` page](https://insightsengineering.github.io/teal) for more details. ### What is `hermes`? `hermes` facilitates preprocessing, analyzing, and reporting of RNA-seq data. -The core functionality is built on the BioConductor ecosystem, especially the `SummarizedExperiment` class from which the `HermesData` class inherits. +The core functionality is built on the `BioConductor` ecosystem, especially the `SummarizedExperiment` class from which the `HermesData` class inherits. See the [vignette](https://insightsengineering.github.io/hermes/articles/hermes.html) for more details. ### So what is then `teal.modules.hermes`? -`teal.modules.hermes` provides `teal` modules (which can be used as part of any `teal` app), for interactive RNA-seq data analysis using `hermes`. Again it is heavily built on the BioConductor classes, in particular `MultiAssayExperiment` (MAE) which is expected to contain the `HermesData` experiments. +`teal.modules.hermes` provides `teal` modules (which can be used as part of any `teal` app), for interactive RNA-seq data analysis using `hermes`. Again it is heavily built on the `BioConductor` classes, in particular `MultiAssayExperiment` (MAE) which is expected to contain the `HermesData` experiments. ## Installation -For releases from August 2022 it is recommended that you [create and use a Github PAT](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) to install the latest version of this package. Once you have the PAT, run the following: +For releases from August 2022 it is recommended that you [create and use a GitHub PAT](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) to install the latest version of this package. Once you have the PAT, run the following: ```r Sys.setenv(GITHUB_PAT = "your_access_token_here") diff --git a/inst/WORDLIST b/inst/WORDLIST index 22fd530d..8d0da384 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,22 +1,13 @@ -ADTTE -ADaM -BioConductor Bové Forkers -Github -hoc Hoffmann -Kaplan Lyndsee Midori RNAseq -Repo Sabanés UI funder -github hermes pre reactives repo -testthat diff --git a/man/adtteSpecInput.Rd b/man/adtteSpecInput.Rd index 6161cd47..a1639a30 100644 --- a/man/adtteSpecInput.Rd +++ b/man/adtteSpecInput.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/adtteSpec.R \name{adtteSpecInput} \alias{adtteSpecInput} -\title{Module Input for ADTTE Specification} +\title{Module Input for \code{ADTTE} Specification} \usage{ adtteSpecInput(inputId, label_paramcd = "Select Endpoint") } @@ -18,7 +18,7 @@ The UI part. \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -This defines the input for the ADTTE specification. +This defines the input for the \code{ADTTE} specification. } \seealso{ \code{\link[=adtteSpecServer]{adtteSpecServer()}} for the module server and a complete example. diff --git a/man/adtteSpecServer.Rd b/man/adtteSpecServer.Rd index a06ef287..6e9d1221 100644 --- a/man/adtteSpecServer.Rd +++ b/man/adtteSpecServer.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/adtteSpec.R \name{adtteSpecServer} \alias{adtteSpecServer} -\title{Module Server for ADTTE Specification} +\title{Module Server for \code{ADTTE} Specification} \usage{ adtteSpecServer( id, @@ -28,10 +28,10 @@ functions, holding all the data sets provided in the app initialization.} name of the MAE data used in the teal module.} \item{adtte_name}{(\code{string})\cr -name of the ADTTE dataset.} +name of the \code{ADTTE} dataset.} \item{adtte_vars}{(named \code{list} of \code{string})\cr -names of the variables to use in the ADTTE dataset. It should comprise elements: +names of the variables to use in the \code{ADTTE} dataset. It should comprise elements: \itemize{ \item \code{aval}: the numeric time-to-event variable. \item \code{avalu}: the variable holding the unit of \code{aval}. @@ -57,7 +57,7 @@ into.} \value{ List with the following elements: \itemize{ -\item \code{binned_adtte_subset}: reactive containing the joined ADTTE and gene data. +\item \code{binned_adtte_subset}: reactive containing the joined \code{ADTTE} and gene data. \item \code{gene_col}: reactive containing the string with the column name of the original numeric gene variable. \item \code{gene_factor}: string with the variable name for the binned gene data. @@ -67,8 +67,8 @@ numeric gene variable. \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -This defines the server part for the ADTTE specification. The resulting data -set \code{binned_adtte_subset} contains the subset of ADTTE selected by the time-to-event +This defines the server part for the \code{ADTTE} specification. The resulting data +set \code{binned_adtte_subset} contains the subset of \code{ADTTE} selected by the time-to-event endpoint, joined together with the gene information extracted from specified assay and experiment, as numeric and factor columns. The factor column is created by binning the numeric column according to the quantile cutoffs specified in \code{probs}. diff --git a/man/assert_adtte_vars.Rd b/man/assert_adtte_vars.Rd index 3c9004ca..bdd4f61f 100644 --- a/man/assert_adtte_vars.Rd +++ b/man/assert_adtte_vars.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/checkmate.R \name{assert_adtte_vars} \alias{assert_adtte_vars} -\title{Check for ADTTE Variables} +\title{Check for \code{ADTTE} Variables} \usage{ assert_adtte_vars(x) } @@ -12,7 +12,7 @@ assert_adtte_vars(x) \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -Check whether \code{x} is a list of ADTTE variables. +Check whether \code{x} is a list of \code{ADTTE} variables. } \examples{ assert_adtte_vars(list(aval = "AV", is_event = "EV", paramcd = "PC", usubjid = "ID", avalu = "u")) diff --git a/man/assertion_arguments.Rd b/man/assertion_arguments.Rd index a498b36d..536ce555 100644 --- a/man/assertion_arguments.Rd +++ b/man/assertion_arguments.Rd @@ -15,7 +15,7 @@ assertions; defaults to the heuristic implemented in \code{\link[checkmate:vname assertion messages, see \code{\link[checkmate:AssertCollection]{checkmate::AssertCollection}}.} \item{info}{(\code{string})\cr extra information to be included in the -message for the testthat reporter, see \code{\link[testthat:expect_that]{testthat::expect_that()}}.} +message for the \code{testthat} reporter, see \code{\link[testthat:expect_that]{testthat::expect_that()}}.} \item{label}{(\code{string})\cr name of the checked object to print in messages. Defaults to the heuristic implemented in \code{\link[checkmate:vname]{checkmate::vname()}}.} diff --git a/man/check_tag.Rd b/man/check_tag.Rd index 5803414e..fd408af8 100644 --- a/man/check_tag.Rd +++ b/man/check_tag.Rd @@ -27,7 +27,7 @@ assertions; defaults to the heuristic implemented in \code{\link[checkmate:vname assertion messages, see \code{\link[checkmate:AssertCollection]{checkmate::AssertCollection}}.} \item{info}{(\code{string})\cr extra information to be included in the -message for the testthat reporter, see \code{\link[testthat:expect_that]{testthat::expect_that()}}.} +message for the \code{testthat} reporter, see \code{\link[testthat:expect_that]{testthat::expect_that()}}.} \item{label}{(\code{string})\cr name of the checked object to print in messages. Defaults to the heuristic implemented in \code{\link[checkmate:vname]{checkmate::vname()}}.} diff --git a/man/h_km_mae_to_adtte.Rd b/man/h_km_mae_to_adtte.Rd index 4a3d7609..2544e53f 100644 --- a/man/h_km_mae_to_adtte.Rd +++ b/man/h_km_mae_to_adtte.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/adtteSpec.R \name{h_km_mae_to_adtte} \alias{h_km_mae_to_adtte} -\title{Data Preprocessing for ADTTE Module} +\title{Data Preprocessing for \code{ADTTE} Module} \usage{ h_km_mae_to_adtte( adtte, diff --git a/man/module_arguments.Rd b/man/module_arguments.Rd index 8b912f0c..b0c34675 100644 --- a/man/module_arguments.Rd +++ b/man/module_arguments.Rd @@ -15,10 +15,10 @@ menu item label of the module in the teal app.} the ID used to call the module input.} \item{adtte_name}{(\code{string})\cr -name of the ADTTE dataset.} +name of the \code{ADTTE} dataset.} \item{adtte_vars}{(named \code{list} of \code{string})\cr -names of the variables to use in the ADTTE dataset. It should comprise elements: +names of the variables to use in the \code{ADTTE} dataset. It should comprise elements: \itemize{ \item \code{aval}: the numeric time-to-event variable. \item \code{avalu}: the variable holding the unit of \code{aval}. diff --git a/man/tm_g_forest_tte.Rd b/man/tm_g_forest_tte.Rd index 685a71fa..50d06fec 100644 --- a/man/tm_g_forest_tte.Rd +++ b/man/tm_g_forest_tte.Rd @@ -53,13 +53,13 @@ sample_tm_g_forest_tte() menu item label of the module in the teal app.} \item{adtte_name}{(\code{string})\cr -name of the ADTTE dataset.} +name of the \code{ADTTE} dataset.} \item{mae_name}{(\code{string})\cr name of the MAE data used in the teal module.} \item{adtte_vars}{(named \code{list} of \code{string})\cr -names of the variables to use in the ADTTE dataset. It should comprise elements: +names of the variables to use in the \code{ADTTE} dataset. It should comprise elements: \itemize{ \item \code{aval}: the numeric time-to-event variable. \item \code{avalu}: the variable holding the unit of \code{aval}. diff --git a/man/tm_g_km.Rd b/man/tm_g_km.Rd index 924b69f4..c56a28ba 100644 --- a/man/tm_g_km.Rd +++ b/man/tm_g_km.Rd @@ -5,7 +5,7 @@ \alias{ui_g_km} \alias{srv_g_km} \alias{sample_tm_g_km} -\title{Teal Module for Kaplan-Meier Plot} +\title{Teal Module for \code{Kaplan-Meier} Plot} \usage{ tm_g_km( label, @@ -41,13 +41,13 @@ sample_tm_g_km() menu item label of the module in the teal app.} \item{adtte_name}{(\code{string})\cr -name of the ADTTE dataset.} +name of the \code{ADTTE} dataset.} \item{mae_name}{(\code{string})\cr name of the MAE data used in the teal module.} \item{adtte_vars}{(named \code{list} of \code{string})\cr -names of the variables to use in the ADTTE dataset. It should comprise elements: +names of the variables to use in the \code{ADTTE} dataset. It should comprise elements: \itemize{ \item \code{aval}: the numeric time-to-event variable. \item \code{avalu}: the variable holding the unit of \code{aval}. @@ -89,8 +89,8 @@ Shiny module to be used in the teal app. \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -This teal module produces a grid style Kaplan-Meier plot for data with -ADaM structure. +This teal module produces a grid style \code{Kaplan-Meier} plot for data with +\code{ADaM} structure. } \section{Functions}{ \itemize{ diff --git a/tests/testthat/setup-skip_if_too_deep.R b/tests/testthat/setup-skip_if_too_deep.R index 89205740..6467ab93 100644 --- a/tests/testthat/setup-skip_if_too_deep.R +++ b/tests/testthat/setup-skip_if_too_deep.R @@ -22,7 +22,7 @@ testing_depth <- function() { # nolint # nousage testing_depth } -#' Skipping tests in the testthat pipeline under specific scope +#' Skipping tests in the `testthat` pipeline under specific scope #' @description This function should be used per each \code{testthat::test_that} call. #' Each of the call should specify an appropriate depth value. #' The depth value will set the appropriate scope so more/less time consuming tests could be recognized. From 3d0566b6219adf1d0e7e1ac884338ebe67fa2c19 Mon Sep 17 00:00:00 2001 From: m7pr Date: Tue, 7 Nov 2023 15:47:12 +0100 Subject: [PATCH 02/27] TealData to teal_data substitution todo - fix joni keys --- design/design_km.Rmd | 40 ++++++++++++------------------- design/design_survival_forest.Rmd | 13 +++++----- design/mae_cdisc_example.R | 30 ++++++++++------------- 3 files changed, 34 insertions(+), 49 deletions(-) diff --git a/design/design_km.Rmd b/design/design_km.Rmd index 1cc103d8..82a31b87 100644 --- a/design/design_km.Rmd +++ b/design/design_km.Rmd @@ -140,36 +140,26 @@ library(teal) library(hermes) library(random.cdisc.data) library(dplyr) -adsl <- cdisc_dataset("ADSL", radsl(cached = TRUE, na_percentage = 0.2)) %>% - mutate_dataset( - "ADSL$SEX[1:20] <- NA - ADSL$AGE[21:30] <- Inf - ADSL$AGE[31:40] <- NaN - ADSL$EOSDT[51:60] <- NA - ADSL$EOSDT[71:70] <- NA - ADSL$all_na <- NA - ADSL$unknown <- as.list(ADSL$SEX)" - ) -adtte <- cdisc_dataset("ADTTE", radtte(cached = TRUE, seed = 1)) %>% - mutate_dataset( - "ADTTE$CNSR <- as.logical(ADTTE$CNSR) - ADTTE$CNSR[100:110] <- NA" - ) -mae <- multi_assay_experiment # from hermes -mae <- dataset("MAE", mae) +adsl = radsl(cached = TRUE, na_percentage = 0.2) +adsl$SEX[1:20] <- NA +adsl$AGE[21:30] <- Inf +adsl$AGE[31:40] <- NaN +adsl$EOSDT[51:60] <- NA +adsl$EOSDT[71:70] <- NA +adsl$all_na <- NA +adsl$unknown <- as.list(ADSL$SEX) + +adtte = radtte(cached = TRUE, seed = 1) +adtte$CNSR <- as.logical(ADTTE$CNSR) +adtte$CNSR[100:110] <- NA -adtte <- radtte(cached = TRUE, seed = 1) %>% - mutate( - "ADTTE$CNSR <- as.logical(ADTTE$CNSR) - ADTTE$CNSR[100:110] <- NA" - ) +mae <- multi_assay_experiment # from hermes choices_endpoints <- levels(adtte$PARAMCD) - -data <- teal_data(mae, adsl, adtte) %>% - mutate_join_keys("MAE", "MAE", c("STUDYID", "USUBJID")) +data <- teal_data(MAE = mae, ADSL = adsl, ADTTE = adtte) %>% + mutate_join_keys("MAE", "MAE", c("STUDYID", "USUBJID")) # TODO: to be fixed ``` ## App Launch diff --git a/design/design_survival_forest.Rmd b/design/design_survival_forest.Rmd index d97d18fb..3a0e130f 100644 --- a/design/design_survival_forest.Rmd +++ b/design/design_survival_forest.Rmd @@ -24,17 +24,16 @@ We want to design a simple survival forest plot teal module. ## General module workflow ```{r} -# Example ADSL data converted into a CDISCDataset object. -adsl <- cdisc_dataset("ADSL", ex_adsl) +# Example ADSL data +adsl <- ex_adsl -# Example ADTTE data converted into a CDISCDataset object. -adtte <- cdisc_dataset("ADTTE", ex_adtte) +# Example ADTTE data +adtte <- ex_adtte # Example MAE data and merge datasets. MAE <- multi_assay_experiment -mae <- dataset("MAE", MAE) -data <- teal_data(mae, adsl, adtte) %>% - mutate_join_keys("MAE", "MAE", c("STUDYID", "USUBJID")) +data <- teal_data(MAE = mae, ADSL = ex_adsl, ADTTE = ex_adtte) %>% + mutate_join_keys("MAE", "MAE", c("STUDYID", "USUBJID")) # TODO: to be fixed # Get raw ADTTE. adtte_raw <- get_raw_data(adtte) diff --git a/design/mae_cdisc_example.R b/design/mae_cdisc_example.R index 0135ea73..88700e89 100644 --- a/design/mae_cdisc_example.R +++ b/design/mae_cdisc_example.R @@ -95,27 +95,23 @@ srv_made_up_merge_pr <- function(input, output, session, datasets, dataname) { library(teal) library(hermes) library(random.cdisc.data) -adsl <- cdisc_dataset("ADSL", radsl(cached = TRUE, na_percentage = 0.2)) %>% - mutate_dataset( - "ADSL$SEX[1:20] <- NA - ADSL$AGE[21:30] <- Inf - ADSL$AGE[31:40] <- NaN - ADSL$EOSDT[51:60] <- NA - ADSL$EOSDT[71:70] <- NA - ADSL$all_na <- NA - ADSL$unknown <- as.list(ADSL$SEX)" - ) -adtte <- cdisc_dataset("ADTTE", radtte(cached = TRUE)) %>% - mutate_dataset( - "ADTTE$CNSR <- as.logical(ADTTE$CNSR) - ADTTE$CNSR[100:110] <- NA" - ) +adsl = radsl(cached = TRUE, na_percentage = 0.2) +adsl$SEX[1:20] <- NA +adsl$AGE[21:30] <- Inf +adsl$AGE[31:40] <- NaN +adsl$EOSDT[51:60] <- NA +adsl$EOSDT[71:70] <- NA +adsl$all_na <- NA +adsl$unknown <- as.list(ADSL$SEX) +adtte = radtte(cached = TRUE) +adtte$CNSR <- as.logical(ADTTE$CNSR) +adtte$CNSR[100:110] <- NA mae <- multi_assay_experiment # from hermes -data <- cdisc_data(dataset("MAE", mae), adsl, adtte) %>% - mutate_join_keys("MAE", "MAE", c("STUDYID", "USUBJID")) +data <- cdisc_data(MAE = mae, ADSL = adsl, ADTTE = adtte) %>% + mutate_join_keys("MAE", "MAE", c("STUDYID", "USUBJID")) # TODO: to be fixed app <- init( data = data, From 49dd4c821f95ef6e89e98e5885fcdd82bb579931 Mon Sep 17 00:00:00 2001 From: m7pr Date: Tue, 7 Nov 2023 15:59:13 +0100 Subject: [PATCH 03/27] fix joinkeys --- design/design_km.Rmd | 10 ++++++++-- design/design_survival_forest.Rmd | 8 ++++++-- design/mae_cdisc_example.R | 8 ++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/design/design_km.Rmd b/design/design_km.Rmd index 82a31b87..72a3f6f8 100644 --- a/design/design_km.Rmd +++ b/design/design_km.Rmd @@ -158,8 +158,14 @@ mae <- multi_assay_experiment # from hermes choices_endpoints <- levels(adtte$PARAMCD) -data <- teal_data(MAE = mae, ADSL = adsl, ADTTE = adtte) %>% - mutate_join_keys("MAE", "MAE", c("STUDYID", "USUBJID")) # TODO: to be fixed +data <- teal_data(MAE = mae, ADSL = adsl, ADTTE = adtte) + +datanames <- datanames(data) +data@join_keys <- cdisc_join_keys(!!!datanames) +data@join_keys$mutate( + "MAE", "MAE", c("STUDYID", "USUBJID") +) + ``` ## App Launch diff --git a/design/design_survival_forest.Rmd b/design/design_survival_forest.Rmd index 3a0e130f..7c72e948 100644 --- a/design/design_survival_forest.Rmd +++ b/design/design_survival_forest.Rmd @@ -32,8 +32,12 @@ adtte <- ex_adtte # Example MAE data and merge datasets. MAE <- multi_assay_experiment -data <- teal_data(MAE = mae, ADSL = ex_adsl, ADTTE = ex_adtte) %>% - mutate_join_keys("MAE", "MAE", c("STUDYID", "USUBJID")) # TODO: to be fixed +data <- teal_data(MAE = mae, ADSL = ex_adsl, ADTTE = ex_adtte) +datanames <- datanames(data) +data@join_keys <- cdisc_join_keys(!!!datanames) +data@join_keys$mutate( + "MAE", "MAE", c("STUDYID", "USUBJID") +) # Get raw ADTTE. adtte_raw <- get_raw_data(adtte) diff --git a/design/mae_cdisc_example.R b/design/mae_cdisc_example.R index 88700e89..16d9847c 100644 --- a/design/mae_cdisc_example.R +++ b/design/mae_cdisc_example.R @@ -110,8 +110,12 @@ adtte$CNSR[100:110] <- NA mae <- multi_assay_experiment # from hermes -data <- cdisc_data(MAE = mae, ADSL = adsl, ADTTE = adtte) %>% - mutate_join_keys("MAE", "MAE", c("STUDYID", "USUBJID")) # TODO: to be fixed +data <- cdisc_data(MAE = mae, ADSL = adsl, ADTTE = adtte) +datanames <- datanames(data) +data@join_keys <- cdisc_join_keys(!!!datanames) +data@join_keys$mutate( + "MAE", "MAE", c("STUDYID", "USUBJID") +) app <- init( data = data, From 5a5e1219c6edea843ad33f1f635b34173df99d56 Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 8 Nov 2023 11:10:05 +0100 Subject: [PATCH 04/27] update NEWS --- NEWS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS.md b/NEWS.md index d1fa9c93..fd6a1a7b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,10 @@ * Added placeholders for `assaySpec`, `adtteSpec` and `geneSpec` inputs when no option is selected. * Disabled the select input for `assaySpec` and `adtteSpec` when there are no options available. +### Enhancements + +* Updated the documentation and vignettes with the new way of specifying data for `teal::init()`. The `data` argument accepts `teal_data` object. + # teal.modules.hermes 0.1.5 ### Bug Fixes From 33f85ef21e4f0b1547100cc56063a43493b978fe Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 8 Nov 2023 11:43:50 +0100 Subject: [PATCH 05/27] rebuild examples --- R/assaySpec.R | 5 +---- R/barplot.R | 4 +--- R/boxplot.R | 4 +--- R/experimentSpec.R | 5 +---- R/forestplot.R | 11 ++++------- R/geneSpec.R | 4 +--- R/km.R | 11 ++++------- R/pca.R | 4 +--- R/quality.R | 4 +--- R/sampleVarSpec.R | 4 +--- R/scatterplot.R | 4 +--- R/volcanoplot.R | 4 +--- man/assaySpecServer.Rd | 5 +---- man/experimentSpecServer.Rd | 5 +---- man/geneSpecServer.Rd | 4 +--- man/sampleVarSpecServer.Rd | 4 +--- man/tm_g_barplot.Rd | 4 +--- man/tm_g_boxplot.Rd | 4 +--- man/tm_g_forest_tte.Rd | 11 ++++------- man/tm_g_km.Rd | 11 ++++------- man/tm_g_pca.Rd | 4 +--- man/tm_g_quality.Rd | 4 +--- man/tm_g_scatterplot.Rd | 4 +--- man/tm_g_volcanoplot.Rd | 4 +--- 24 files changed, 36 insertions(+), 92 deletions(-) diff --git a/R/assaySpec.R b/R/assaySpec.R index 9c72ab7d..df4122ce 100644 --- a/R/assaySpec.R +++ b/R/assaySpec.R @@ -83,10 +83,7 @@ assaySpecInput <- function(inputId, # nolint #' } #' #' my_app <- function() { -#' mae <- hermes::multi_assay_experiment -#' mae_name <- "MAE" -#' mae_data <- dataset(mae_name, mae) -#' data <- teal_data(mae_data) +#' data <- teal_data(MAE = hermes::multi_assay_experiment) #' app <- init( #' data = data, #' modules = modules( diff --git a/R/barplot.R b/R/barplot.R index 02b92944..e858c192 100644 --- a/R/barplot.R +++ b/R/barplot.R @@ -12,9 +12,7 @@ #' @export #' #' @examples -#' mae <- hermes::multi_assay_experiment -#' mae_data <- dataset("MAE", mae) -#' data <- teal_data(mae_data) +#' data <- teal_data(MAE = hermes::multi_assay_experiment) #' app <- init( #' data = data, #' modules = modules( diff --git a/R/boxplot.R b/R/boxplot.R index cbc8e397..a915ce89 100644 --- a/R/boxplot.R +++ b/R/boxplot.R @@ -12,9 +12,7 @@ #' @export #' #' @examples -#' mae <- hermes::multi_assay_experiment -#' mae_data <- dataset("MAE", mae) -#' data <- teal_data(mae_data) +#' data <- teal_data(MAE = hermes::multi_assay_experiment) #' app <- init( #' data = data, #' modules = modules( diff --git a/R/experimentSpec.R b/R/experimentSpec.R index 73640e1c..4386dcd2 100644 --- a/R/experimentSpec.R +++ b/R/experimentSpec.R @@ -183,10 +183,7 @@ h_gene_data <- function(object, name_annotation) { #' } #' #' my_app <- function() { -#' mae <- hermes::multi_assay_experiment -#' mae_name <- "MAE" -#' mae_data <- dataset(mae_name, mae) -#' data <- teal_data(mae_data) +#' data <- teal_data(MAE = hermes::multi_assay_experiment) #' app <- init( #' data = data, #' modules = modules( diff --git a/R/forestplot.R b/R/forestplot.R index d4cda342..04f94eb8 100644 --- a/R/forestplot.R +++ b/R/forestplot.R @@ -11,18 +11,15 @@ #' @export #' #' @examples -#' mae <- hermes::multi_assay_experiment #' adtte <- teal.modules.hermes::rADTTE %>% #' dplyr::mutate(is_event = (.data$CNSR == 0)) #' #' data <- teal_data( -#' dataset( -#' "ADTTE", -#' adtte, -#' code = "adtte <- teal.modules.hermes::rADTTE %>% +#' ADTTE = adtte, +#' MAE = hermes::multi_assay_experiment, +#' code = +#' "adtte <- teal.modules.hermes::rADTTE %>% #' dplyr::mutate(is_event = (.data$CNSR == 0))" -#' ), -#' dataset("MAE", mae) #' ) #' app <- init( #' data = data, diff --git a/R/geneSpec.R b/R/geneSpec.R index f6ea0b9f..77239bc8 100644 --- a/R/geneSpec.R +++ b/R/geneSpec.R @@ -266,9 +266,7 @@ h_parse_genes <- function(words, choices) { #' } #' funs <- list(mean = colMeans) #' my_app <- function() { -#' mae <- hermes::multi_assay_experiment -#' mae_data <- dataset("MAE", mae) -#' data <- teal_data(mae_data) +#' data <- teal_data(MAE = hermes::multi_assay_experiment) #' app <- init( #' data = data, #' modules = modules( diff --git a/R/km.R b/R/km.R index 23de5f87..3dcd27cc 100644 --- a/R/km.R +++ b/R/km.R @@ -12,18 +12,15 @@ #' @export #' #' @examples -#' mae <- hermes::multi_assay_experiment #' adtte <- teal.modules.hermes::rADTTE %>% #' dplyr::mutate(is_event = (.data$CNSR == 0)) #' #' data <- teal_data( -#' dataset( -#' "ADTTE", -#' adtte, -#' code = "adtte <- teal.modules.hermes::rADTTE %>% +#' ADTTE = adtte, +#' MAE = hermes::multi_assay_experiment, +#' code = +#' "adtte <- teal.modules.hermes::rADTTE %>% #' dplyr::mutate(is_event = (.data$CNSR == 0))" -#' ), -#' dataset("MAE", mae) #' ) #' #' modules <- modules( diff --git a/R/pca.R b/R/pca.R index fb1dbcfa..b43ca736 100644 --- a/R/pca.R +++ b/R/pca.R @@ -12,9 +12,7 @@ #' @export #' #' @examples -#' mae <- hermes::multi_assay_experiment -#' mae_data <- dataset("MAE", mae) -#' data <- teal_data(mae_data) +#' data <- teal_data(MAE = hermes::multi_assay_experiment) #' app <- init( #' data = data, #' modules = modules( diff --git a/R/quality.R b/R/quality.R index 31c32624..aaae0b7e 100644 --- a/R/quality.R +++ b/R/quality.R @@ -66,9 +66,7 @@ heatmap_plot <- function(object, assay_name) { #' @export #' #' @examples -#' mae <- hermes::multi_assay_experiment -#' mae_data <- dataset("MAE", mae) -#' data <- teal_data(mae_data) +#' data <- teal_data(MAE = hermes::multi_assay_experiment) #' app <- init( #' data = data, #' modules = modules( diff --git a/R/sampleVarSpec.R b/R/sampleVarSpec.R index 35430607..9b09fa0c 100644 --- a/R/sampleVarSpec.R +++ b/R/sampleVarSpec.R @@ -245,9 +245,7 @@ validate_n_levels <- function(x, name, n_levels) { #' }) #' } #' my_app <- function() { -#' mae <- hermes::multi_assay_experiment -#' mae_data <- dataset("MAE", mae) -#' data <- teal_data(mae_data) +#' data <- teal_data(MAE = hermes::multi_assay_experiment) #' app <- init( #' data = data, #' modules = modules( diff --git a/R/scatterplot.R b/R/scatterplot.R index 0ea51c93..2f6bebf2 100644 --- a/R/scatterplot.R +++ b/R/scatterplot.R @@ -12,9 +12,7 @@ #' @export #' #' @examples -#' mae <- hermes::multi_assay_experiment -#' mae_data <- dataset("MAE", mae) -#' data <- teal_data(mae_data) +#' data <- teal_data(MAE = hermes::multi_assay_experiment) #' app <- init( #' data = data, #' modules = modules( diff --git a/R/volcanoplot.R b/R/volcanoplot.R index 6b316b4e..a880a408 100644 --- a/R/volcanoplot.R +++ b/R/volcanoplot.R @@ -12,9 +12,7 @@ #' @export #' #' @examples -#' mae <- hermes::multi_assay_experiment -#' mae_data <- dataset("MAE", mae) -#' data <- teal_data(mae_data) +#' data <- teal_data(MAE = hermes::multi_assay_experiment) #' app <- init( #' data = data, #' modules = modules( diff --git a/man/assaySpecServer.Rd b/man/assaySpecServer.Rd index 7846df46..192807eb 100644 --- a/man/assaySpecServer.Rd +++ b/man/assaySpecServer.Rd @@ -62,10 +62,7 @@ server <- function(id, data, filter_panel_api) { } my_app <- function() { - mae <- hermes::multi_assay_experiment - mae_name <- "MAE" - mae_data <- dataset(mae_name, mae) - data <- teal_data(mae_data) + data <- teal_data(MAE = hermes::multi_assay_experiment) app <- init( data = data, modules = modules( diff --git a/man/experimentSpecServer.Rd b/man/experimentSpecServer.Rd index 782755f4..a645e9c2 100644 --- a/man/experimentSpecServer.Rd +++ b/man/experimentSpecServer.Rd @@ -107,10 +107,7 @@ server <- function(id, } my_app <- function() { - mae <- hermes::multi_assay_experiment - mae_name <- "MAE" - mae_data <- dataset(mae_name, mae) - data <- teal_data(mae_data) + data <- teal_data(MAE = hermes::multi_assay_experiment) app <- init( data = data, modules = modules( diff --git a/man/geneSpecServer.Rd b/man/geneSpecServer.Rd index 25f64229..ba91c62c 100644 --- a/man/geneSpecServer.Rd +++ b/man/geneSpecServer.Rd @@ -83,9 +83,7 @@ server <- function(id, } funs <- list(mean = colMeans) my_app <- function() { - mae <- hermes::multi_assay_experiment - mae_data <- dataset("MAE", mae) - data <- teal_data(mae_data) + data <- teal_data(MAE = hermes::multi_assay_experiment) app <- init( data = data, modules = modules( diff --git a/man/sampleVarSpecServer.Rd b/man/sampleVarSpecServer.Rd index 840bf718..11dc042f 100644 --- a/man/sampleVarSpecServer.Rd +++ b/man/sampleVarSpecServer.Rd @@ -102,9 +102,7 @@ server <- function(id, }) } my_app <- function() { - mae <- hermes::multi_assay_experiment - mae_data <- dataset("MAE", mae) - data <- teal_data(mae_data) + data <- teal_data(MAE = hermes::multi_assay_experiment) app <- init( data = data, modules = modules( diff --git a/man/tm_g_barplot.Rd b/man/tm_g_barplot.Rd index 583e142a..a70d2927 100644 --- a/man/tm_g_barplot.Rd +++ b/man/tm_g_barplot.Rd @@ -81,9 +81,7 @@ analysis. }} \examples{ -mae <- hermes::multi_assay_experiment -mae_data <- dataset("MAE", mae) -data <- teal_data(mae_data) +data <- teal_data(MAE = hermes::multi_assay_experiment) app <- init( data = data, modules = modules( diff --git a/man/tm_g_boxplot.Rd b/man/tm_g_boxplot.Rd index 9d9dc603..3da1f6fe 100644 --- a/man/tm_g_boxplot.Rd +++ b/man/tm_g_boxplot.Rd @@ -81,9 +81,7 @@ analysis. }} \examples{ -mae <- hermes::multi_assay_experiment -mae_data <- dataset("MAE", mae) -data <- teal_data(mae_data) +data <- teal_data(MAE = hermes::multi_assay_experiment) app <- init( data = data, modules = modules( diff --git a/man/tm_g_forest_tte.Rd b/man/tm_g_forest_tte.Rd index e12c6f80..5aef038f 100644 --- a/man/tm_g_forest_tte.Rd +++ b/man/tm_g_forest_tte.Rd @@ -119,18 +119,15 @@ This module provides an interactive survival forest plot. }} \examples{ -mae <- hermes::multi_assay_experiment adtte <- teal.modules.hermes::rADTTE \%>\% dplyr::mutate(is_event = (.data$CNSR == 0)) data <- teal_data( - dataset( - "ADTTE", - adtte, - code = "adtte <- teal.modules.hermes::rADTTE \%>\% + ADTTE = adtte, + MAE = hermes::multi_assay_experiment, + code = + "adtte <- teal.modules.hermes::rADTTE \%>\% dplyr::mutate(is_event = (.data$CNSR == 0))" - ), - dataset("MAE", mae) ) app <- init( data = data, diff --git a/man/tm_g_km.Rd b/man/tm_g_km.Rd index 9bad0da5..fe166ac8 100644 --- a/man/tm_g_km.Rd +++ b/man/tm_g_km.Rd @@ -102,18 +102,15 @@ This teal module produces a grid style \code{Kaplan-Meier} plot for data with }} \examples{ -mae <- hermes::multi_assay_experiment adtte <- teal.modules.hermes::rADTTE \%>\% dplyr::mutate(is_event = (.data$CNSR == 0)) data <- teal_data( - dataset( - "ADTTE", - adtte, - code = "adtte <- teal.modules.hermes::rADTTE \%>\% + ADTTE = adtte, + MAE = hermes::multi_assay_experiment, + code = + "adtte <- teal.modules.hermes::rADTTE \%>\% dplyr::mutate(is_event = (.data$CNSR == 0))" - ), - dataset("MAE", mae) ) modules <- modules( diff --git a/man/tm_g_pca.Rd b/man/tm_g_pca.Rd index 803be026..d0a95518 100644 --- a/man/tm_g_pca.Rd +++ b/man/tm_g_pca.Rd @@ -68,9 +68,7 @@ variables. }} \examples{ -mae <- hermes::multi_assay_experiment -mae_data <- dataset("MAE", mae) -data <- teal_data(mae_data) +data <- teal_data(MAE = hermes::multi_assay_experiment) app <- init( data = data, modules = modules( diff --git a/man/tm_g_quality.Rd b/man/tm_g_quality.Rd index cd2a888f..f3020027 100644 --- a/man/tm_g_quality.Rd +++ b/man/tm_g_quality.Rd @@ -68,9 +68,7 @@ for RNA-seq gene expression quality control. }} \examples{ -mae <- hermes::multi_assay_experiment -mae_data <- dataset("MAE", mae) -data <- teal_data(mae_data) +data <- teal_data(MAE = hermes::multi_assay_experiment) app <- init( data = data, modules = modules( diff --git a/man/tm_g_scatterplot.Rd b/man/tm_g_scatterplot.Rd index 90872e7f..5160aeae 100644 --- a/man/tm_g_scatterplot.Rd +++ b/man/tm_g_scatterplot.Rd @@ -81,9 +81,7 @@ analysis. }} \examples{ -mae <- hermes::multi_assay_experiment -mae_data <- dataset("MAE", mae) -data <- teal_data(mae_data) +data <- teal_data(MAE = hermes::multi_assay_experiment) app <- init( data = data, modules = modules( diff --git a/man/tm_g_volcanoplot.Rd b/man/tm_g_volcanoplot.Rd index a99f21b3..cbf83332 100644 --- a/man/tm_g_volcanoplot.Rd +++ b/man/tm_g_volcanoplot.Rd @@ -74,9 +74,7 @@ analysis. }} \examples{ -mae <- hermes::multi_assay_experiment -mae_data <- dataset("MAE", mae) -data <- teal_data(mae_data) +data <- teal_data(MAE = hermes::multi_assay_experiment) app <- init( data = data, modules = modules( From 6c2ed190f82e53218cfc3645acd6777c1282b2ef Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 8 Nov 2023 11:54:25 +0100 Subject: [PATCH 06/27] fix one more example --- R/adtteSpec.R | 11 ++++------- man/adtteSpecServer.Rd | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/R/adtteSpec.R b/R/adtteSpec.R index 5feca2a3..e7b13390 100644 --- a/R/adtteSpec.R +++ b/R/adtteSpec.R @@ -208,18 +208,15 @@ adtteSpecInput <- function(inputId, # nolint #' } #' #' my_app <- function() { -#' mae <- hermes::multi_assay_experiment #' adtte <- teal.modules.hermes::rADTTE %>% #' dplyr::mutate(is_event = .data$CNSR == 0) #' #' data <- teal_data( -#' dataset( -#' "ADTTE", -#' adtte, -#' code = "adtte <- teal.modules.hermes::rADTTE +#' ADTTE = adtte, +#' MAE = hermes::multi_assay_experiment, +#' code = +#' "adtte <- teal.modules.hermes::rADTTE #' dplyr::mutate(is_event = .data$CNSR == 0)" -#' ), -#' dataset("MAE", mae) #' ) #' #' app <- init( diff --git a/man/adtteSpecServer.Rd b/man/adtteSpecServer.Rd index 33411090..6502ba37 100644 --- a/man/adtteSpecServer.Rd +++ b/man/adtteSpecServer.Rd @@ -134,18 +134,15 @@ server <- function(id, data, filter_panel_api) { } my_app <- function() { - mae <- hermes::multi_assay_experiment adtte <- teal.modules.hermes::rADTTE \%>\% dplyr::mutate(is_event = .data$CNSR == 0) data <- teal_data( - dataset( - "ADTTE", - adtte, - code = "adtte <- teal.modules.hermes::rADTTE + ADTTE = adtte, + MAE = hermes::multi_assay_experiment, + code = + "adtte <- teal.modules.hermes::rADTTE dplyr::mutate(is_event = .data$CNSR == 0)" - ), - dataset("MAE", mae) ) app <- init( From afc314a5785818b0c5bde3f8590f336bf1500f4f Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 8 Nov 2023 12:08:21 +0100 Subject: [PATCH 07/27] few more teal_data changes --- R/adtteSpec.R | 1 + R/barplot.R | 4 +--- R/boxplot.R | 4 +--- R/experimentSpec.R | 4 ++-- R/forestplot.R | 17 +++++++---------- R/km.R | 13 +++++-------- R/pca.R | 4 +--- R/quality.R | 4 +--- R/scatterplot.R | 4 +--- R/volcanoplot.R | 4 +--- man/experimentSpecServer.Rd | 4 ++-- tests/testthat/adtteSpec/app.R | 17 +++++++---------- tests/testthat/assaySpec/app.R | 5 +---- tests/testthat/experimentSpec/app.R | 5 +---- tests/testthat/geneSpec/app.R | 4 +--- tests/testthat/sampleVarSpec/app.R | 4 +--- 16 files changed, 34 insertions(+), 64 deletions(-) diff --git a/R/adtteSpec.R b/R/adtteSpec.R index e7b13390..89ac4fc3 100644 --- a/R/adtteSpec.R +++ b/R/adtteSpec.R @@ -393,3 +393,4 @@ adtteSpecServer <- function(id, # nolint ) }) } + diff --git a/R/barplot.R b/R/barplot.R index e858c192..a9946174 100644 --- a/R/barplot.R +++ b/R/barplot.R @@ -244,9 +244,7 @@ srv_g_barplot <- function(id, #' sample_tm_g_barplot() #' } sample_tm_g_barplot <- function() { - mae <- hermes::multi_assay_experiment - mae_data <- teal.data::dataset("MAE", mae) - data <- teal.data::teal_data(mae_data) + data <- teal.data::teal_data(MAE = hermes::multi_assay_experiment) app <- teal::init( data = data, modules = teal::modules( diff --git a/R/boxplot.R b/R/boxplot.R index a915ce89..ac703eee 100644 --- a/R/boxplot.R +++ b/R/boxplot.R @@ -245,9 +245,7 @@ srv_g_boxplot <- function(id, #' sample_tm_g_boxplot() #' } sample_tm_g_boxplot <- function() { - mae <- hermes::multi_assay_experiment - mae_data <- teal.data::dataset("MAE", mae) - data <- teal.data::teal_data(mae_data) + data <- teal.data::teal_data(MAE = hermes::multi_assay_experiment) app <- teal::init( data = data, modules = teal::modules( diff --git a/R/experimentSpec.R b/R/experimentSpec.R index 4386dcd2..8963578c 100644 --- a/R/experimentSpec.R +++ b/R/experimentSpec.R @@ -190,9 +190,9 @@ h_gene_data <- function(object, name_annotation) { #' module( #' label = "experimentSpec example", #' server = server, -#' server_args = list(mae_name = mae_name), +#' server_args = list(mae_name = "MAE"), #' ui = ui, -#' ui_args = list(mae_name = mae_name), +#' ui_args = list(mae_name = "MAE"), #' datanames = "all" #' ) #' ) diff --git a/R/forestplot.R b/R/forestplot.R index 04f94eb8..0bbc1aaa 100644 --- a/R/forestplot.R +++ b/R/forestplot.R @@ -284,18 +284,15 @@ srv_g_forest_tte <- function(id, #' } sample_tm_g_forest_tte <- function() { # nolint - mae <- hermes::multi_assay_experiment adtte <- teal.modules.hermes::rADTTE %>% - dplyr::mutate(is_event = .data$CNSR == 0) + dplyr::mutate(is_event = (.data$CNSR == 0)) - data <- teal.data::teal_data( - teal.data::dataset( - "ADTTE", - adtte, - code = "adtte <- teal.modules.hermes::rADTTE %>% - dplyr::mutate(is_event = .data$CNSR == 0)" - ), - teal.data::dataset("MAE", mae) + data <- teal_data( + ADTTE = adtte, + MAE = hermes::multi_assay_experiment, + code = + "adtte <- teal.modules.hermes::rADTTE %>% + dplyr::mutate(is_event = (.data$CNSR == 0))" ) app <- teal::init( diff --git a/R/km.R b/R/km.R index 3dcd27cc..72a64953 100644 --- a/R/km.R +++ b/R/km.R @@ -276,18 +276,15 @@ srv_g_km <- function(id, #' } sample_tm_g_km <- function() { # nolint - mae <- hermes::multi_assay_experiment adtte <- teal.modules.hermes::rADTTE %>% dplyr::mutate(is_event = (.data$CNSR == 0)) - data <- teal.data::teal_data( - teal.data::dataset( - "ADTTE", - adtte, - code = "adtte <- teal.modules.hermes::rADTTE %>% + data <- teal_data( + ADTTE = adtte, + MAE = hermes::multi_assay_experiment, + code = + "adtte <- teal.modules.hermes::rADTTE %>% dplyr::mutate(is_event = (.data$CNSR == 0))" - ), - teal.data::dataset("MAE", mae) ) modules <- teal::modules( diff --git a/R/pca.R b/R/pca.R index b43ca736..787c015e 100644 --- a/R/pca.R +++ b/R/pca.R @@ -449,9 +449,7 @@ srv_g_pca <- function(id, #' sample_tm_g_pca() #' } sample_tm_g_pca <- function() { - mae <- hermes::multi_assay_experiment - mae_data <- teal.data::dataset("MAE", mae) - data <- teal.data::teal_data(mae_data) + data <- teal.data::teal_data(MAE = hermes::multi_assay_experiment) app <- teal::init( data = data, modules = teal::modules( diff --git a/R/quality.R b/R/quality.R index aaae0b7e..ddae3b69 100644 --- a/R/quality.R +++ b/R/quality.R @@ -416,9 +416,7 @@ srv_g_quality <- function(id, #' sample_tm_g_quality() #' } sample_tm_g_quality <- function() { - mae <- hermes::multi_assay_experiment - mae_data <- teal.data::dataset("MAE", mae) - data <- teal.data::teal_data(mae_data) + data <- teal.data::teal_data(MAE = hermes::multi_assay_experiment) app <- teal::init( data = data, modules = teal::modules( diff --git a/R/scatterplot.R b/R/scatterplot.R index 2f6bebf2..e98beff0 100644 --- a/R/scatterplot.R +++ b/R/scatterplot.R @@ -243,9 +243,7 @@ srv_g_scatterplot <- function(id, #' sample_tm_g_scatterplot() #' } sample_tm_g_scatterplot <- function() { - mae <- hermes::multi_assay_experiment - mae_data <- teal.data::dataset("MAE", mae) - data <- teal.data::teal_data(mae_data) + data <- teal.data::teal_data(MAE = hermes::multi_assay_experiment) app <- teal::init( data = data, modules = teal::modules( diff --git a/R/volcanoplot.R b/R/volcanoplot.R index a880a408..3617575c 100644 --- a/R/volcanoplot.R +++ b/R/volcanoplot.R @@ -265,9 +265,7 @@ srv_g_volcanoplot <- function(id, #' sample_tm_g_volcanoplot() #' } sample_tm_g_volcanoplot <- function() { - mae <- hermes::multi_assay_experiment - mae_data <- teal.data::dataset("MAE", mae) - data <- teal.data::teal_data(mae_data) + data <- teal.data::teal_data(MAE = hermes::multi_assay_experiment) app <- teal::init( data = data, modules = teal::modules( diff --git a/man/experimentSpecServer.Rd b/man/experimentSpecServer.Rd index a645e9c2..5b4554ac 100644 --- a/man/experimentSpecServer.Rd +++ b/man/experimentSpecServer.Rd @@ -114,9 +114,9 @@ my_app <- function() { module( label = "experimentSpec example", server = server, - server_args = list(mae_name = mae_name), + server_args = list(mae_name = "MAE"), ui = ui, - ui_args = list(mae_name = mae_name), + ui_args = list(mae_name = "MAE"), datanames = "all" ) ) diff --git a/tests/testthat/adtteSpec/app.R b/tests/testthat/adtteSpec/app.R index 6d4e3bf6..2c5c618b 100644 --- a/tests/testthat/adtteSpec/app.R +++ b/tests/testthat/adtteSpec/app.R @@ -62,18 +62,15 @@ server <- function(id, } my_app <- function() { - mae <- hermes::multi_assay_experiment adtte <- teal.modules.hermes::rADTTE %>% - dplyr::mutate(is_event = .data$CNSR == 0) + dplyr::mutate(is_event = (.data$CNSR == 0)) - data <- teal.data::teal_data( - teal.data::dataset( - "ADTTE", - adtte, - code = "adtte <- teal.modules.hermes::rADTTE %>% - dplyr::mutate(is_event = .data$CNSR == 0)" - ), - teal.data::dataset("MAE", mae) + data <- teal_data( + ADTTE = adtte, + MAE = hermes::multi_assay_experiment, + code = + "adtte <- teal.modules.hermes::rADTTE %>% + dplyr::mutate(is_event = (.data$CNSR == 0))" ) app <- teal::init( diff --git a/tests/testthat/assaySpec/app.R b/tests/testthat/assaySpec/app.R index 295af277..7d264a36 100644 --- a/tests/testthat/assaySpec/app.R +++ b/tests/testthat/assaySpec/app.R @@ -43,10 +43,7 @@ server <- function(id, } my_app <- function() { - mae <- hermes::multi_assay_experiment - mae_name <- "MAE" - mae_data <- teal.data::dataset(mae_name, mae) - data <- teal.data::teal_data(mae_data) + data <- teal.data::teal_data(MAE = hermes::multi_assay_experiment) app <- teal::init( data = data, modules = teal::modules( diff --git a/tests/testthat/experimentSpec/app.R b/tests/testthat/experimentSpec/app.R index 4fdb319b..801758f1 100644 --- a/tests/testthat/experimentSpec/app.R +++ b/tests/testthat/experimentSpec/app.R @@ -56,10 +56,7 @@ server <- function(id, } my_app <- function() { - mae <- hermes::multi_assay_experiment - mae_name <- "MAE" - mae_data <- teal.data::dataset(mae_name, mae) - data <- teal.data::teal_data(mae_data) + data <- teal.data::teal_data(MAE = hermes::multi_assay_experiment) app <- teal::init( data = data, modules = teal::modules( diff --git a/tests/testthat/geneSpec/app.R b/tests/testthat/geneSpec/app.R index e73584ce..bbcbdb42 100644 --- a/tests/testthat/geneSpec/app.R +++ b/tests/testthat/geneSpec/app.R @@ -49,9 +49,7 @@ server <- function(id, funs <- list(mean = colMeans) my_app <- function() { - mae <- hermes::multi_assay_experiment - mae_data <- teal.data::dataset("MAE", mae) - data <- teal.data::teal_data(mae_data) + data <- teal.data::teal_data(MAE = hermes::multi_assay_experiment) app <- teal::init( data = data, modules = teal::modules( diff --git a/tests/testthat/sampleVarSpec/app.R b/tests/testthat/sampleVarSpec/app.R index 6e5aa08c..28ec16fe 100644 --- a/tests/testthat/sampleVarSpec/app.R +++ b/tests/testthat/sampleVarSpec/app.R @@ -39,9 +39,7 @@ server <- function(id, } my_app <- function() { - mae <- hermes::multi_assay_experiment - mae_data <- teal.data::dataset("MAE", mae) - data <- teal.data::teal_data(mae_data) + data <- teal.data::teal_data(MAE = hermes::multi_assay_experiment) app <- teal::init( data = data, modules = teal::modules( From 5bf9f0bd02b30a62f19c048e7f9b69a8ff2ca13f Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 8 Nov 2023 12:26:36 +0100 Subject: [PATCH 08/27] join_keys() instead of data@joinkeys --- design/design_km.Rmd | 2 +- design/design_survival_forest.Rmd | 2 +- design/mae_cdisc_example.R | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/design/design_km.Rmd b/design/design_km.Rmd index 72a3f6f8..0d60ff7a 100644 --- a/design/design_km.Rmd +++ b/design/design_km.Rmd @@ -161,7 +161,7 @@ choices_endpoints <- levels(adtte$PARAMCD) data <- teal_data(MAE = mae, ADSL = adsl, ADTTE = adtte) datanames <- datanames(data) -data@join_keys <- cdisc_join_keys(!!!datanames) +join_keys(data) <- cdisc_join_keys(!!!datanames) data@join_keys$mutate( "MAE", "MAE", c("STUDYID", "USUBJID") ) diff --git a/design/design_survival_forest.Rmd b/design/design_survival_forest.Rmd index 7c72e948..08a1e9f7 100644 --- a/design/design_survival_forest.Rmd +++ b/design/design_survival_forest.Rmd @@ -34,7 +34,7 @@ adtte <- ex_adtte MAE <- multi_assay_experiment data <- teal_data(MAE = mae, ADSL = ex_adsl, ADTTE = ex_adtte) datanames <- datanames(data) -data@join_keys <- cdisc_join_keys(!!!datanames) +join_keys(data) <- cdisc_join_keys(!!!datanames) data@join_keys$mutate( "MAE", "MAE", c("STUDYID", "USUBJID") ) diff --git a/design/mae_cdisc_example.R b/design/mae_cdisc_example.R index 16d9847c..3b903f11 100644 --- a/design/mae_cdisc_example.R +++ b/design/mae_cdisc_example.R @@ -112,7 +112,7 @@ mae <- multi_assay_experiment # from hermes data <- cdisc_data(MAE = mae, ADSL = adsl, ADTTE = adtte) datanames <- datanames(data) -data@join_keys <- cdisc_join_keys(!!!datanames) +join_keys(data) <- cdisc_join_keys(!!!datanames) data@join_keys$mutate( "MAE", "MAE", c("STUDYID", "USUBJID") ) From 904e4ccb9f47bb1f05aabe49714c7443f114f353 Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 8 Nov 2023 12:38:00 +0100 Subject: [PATCH 09/27] bump teal.data --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 100b1a56..705a75a5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -47,7 +47,7 @@ Imports: stats, stringr, SummarizedExperiment, - teal.data (>= 0.3.0), + teal.data (>= 0.3.0.9008), teal.logger (>= 0.1.1), teal.reporter (>= 0.2.0), teal.widgets (>= 0.4.0), From 78f95d86f3d692f31b8e35d248c6e49ce1b8f527 Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 8 Nov 2023 12:38:11 +0100 Subject: [PATCH 10/27] fix join keys --- design/design_km.Rmd | 8 +++----- design/design_survival_forest.Rmd | 4 +--- design/mae_cdisc_example.R | 8 +++----- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/design/design_km.Rmd b/design/design_km.Rmd index 0d60ff7a..ad1a0b1f 100644 --- a/design/design_km.Rmd +++ b/design/design_km.Rmd @@ -148,10 +148,10 @@ adsl$AGE[31:40] <- NaN adsl$EOSDT[51:60] <- NA adsl$EOSDT[71:70] <- NA adsl$all_na <- NA -adsl$unknown <- as.list(ADSL$SEX) +adsl$unknown <- as.list(adsl$SEX) adtte = radtte(cached = TRUE, seed = 1) -adtte$CNSR <- as.logical(ADTTE$CNSR) +adtte$CNSR <- as.logical(adtte$CNSR) adtte$CNSR[100:110] <- NA mae <- multi_assay_experiment # from hermes @@ -162,9 +162,7 @@ data <- teal_data(MAE = mae, ADSL = adsl, ADTTE = adtte) datanames <- datanames(data) join_keys(data) <- cdisc_join_keys(!!!datanames) -data@join_keys$mutate( - "MAE", "MAE", c("STUDYID", "USUBJID") -) +join_keys(data)["MAE"] <- c("STUDYID", "USUBJID") ``` diff --git a/design/design_survival_forest.Rmd b/design/design_survival_forest.Rmd index 08a1e9f7..66b01157 100644 --- a/design/design_survival_forest.Rmd +++ b/design/design_survival_forest.Rmd @@ -35,9 +35,7 @@ MAE <- multi_assay_experiment data <- teal_data(MAE = mae, ADSL = ex_adsl, ADTTE = ex_adtte) datanames <- datanames(data) join_keys(data) <- cdisc_join_keys(!!!datanames) -data@join_keys$mutate( - "MAE", "MAE", c("STUDYID", "USUBJID") -) +join_keys(data)["MAE"] <- c("STUDYID", "USUBJID") # Get raw ADTTE. adtte_raw <- get_raw_data(adtte) diff --git a/design/mae_cdisc_example.R b/design/mae_cdisc_example.R index 3b903f11..94204ba4 100644 --- a/design/mae_cdisc_example.R +++ b/design/mae_cdisc_example.R @@ -102,10 +102,10 @@ adsl$AGE[31:40] <- NaN adsl$EOSDT[51:60] <- NA adsl$EOSDT[71:70] <- NA adsl$all_na <- NA -adsl$unknown <- as.list(ADSL$SEX) +adsl$unknown <- as.list(adsl$SEX) adtte = radtte(cached = TRUE) -adtte$CNSR <- as.logical(ADTTE$CNSR) +adtte$CNSR <- as.logical(adtte$CNSR) adtte$CNSR[100:110] <- NA mae <- multi_assay_experiment # from hermes @@ -113,9 +113,7 @@ mae <- multi_assay_experiment # from hermes data <- cdisc_data(MAE = mae, ADSL = adsl, ADTTE = adtte) datanames <- datanames(data) join_keys(data) <- cdisc_join_keys(!!!datanames) -data@join_keys$mutate( - "MAE", "MAE", c("STUDYID", "USUBJID") -) +join_keys(data)["MAE"] <- c("STUDYID", "USUBJID") app <- init( data = data, From 671f8bec61eb958a1081f1552a7b9b9c72e0bdc8 Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 8 Nov 2023 13:07:33 +0100 Subject: [PATCH 11/27] missing pipe --- R/adtteSpec.R | 2 +- man/adtteSpecServer.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/adtteSpec.R b/R/adtteSpec.R index 89ac4fc3..939cc5d6 100644 --- a/R/adtteSpec.R +++ b/R/adtteSpec.R @@ -215,7 +215,7 @@ adtteSpecInput <- function(inputId, # nolint #' ADTTE = adtte, #' MAE = hermes::multi_assay_experiment, #' code = -#' "adtte <- teal.modules.hermes::rADTTE +#' "adtte <- teal.modules.hermes::rADTTE %>% #' dplyr::mutate(is_event = .data$CNSR == 0)" #' ) #' diff --git a/man/adtteSpecServer.Rd b/man/adtteSpecServer.Rd index 6502ba37..587ffade 100644 --- a/man/adtteSpecServer.Rd +++ b/man/adtteSpecServer.Rd @@ -141,7 +141,7 @@ my_app <- function() { ADTTE = adtte, MAE = hermes::multi_assay_experiment, code = - "adtte <- teal.modules.hermes::rADTTE + "adtte <- teal.modules.hermes::rADTTE \%>\% dplyr::mutate(is_event = .data$CNSR == 0)" ) From 98f00c70c985c18b582d3a2f49df00f833dddb17 Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 8 Nov 2023 13:25:54 +0100 Subject: [PATCH 12/27] fix code reproducibility using within --- R/adtteSpec.R | 17 ++++++++--------- R/forestplot.R | 38 ++++++++++++++++++-------------------- R/km.R | 38 ++++++++++++++++++-------------------- man/adtteSpecServer.Rd | 17 ++++++++--------- man/tm_g_forest_tte.Rd | 20 ++++++++++---------- man/tm_g_km.Rd | 20 ++++++++++---------- 6 files changed, 72 insertions(+), 78 deletions(-) diff --git a/R/adtteSpec.R b/R/adtteSpec.R index 939cc5d6..40fd11bc 100644 --- a/R/adtteSpec.R +++ b/R/adtteSpec.R @@ -208,16 +208,15 @@ adtteSpecInput <- function(inputId, # nolint #' } #' #' my_app <- function() { -#' adtte <- teal.modules.hermes::rADTTE %>% +#' data <- teal_data() +#' data <- within(data, { +#' ADTTE = teal.modules.hermes::rADTTE %>% #' dplyr::mutate(is_event = .data$CNSR == 0) -#' -#' data <- teal_data( -#' ADTTE = adtte, -#' MAE = hermes::multi_assay_experiment, -#' code = -#' "adtte <- teal.modules.hermes::rADTTE %>% -#' dplyr::mutate(is_event = .data$CNSR == 0)" -#' ) +#' MAE = hermes::multi_assay_experiment +#' }) +#' datanames <- c("ADTTE", "MAE") +#' datanames(data) <- datanames +#' data@join_keys <- cdisc_join_keys(!!!datanames) #' #' app <- init( #' data = data, diff --git a/R/forestplot.R b/R/forestplot.R index 0bbc1aaa..7cac3fdb 100644 --- a/R/forestplot.R +++ b/R/forestplot.R @@ -11,16 +11,16 @@ #' @export #' #' @examples -#' adtte <- teal.modules.hermes::rADTTE %>% -#' dplyr::mutate(is_event = (.data$CNSR == 0)) +#' data <- teal_data() +#' data <- within(data, { +#' ADTTE = teal.modules.hermes::rADTTE %>% +#' dplyr::mutate(is_event = .data$CNSR == 0) +#' MAE = hermes::multi_assay_experiment +#' }) +#' datanames <- c("ADTTE", "MAE") +#' datanames(data) <- datanames +#' data@join_keys <- cdisc_join_keys(!!!datanames) #' -#' data <- teal_data( -#' ADTTE = adtte, -#' MAE = hermes::multi_assay_experiment, -#' code = -#' "adtte <- teal.modules.hermes::rADTTE %>% -#' dplyr::mutate(is_event = (.data$CNSR == 0))" -#' ) #' app <- init( #' data = data, #' modules = modules( @@ -283,17 +283,15 @@ srv_g_forest_tte <- function(id, #' sample_tm_g_forest_tte() #' } sample_tm_g_forest_tte <- function() { # nolint - - adtte <- teal.modules.hermes::rADTTE %>% - dplyr::mutate(is_event = (.data$CNSR == 0)) - - data <- teal_data( - ADTTE = adtte, - MAE = hermes::multi_assay_experiment, - code = - "adtte <- teal.modules.hermes::rADTTE %>% - dplyr::mutate(is_event = (.data$CNSR == 0))" - ) + data <- teal_data() + data <- within(data, { + ADTTE = teal.modules.hermes::rADTTE %>% + dplyr::mutate(is_event = .data$CNSR == 0) + MAE = hermes::multi_assay_experiment + }) + datanames <- c("ADTTE", "MAE") + datanames(data) <- datanames + data@join_keys <- cdisc_join_keys(!!!datanames) app <- teal::init( data = data, diff --git a/R/km.R b/R/km.R index 72a64953..90ca6429 100644 --- a/R/km.R +++ b/R/km.R @@ -12,16 +12,16 @@ #' @export #' #' @examples -#' adtte <- teal.modules.hermes::rADTTE %>% -#' dplyr::mutate(is_event = (.data$CNSR == 0)) +#' data <- teal_data() +#' data <- within(data, { +#' ADTTE = teal.modules.hermes::rADTTE %>% +#' dplyr::mutate(is_event = .data$CNSR == 0) +#' MAE = hermes::multi_assay_experiment +#' }) +#' datanames <- c("ADTTE", "MAE") +#' datanames(data) <- datanames +#' data@join_keys <- cdisc_join_keys(!!!datanames) #' -#' data <- teal_data( -#' ADTTE = adtte, -#' MAE = hermes::multi_assay_experiment, -#' code = -#' "adtte <- teal.modules.hermes::rADTTE %>% -#' dplyr::mutate(is_event = (.data$CNSR == 0))" -#' ) #' #' modules <- modules( #' tm_g_km( @@ -275,17 +275,15 @@ srv_g_km <- function(id, #' sample_tm_g_km() #' } sample_tm_g_km <- function() { # nolint - - adtte <- teal.modules.hermes::rADTTE %>% - dplyr::mutate(is_event = (.data$CNSR == 0)) - - data <- teal_data( - ADTTE = adtte, - MAE = hermes::multi_assay_experiment, - code = - "adtte <- teal.modules.hermes::rADTTE %>% - dplyr::mutate(is_event = (.data$CNSR == 0))" - ) + data <- teal_data() + data <- within(data, { + ADTTE = teal.modules.hermes::rADTTE %>% + dplyr::mutate(is_event = .data$CNSR == 0) + MAE = hermes::multi_assay_experiment + }) + datanames <- c("ADTTE", "MAE") + datanames(data) <- datanames + data@join_keys <- cdisc_join_keys(!!!datanames) modules <- teal::modules( tm_g_km( diff --git a/man/adtteSpecServer.Rd b/man/adtteSpecServer.Rd index 587ffade..780059bb 100644 --- a/man/adtteSpecServer.Rd +++ b/man/adtteSpecServer.Rd @@ -134,16 +134,15 @@ server <- function(id, data, filter_panel_api) { } my_app <- function() { - adtte <- teal.modules.hermes::rADTTE \%>\% +data <- teal_data() +data <- within(data, { + ADTTE = teal.modules.hermes::rADTTE \%>\% dplyr::mutate(is_event = .data$CNSR == 0) - - data <- teal_data( - ADTTE = adtte, - MAE = hermes::multi_assay_experiment, - code = - "adtte <- teal.modules.hermes::rADTTE \%>\% - dplyr::mutate(is_event = .data$CNSR == 0)" - ) + MAE = hermes::multi_assay_experiment +}) +datanames <- c("ADTTE", "MAE") +datanames(data) <- datanames +data@join_keys <- cdisc_join_keys(!!!datanames) app <- init( data = data, diff --git a/man/tm_g_forest_tte.Rd b/man/tm_g_forest_tte.Rd index 5aef038f..811d01ed 100644 --- a/man/tm_g_forest_tte.Rd +++ b/man/tm_g_forest_tte.Rd @@ -119,16 +119,16 @@ This module provides an interactive survival forest plot. }} \examples{ -adtte <- teal.modules.hermes::rADTTE \%>\% - dplyr::mutate(is_event = (.data$CNSR == 0)) - -data <- teal_data( - ADTTE = adtte, - MAE = hermes::multi_assay_experiment, - code = - "adtte <- teal.modules.hermes::rADTTE \%>\% - dplyr::mutate(is_event = (.data$CNSR == 0))" -) +data <- teal_data() +data <- within(data, { + ADTTE = teal.modules.hermes::rADTTE \%>\% + dplyr::mutate(is_event = .data$CNSR == 0) + MAE = hermes::multi_assay_experiment +}) +datanames <- c("ADTTE", "MAE") +datanames(data) <- datanames +data@join_keys <- cdisc_join_keys(!!!datanames) + app <- init( data = data, modules = modules( diff --git a/man/tm_g_km.Rd b/man/tm_g_km.Rd index fe166ac8..ca652311 100644 --- a/man/tm_g_km.Rd +++ b/man/tm_g_km.Rd @@ -102,16 +102,16 @@ This teal module produces a grid style \code{Kaplan-Meier} plot for data with }} \examples{ -adtte <- teal.modules.hermes::rADTTE \%>\% - dplyr::mutate(is_event = (.data$CNSR == 0)) - -data <- teal_data( - ADTTE = adtte, - MAE = hermes::multi_assay_experiment, - code = - "adtte <- teal.modules.hermes::rADTTE \%>\% - dplyr::mutate(is_event = (.data$CNSR == 0))" -) +data <- teal_data() +data <- within(data, { + ADTTE = teal.modules.hermes::rADTTE \%>\% + dplyr::mutate(is_event = .data$CNSR == 0) + MAE = hermes::multi_assay_experiment +}) +datanames <- c("ADTTE", "MAE") +datanames(data) <- datanames +data@join_keys <- cdisc_join_keys(!!!datanames) + modules <- modules( tm_g_km( From e1ec8b8e20fe03c0e5addb0032b3d29f9f5b1a59 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 8 Nov 2023 12:30:31 +0000 Subject: [PATCH 13/27] [skip actions] Restyle files --- R/adtteSpec.R | 19 +++++++++---------- R/forestplot.R | 8 ++++---- R/km.R | 8 ++++---- design/design_km.Rmd | 7 +++---- design/mae_cdisc_example.R | 4 ++-- 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/R/adtteSpec.R b/R/adtteSpec.R index 40fd11bc..12b415dc 100644 --- a/R/adtteSpec.R +++ b/R/adtteSpec.R @@ -208,15 +208,15 @@ adtteSpecInput <- function(inputId, # nolint #' } #' #' my_app <- function() { -#' data <- teal_data() -#' data <- within(data, { -#' ADTTE = teal.modules.hermes::rADTTE %>% -#' dplyr::mutate(is_event = .data$CNSR == 0) -#' MAE = hermes::multi_assay_experiment -#' }) -#' datanames <- c("ADTTE", "MAE") -#' datanames(data) <- datanames -#' data@join_keys <- cdisc_join_keys(!!!datanames) +#' data <- teal_data() +#' data <- within(data, { +#' ADTTE <- teal.modules.hermes::rADTTE %>% +#' dplyr::mutate(is_event = .data$CNSR == 0) +#' MAE <- hermes::multi_assay_experiment +#' }) +#' datanames <- c("ADTTE", "MAE") +#' datanames(data) <- datanames +#' data@join_keys <- cdisc_join_keys(!!!datanames) #' #' app <- init( #' data = data, @@ -392,4 +392,3 @@ adtteSpecServer <- function(id, # nolint ) }) } - diff --git a/R/forestplot.R b/R/forestplot.R index 7cac3fdb..db4ed1df 100644 --- a/R/forestplot.R +++ b/R/forestplot.R @@ -13,9 +13,9 @@ #' @examples #' data <- teal_data() #' data <- within(data, { -#' ADTTE = teal.modules.hermes::rADTTE %>% +#' ADTTE <- teal.modules.hermes::rADTTE %>% #' dplyr::mutate(is_event = .data$CNSR == 0) -#' MAE = hermes::multi_assay_experiment +#' MAE <- hermes::multi_assay_experiment #' }) #' datanames <- c("ADTTE", "MAE") #' datanames(data) <- datanames @@ -285,9 +285,9 @@ srv_g_forest_tte <- function(id, sample_tm_g_forest_tte <- function() { # nolint data <- teal_data() data <- within(data, { - ADTTE = teal.modules.hermes::rADTTE %>% + ADTTE <- teal.modules.hermes::rADTTE %>% dplyr::mutate(is_event = .data$CNSR == 0) - MAE = hermes::multi_assay_experiment + MAE <- hermes::multi_assay_experiment }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames diff --git a/R/km.R b/R/km.R index 90ca6429..f0a15ab5 100644 --- a/R/km.R +++ b/R/km.R @@ -14,9 +14,9 @@ #' @examples #' data <- teal_data() #' data <- within(data, { -#' ADTTE = teal.modules.hermes::rADTTE %>% +#' ADTTE <- teal.modules.hermes::rADTTE %>% #' dplyr::mutate(is_event = .data$CNSR == 0) -#' MAE = hermes::multi_assay_experiment +#' MAE <- hermes::multi_assay_experiment #' }) #' datanames <- c("ADTTE", "MAE") #' datanames(data) <- datanames @@ -277,9 +277,9 @@ srv_g_km <- function(id, sample_tm_g_km <- function() { # nolint data <- teal_data() data <- within(data, { - ADTTE = teal.modules.hermes::rADTTE %>% + ADTTE <- teal.modules.hermes::rADTTE %>% dplyr::mutate(is_event = .data$CNSR == 0) - MAE = hermes::multi_assay_experiment + MAE <- hermes::multi_assay_experiment }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames diff --git a/design/design_km.Rmd b/design/design_km.Rmd index ad1a0b1f..38fbaea1 100644 --- a/design/design_km.Rmd +++ b/design/design_km.Rmd @@ -141,7 +141,7 @@ library(hermes) library(random.cdisc.data) library(dplyr) -adsl = radsl(cached = TRUE, na_percentage = 0.2) +adsl <- radsl(cached = TRUE, na_percentage = 0.2) adsl$SEX[1:20] <- NA adsl$AGE[21:30] <- Inf adsl$AGE[31:40] <- NaN @@ -149,8 +149,8 @@ adsl$EOSDT[51:60] <- NA adsl$EOSDT[71:70] <- NA adsl$all_na <- NA adsl$unknown <- as.list(adsl$SEX) - -adtte = radtte(cached = TRUE, seed = 1) + +adtte <- radtte(cached = TRUE, seed = 1) adtte$CNSR <- as.logical(adtte$CNSR) adtte$CNSR[100:110] <- NA @@ -163,7 +163,6 @@ data <- teal_data(MAE = mae, ADSL = adsl, ADTTE = adtte) datanames <- datanames(data) join_keys(data) <- cdisc_join_keys(!!!datanames) join_keys(data)["MAE"] <- c("STUDYID", "USUBJID") - ``` ## App Launch diff --git a/design/mae_cdisc_example.R b/design/mae_cdisc_example.R index 94204ba4..44609b0e 100644 --- a/design/mae_cdisc_example.R +++ b/design/mae_cdisc_example.R @@ -95,7 +95,7 @@ srv_made_up_merge_pr <- function(input, output, session, datasets, dataname) { library(teal) library(hermes) library(random.cdisc.data) -adsl = radsl(cached = TRUE, na_percentage = 0.2) +adsl <- radsl(cached = TRUE, na_percentage = 0.2) adsl$SEX[1:20] <- NA adsl$AGE[21:30] <- Inf adsl$AGE[31:40] <- NaN @@ -104,7 +104,7 @@ adsl$EOSDT[71:70] <- NA adsl$all_na <- NA adsl$unknown <- as.list(adsl$SEX) -adtte = radtte(cached = TRUE) +adtte <- radtte(cached = TRUE) adtte$CNSR <- as.logical(adtte$CNSR) adtte$CNSR[100:110] <- NA From 2d4bd0fc09b59826a9468da969798bb704fa911e Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 8 Nov 2023 13:41:03 +0100 Subject: [PATCH 14/27] import rlang and !!! --- DESCRIPTION | 1 + NAMESPACE | 1 + R/package.R | 1 + 3 files changed, 3 insertions(+) diff --git a/DESCRIPTION b/DESCRIPTION index 705a75a5..24655fc5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -40,6 +40,7 @@ Imports: lifecycle, logger (>= 0.2.0), MultiAssayExperiment, + rlang, rtables (>= 0.5.1), S4Vectors, shinyRadioMatrix (>= 0.2.1), diff --git a/NAMESPACE b/NAMESPACE index 76c52089..6c9c9049 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -72,3 +72,4 @@ import(teal) importFrom(S4Vectors,DataFrame) importFrom(S4Vectors,setListElement) importFrom(lifecycle,deprecate_soft) +importFrom(rlang,`!!!`) diff --git a/R/package.R b/R/package.R index 52a51eff..c14a6c49 100644 --- a/R/package.R +++ b/R/package.R @@ -10,4 +10,5 @@ #' @import teal #' @importFrom S4Vectors setListElement DataFrame #' @importFrom lifecycle deprecate_soft +#' @importFrom rlang `!!!` NULL From 4ee7b3a940c7651430e6ffb9b3f70c08550572b9 Mon Sep 17 00:00:00 2001 From: "27856297+dependabot-preview[bot]@users.noreply.github.com" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 8 Nov 2023 12:53:46 +0000 Subject: [PATCH 15/27] [skip actions] Roxygen Man Pages Auto Update --- man/adtteSpecServer.Rd | 18 +++++++++--------- man/tm_g_forest_tte.Rd | 4 ++-- man/tm_g_km.Rd | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/man/adtteSpecServer.Rd b/man/adtteSpecServer.Rd index 780059bb..4940d70a 100644 --- a/man/adtteSpecServer.Rd +++ b/man/adtteSpecServer.Rd @@ -134,15 +134,15 @@ server <- function(id, data, filter_panel_api) { } my_app <- function() { -data <- teal_data() -data <- within(data, { - ADTTE = teal.modules.hermes::rADTTE \%>\% - dplyr::mutate(is_event = .data$CNSR == 0) - MAE = hermes::multi_assay_experiment -}) -datanames <- c("ADTTE", "MAE") -datanames(data) <- datanames -data@join_keys <- cdisc_join_keys(!!!datanames) + data <- teal_data() + data <- within(data, { + ADTTE <- teal.modules.hermes::rADTTE \%>\% + dplyr::mutate(is_event = .data$CNSR == 0) + MAE <- hermes::multi_assay_experiment + }) + datanames <- c("ADTTE", "MAE") + datanames(data) <- datanames + data@join_keys <- cdisc_join_keys(!!!datanames) app <- init( data = data, diff --git a/man/tm_g_forest_tte.Rd b/man/tm_g_forest_tte.Rd index 811d01ed..93e20fff 100644 --- a/man/tm_g_forest_tte.Rd +++ b/man/tm_g_forest_tte.Rd @@ -121,9 +121,9 @@ This module provides an interactive survival forest plot. \examples{ data <- teal_data() data <- within(data, { - ADTTE = teal.modules.hermes::rADTTE \%>\% + ADTTE <- teal.modules.hermes::rADTTE \%>\% dplyr::mutate(is_event = .data$CNSR == 0) - MAE = hermes::multi_assay_experiment + MAE <- hermes::multi_assay_experiment }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames diff --git a/man/tm_g_km.Rd b/man/tm_g_km.Rd index ca652311..8bf32861 100644 --- a/man/tm_g_km.Rd +++ b/man/tm_g_km.Rd @@ -104,9 +104,9 @@ This teal module produces a grid style \code{Kaplan-Meier} plot for data with \examples{ data <- teal_data() data <- within(data, { - ADTTE = teal.modules.hermes::rADTTE \%>\% + ADTTE <- teal.modules.hermes::rADTTE \%>\% dplyr::mutate(is_event = .data$CNSR == 0) - MAE = hermes::multi_assay_experiment + MAE <- hermes::multi_assay_experiment }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames From 4d192794877520a30e237a4f36d497edc244f6de Mon Sep 17 00:00:00 2001 From: m7pr Date: Thu, 9 Nov 2023 09:56:57 +0100 Subject: [PATCH 16/27] data@join_keys -> join_keys(data) --- R/adtteSpec.R | 19 ++++++++++--------- R/forestplot.R | 4 ++-- R/km.R | 4 ++-- man/adtteSpecServer.Rd | 18 +++++++++--------- man/tm_g_forest_tte.Rd | 2 +- man/tm_g_km.Rd | 2 +- 6 files changed, 25 insertions(+), 24 deletions(-) diff --git a/R/adtteSpec.R b/R/adtteSpec.R index 12b415dc..3a0c4e6c 100644 --- a/R/adtteSpec.R +++ b/R/adtteSpec.R @@ -208,15 +208,15 @@ adtteSpecInput <- function(inputId, # nolint #' } #' #' my_app <- function() { -#' data <- teal_data() -#' data <- within(data, { -#' ADTTE <- teal.modules.hermes::rADTTE %>% -#' dplyr::mutate(is_event = .data$CNSR == 0) -#' MAE <- hermes::multi_assay_experiment -#' }) -#' datanames <- c("ADTTE", "MAE") -#' datanames(data) <- datanames -#' data@join_keys <- cdisc_join_keys(!!!datanames) +#' data <- teal_data() +#' data <- within(data, { +#' ADTTE = teal.modules.hermes::rADTTE %>% +#' dplyr::mutate(is_event = .data$CNSR == 0) +#' MAE = hermes::multi_assay_experiment +#' }) +#' datanames <- c("ADTTE", "MAE") +#' datanames(data) <- datanames +#' join_keys(data) <- cdisc_join_keys(!!!datanames) #' #' app <- init( #' data = data, @@ -392,3 +392,4 @@ adtteSpecServer <- function(id, # nolint ) }) } + diff --git a/R/forestplot.R b/R/forestplot.R index db4ed1df..ef22f4d5 100644 --- a/R/forestplot.R +++ b/R/forestplot.R @@ -19,7 +19,7 @@ #' }) #' datanames <- c("ADTTE", "MAE") #' datanames(data) <- datanames -#' data@join_keys <- cdisc_join_keys(!!!datanames) +#' join_keys(data) <- cdisc_join_keys(!!!datanames) #' #' app <- init( #' data = data, @@ -291,7 +291,7 @@ sample_tm_g_forest_tte <- function() { # nolint }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames - data@join_keys <- cdisc_join_keys(!!!datanames) + join_keys(data) <- cdisc_join_keys(!!!datanames) app <- teal::init( data = data, diff --git a/R/km.R b/R/km.R index f0a15ab5..6b29a6c4 100644 --- a/R/km.R +++ b/R/km.R @@ -20,7 +20,7 @@ #' }) #' datanames <- c("ADTTE", "MAE") #' datanames(data) <- datanames -#' data@join_keys <- cdisc_join_keys(!!!datanames) +#' join_keys(data) <- cdisc_join_keys(!!!datanames) #' #' #' modules <- modules( @@ -283,7 +283,7 @@ sample_tm_g_km <- function() { # nolint }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames - data@join_keys <- cdisc_join_keys(!!!datanames) + join_keys(data) <- cdisc_join_keys(!!!datanames) modules <- teal::modules( tm_g_km( diff --git a/man/adtteSpecServer.Rd b/man/adtteSpecServer.Rd index 4940d70a..3c37d37d 100644 --- a/man/adtteSpecServer.Rd +++ b/man/adtteSpecServer.Rd @@ -134,15 +134,15 @@ server <- function(id, data, filter_panel_api) { } my_app <- function() { - data <- teal_data() - data <- within(data, { - ADTTE <- teal.modules.hermes::rADTTE \%>\% - dplyr::mutate(is_event = .data$CNSR == 0) - MAE <- hermes::multi_assay_experiment - }) - datanames <- c("ADTTE", "MAE") - datanames(data) <- datanames - data@join_keys <- cdisc_join_keys(!!!datanames) +data <- teal_data() +data <- within(data, { + ADTTE = teal.modules.hermes::rADTTE \%>\% + dplyr::mutate(is_event = .data$CNSR == 0) + MAE = hermes::multi_assay_experiment +}) +datanames <- c("ADTTE", "MAE") +datanames(data) <- datanames +join_keys(data) <- cdisc_join_keys(!!!datanames) app <- init( data = data, diff --git a/man/tm_g_forest_tte.Rd b/man/tm_g_forest_tte.Rd index 93e20fff..b0837354 100644 --- a/man/tm_g_forest_tte.Rd +++ b/man/tm_g_forest_tte.Rd @@ -127,7 +127,7 @@ data <- within(data, { }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames -data@join_keys <- cdisc_join_keys(!!!datanames) +join_keys(data) <- cdisc_join_keys(!!!datanames) app <- init( data = data, diff --git a/man/tm_g_km.Rd b/man/tm_g_km.Rd index 8bf32861..60ffa0fc 100644 --- a/man/tm_g_km.Rd +++ b/man/tm_g_km.Rd @@ -110,7 +110,7 @@ data <- within(data, { }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames -data@join_keys <- cdisc_join_keys(!!!datanames) +join_keys(data) <- cdisc_join_keys(!!!datanames) modules <- modules( From 500ae5358c456eabc669782b4cd9d9f59d6978cd Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 9 Nov 2023 08:59:47 +0000 Subject: [PATCH 17/27] [skip actions] Restyle files --- R/adtteSpec.R | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/R/adtteSpec.R b/R/adtteSpec.R index 3a0c4e6c..f5094004 100644 --- a/R/adtteSpec.R +++ b/R/adtteSpec.R @@ -208,15 +208,15 @@ adtteSpecInput <- function(inputId, # nolint #' } #' #' my_app <- function() { -#' data <- teal_data() -#' data <- within(data, { -#' ADTTE = teal.modules.hermes::rADTTE %>% -#' dplyr::mutate(is_event = .data$CNSR == 0) -#' MAE = hermes::multi_assay_experiment -#' }) -#' datanames <- c("ADTTE", "MAE") -#' datanames(data) <- datanames -#' join_keys(data) <- cdisc_join_keys(!!!datanames) +#' data <- teal_data() +#' data <- within(data, { +#' ADTTE <- teal.modules.hermes::rADTTE %>% +#' dplyr::mutate(is_event = .data$CNSR == 0) +#' MAE <- hermes::multi_assay_experiment +#' }) +#' datanames <- c("ADTTE", "MAE") +#' datanames(data) <- datanames +#' join_keys(data) <- cdisc_join_keys(!!!datanames) #' #' app <- init( #' data = data, @@ -392,4 +392,3 @@ adtteSpecServer <- function(id, # nolint ) }) } - From 71f64d450b923be6338cb2c0e10ebb181288061d Mon Sep 17 00:00:00 2001 From: m7pr Date: Thu, 9 Nov 2023 12:28:36 +0100 Subject: [PATCH 18/27] revert changes for design files --- design/design_km.Rmd | 41 ++++++++++++++++++------------- design/design_survival_forest.Rmd | 15 ++++++----- design/mae_cdisc_example.R | 32 +++++++++++++----------- 3 files changed, 48 insertions(+), 40 deletions(-) diff --git a/design/design_km.Rmd b/design/design_km.Rmd index 38fbaea1..1cc103d8 100644 --- a/design/design_km.Rmd +++ b/design/design_km.Rmd @@ -140,29 +140,36 @@ library(teal) library(hermes) library(random.cdisc.data) library(dplyr) - -adsl <- radsl(cached = TRUE, na_percentage = 0.2) -adsl$SEX[1:20] <- NA -adsl$AGE[21:30] <- Inf -adsl$AGE[31:40] <- NaN -adsl$EOSDT[51:60] <- NA -adsl$EOSDT[71:70] <- NA -adsl$all_na <- NA -adsl$unknown <- as.list(adsl$SEX) - -adtte <- radtte(cached = TRUE, seed = 1) -adtte$CNSR <- as.logical(adtte$CNSR) -adtte$CNSR[100:110] <- NA +adsl <- cdisc_dataset("ADSL", radsl(cached = TRUE, na_percentage = 0.2)) %>% + mutate_dataset( + "ADSL$SEX[1:20] <- NA + ADSL$AGE[21:30] <- Inf + ADSL$AGE[31:40] <- NaN + ADSL$EOSDT[51:60] <- NA + ADSL$EOSDT[71:70] <- NA + ADSL$all_na <- NA + ADSL$unknown <- as.list(ADSL$SEX)" + ) +adtte <- cdisc_dataset("ADTTE", radtte(cached = TRUE, seed = 1)) %>% + mutate_dataset( + "ADTTE$CNSR <- as.logical(ADTTE$CNSR) + ADTTE$CNSR[100:110] <- NA" + ) mae <- multi_assay_experiment # from hermes +mae <- dataset("MAE", mae) + +adtte <- radtte(cached = TRUE, seed = 1) %>% + mutate( + "ADTTE$CNSR <- as.logical(ADTTE$CNSR) + ADTTE$CNSR[100:110] <- NA" + ) choices_endpoints <- levels(adtte$PARAMCD) -data <- teal_data(MAE = mae, ADSL = adsl, ADTTE = adtte) -datanames <- datanames(data) -join_keys(data) <- cdisc_join_keys(!!!datanames) -join_keys(data)["MAE"] <- c("STUDYID", "USUBJID") +data <- teal_data(mae, adsl, adtte) %>% + mutate_join_keys("MAE", "MAE", c("STUDYID", "USUBJID")) ``` ## App Launch diff --git a/design/design_survival_forest.Rmd b/design/design_survival_forest.Rmd index 66b01157..d97d18fb 100644 --- a/design/design_survival_forest.Rmd +++ b/design/design_survival_forest.Rmd @@ -24,18 +24,17 @@ We want to design a simple survival forest plot teal module. ## General module workflow ```{r} -# Example ADSL data -adsl <- ex_adsl +# Example ADSL data converted into a CDISCDataset object. +adsl <- cdisc_dataset("ADSL", ex_adsl) -# Example ADTTE data -adtte <- ex_adtte +# Example ADTTE data converted into a CDISCDataset object. +adtte <- cdisc_dataset("ADTTE", ex_adtte) # Example MAE data and merge datasets. MAE <- multi_assay_experiment -data <- teal_data(MAE = mae, ADSL = ex_adsl, ADTTE = ex_adtte) -datanames <- datanames(data) -join_keys(data) <- cdisc_join_keys(!!!datanames) -join_keys(data)["MAE"] <- c("STUDYID", "USUBJID") +mae <- dataset("MAE", MAE) +data <- teal_data(mae, adsl, adtte) %>% + mutate_join_keys("MAE", "MAE", c("STUDYID", "USUBJID")) # Get raw ADTTE. adtte_raw <- get_raw_data(adtte) diff --git a/design/mae_cdisc_example.R b/design/mae_cdisc_example.R index 44609b0e..0135ea73 100644 --- a/design/mae_cdisc_example.R +++ b/design/mae_cdisc_example.R @@ -95,25 +95,27 @@ srv_made_up_merge_pr <- function(input, output, session, datasets, dataname) { library(teal) library(hermes) library(random.cdisc.data) -adsl <- radsl(cached = TRUE, na_percentage = 0.2) -adsl$SEX[1:20] <- NA -adsl$AGE[21:30] <- Inf -adsl$AGE[31:40] <- NaN -adsl$EOSDT[51:60] <- NA -adsl$EOSDT[71:70] <- NA -adsl$all_na <- NA -adsl$unknown <- as.list(adsl$SEX) +adsl <- cdisc_dataset("ADSL", radsl(cached = TRUE, na_percentage = 0.2)) %>% + mutate_dataset( + "ADSL$SEX[1:20] <- NA + ADSL$AGE[21:30] <- Inf + ADSL$AGE[31:40] <- NaN + ADSL$EOSDT[51:60] <- NA + ADSL$EOSDT[71:70] <- NA + ADSL$all_na <- NA + ADSL$unknown <- as.list(ADSL$SEX)" + ) +adtte <- cdisc_dataset("ADTTE", radtte(cached = TRUE)) %>% + mutate_dataset( + "ADTTE$CNSR <- as.logical(ADTTE$CNSR) + ADTTE$CNSR[100:110] <- NA" + ) -adtte <- radtte(cached = TRUE) -adtte$CNSR <- as.logical(adtte$CNSR) -adtte$CNSR[100:110] <- NA mae <- multi_assay_experiment # from hermes -data <- cdisc_data(MAE = mae, ADSL = adsl, ADTTE = adtte) -datanames <- datanames(data) -join_keys(data) <- cdisc_join_keys(!!!datanames) -join_keys(data)["MAE"] <- c("STUDYID", "USUBJID") +data <- cdisc_data(dataset("MAE", mae), adsl, adtte) %>% + mutate_join_keys("MAE", "MAE", c("STUDYID", "USUBJID")) app <- init( data = data, From 07a8d41e1704b0fe505f6ccef6fccc4b6c49a44f Mon Sep 17 00:00:00 2001 From: "27856297+dependabot-preview[bot]@users.noreply.github.com" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 9 Nov 2023 11:36:03 +0000 Subject: [PATCH 19/27] [skip actions] Roxygen Man Pages Auto Update --- man/adtteSpecServer.Rd | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/man/adtteSpecServer.Rd b/man/adtteSpecServer.Rd index 3c37d37d..3af7e7db 100644 --- a/man/adtteSpecServer.Rd +++ b/man/adtteSpecServer.Rd @@ -134,15 +134,15 @@ server <- function(id, data, filter_panel_api) { } my_app <- function() { -data <- teal_data() -data <- within(data, { - ADTTE = teal.modules.hermes::rADTTE \%>\% - dplyr::mutate(is_event = .data$CNSR == 0) - MAE = hermes::multi_assay_experiment -}) -datanames <- c("ADTTE", "MAE") -datanames(data) <- datanames -join_keys(data) <- cdisc_join_keys(!!!datanames) + data <- teal_data() + data <- within(data, { + ADTTE <- teal.modules.hermes::rADTTE \%>\% + dplyr::mutate(is_event = .data$CNSR == 0) + MAE <- hermes::multi_assay_experiment + }) + datanames <- c("ADTTE", "MAE") + datanames(data) <- datanames + join_keys(data) <- cdisc_join_keys(!!!datanames) app <- init( data = data, From 7de397908f6abfc94622bff6d495c8c8860a3d83 Mon Sep 17 00:00:00 2001 From: m7pr Date: Thu, 9 Nov 2023 12:46:30 +0100 Subject: [PATCH 20/27] add nolint --- R/forestplot.R | 4 ++-- R/km.R | 4 ++-- R/sampleVarSpec.R | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/R/forestplot.R b/R/forestplot.R index ef22f4d5..675fe937 100644 --- a/R/forestplot.R +++ b/R/forestplot.R @@ -285,9 +285,9 @@ srv_g_forest_tte <- function(id, sample_tm_g_forest_tte <- function() { # nolint data <- teal_data() data <- within(data, { - ADTTE <- teal.modules.hermes::rADTTE %>% + ADTTE <- teal.modules.hermes::rADTTE %>% # nolint dplyr::mutate(is_event = .data$CNSR == 0) - MAE <- hermes::multi_assay_experiment + MAE <- hermes::multi_assay_experiment # nolint }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames diff --git a/R/km.R b/R/km.R index 6b29a6c4..fda0b195 100644 --- a/R/km.R +++ b/R/km.R @@ -277,9 +277,9 @@ srv_g_km <- function(id, sample_tm_g_km <- function() { # nolint data <- teal_data() data <- within(data, { - ADTTE <- teal.modules.hermes::rADTTE %>% + ADTTE <- teal.modules.hermes::rADTTE %>% # nolint dplyr::mutate(is_event = .data$CNSR == 0) - MAE <- hermes::multi_assay_experiment + MAE <- hermes::multi_assay_experiment # nolint }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames diff --git a/R/sampleVarSpec.R b/R/sampleVarSpec.R index 9b09fa0c..824fcbdc 100644 --- a/R/sampleVarSpec.R +++ b/R/sampleVarSpec.R @@ -417,9 +417,9 @@ sampleVarSpecServer <- function(id, # nolint old_values <- names(assign_lists[[experiment_name]][[sample_var]]) if (!is.null(old_values) && - length(old_values) == length(sample_var_levels) && - all(sort(old_values) == sort(sample_var_levels))) { - selected_groups <- assign_lists[[experiment_name]][[sample_var]] + length(old_values) == length(sample_var_levels) && # nolint + all(sort(old_values) == sort(sample_var_levels))) { # nolint + selected_groups <- assign_lists[[experiment_name]][[sample_var]] # nolint } showModal(combModal( From 055376427f329f4c8ce0f987bdd586afb49303b1 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 9 Nov 2023 12:53:16 +0000 Subject: [PATCH 21/27] [skip actions] Restyle files --- R/sampleVarSpec.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/sampleVarSpec.R b/R/sampleVarSpec.R index 824fcbdc..bfd371fc 100644 --- a/R/sampleVarSpec.R +++ b/R/sampleVarSpec.R @@ -417,8 +417,8 @@ sampleVarSpecServer <- function(id, # nolint old_values <- names(assign_lists[[experiment_name]][[sample_var]]) if (!is.null(old_values) && - length(old_values) == length(sample_var_levels) && # nolint - all(sort(old_values) == sort(sample_var_levels))) { # nolint + length(old_values) == length(sample_var_levels) && # nolint + all(sort(old_values) == sort(sample_var_levels))) { # nolint selected_groups <- assign_lists[[experiment_name]][[sample_var]] # nolint } From ba3eb957c3903928f19d1ae6b5ab09c162ebc866 Mon Sep 17 00:00:00 2001 From: m7pr Date: Tue, 14 Nov 2023 11:36:48 +0100 Subject: [PATCH 22/27] change !!!datanames to default_cdisc_join_keys[datanames] --- R/adtteSpec.R | 2 +- R/forestplot.R | 4 ++-- R/km.R | 4 ++-- man/adtteSpecServer.Rd | 2 +- man/tm_g_forest_tte.Rd | 2 +- man/tm_g_km.Rd | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/R/adtteSpec.R b/R/adtteSpec.R index f5094004..1d1d97aa 100644 --- a/R/adtteSpec.R +++ b/R/adtteSpec.R @@ -216,7 +216,7 @@ adtteSpecInput <- function(inputId, # nolint #' }) #' datanames <- c("ADTTE", "MAE") #' datanames(data) <- datanames -#' join_keys(data) <- cdisc_join_keys(!!!datanames) +#' join_keys(data) <- default_cdisc_join_keys[datanames] #' #' app <- init( #' data = data, diff --git a/R/forestplot.R b/R/forestplot.R index 675fe937..6153e6b3 100644 --- a/R/forestplot.R +++ b/R/forestplot.R @@ -19,7 +19,7 @@ #' }) #' datanames <- c("ADTTE", "MAE") #' datanames(data) <- datanames -#' join_keys(data) <- cdisc_join_keys(!!!datanames) +#' join_keys(data) <- default_cdisc_join_keys[datanames] #' #' app <- init( #' data = data, @@ -291,7 +291,7 @@ sample_tm_g_forest_tte <- function() { # nolint }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames - join_keys(data) <- cdisc_join_keys(!!!datanames) + join_keys(data) <- default_cdisc_join_keys[datanames] app <- teal::init( data = data, diff --git a/R/km.R b/R/km.R index fda0b195..e1cd9eec 100644 --- a/R/km.R +++ b/R/km.R @@ -20,7 +20,7 @@ #' }) #' datanames <- c("ADTTE", "MAE") #' datanames(data) <- datanames -#' join_keys(data) <- cdisc_join_keys(!!!datanames) +#' join_keys(data) <- default_cdisc_join_keys[datanames] #' #' #' modules <- modules( @@ -283,7 +283,7 @@ sample_tm_g_km <- function() { # nolint }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames - join_keys(data) <- cdisc_join_keys(!!!datanames) + join_keys(data) <- default_cdisc_join_keys[datanames] modules <- teal::modules( tm_g_km( diff --git a/man/adtteSpecServer.Rd b/man/adtteSpecServer.Rd index 3af7e7db..0cd4bdcb 100644 --- a/man/adtteSpecServer.Rd +++ b/man/adtteSpecServer.Rd @@ -142,7 +142,7 @@ my_app <- function() { }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames - join_keys(data) <- cdisc_join_keys(!!!datanames) + join_keys(data) <- default_cdisc_join_keys[datanames] app <- init( data = data, diff --git a/man/tm_g_forest_tte.Rd b/man/tm_g_forest_tte.Rd index b0837354..7ce6b38f 100644 --- a/man/tm_g_forest_tte.Rd +++ b/man/tm_g_forest_tte.Rd @@ -127,7 +127,7 @@ data <- within(data, { }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames -join_keys(data) <- cdisc_join_keys(!!!datanames) +join_keys(data) <- default_cdisc_join_keys[datanames] app <- init( data = data, diff --git a/man/tm_g_km.Rd b/man/tm_g_km.Rd index 60ffa0fc..25d09a42 100644 --- a/man/tm_g_km.Rd +++ b/man/tm_g_km.Rd @@ -110,7 +110,7 @@ data <- within(data, { }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames -join_keys(data) <- cdisc_join_keys(!!!datanames) +join_keys(data) <- default_cdisc_join_keys[datanames] modules <- modules( From 8067448097c21c69769d58e5820b6059af5e0266 Mon Sep 17 00:00:00 2001 From: m7pr Date: Tue, 14 Nov 2023 11:37:32 +0100 Subject: [PATCH 23/27] bump teal.data version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 24655fc5..e2a455a5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -48,7 +48,7 @@ Imports: stats, stringr, SummarizedExperiment, - teal.data (>= 0.3.0.9008), + teal.data (>= 0.3.0.9009), teal.logger (>= 0.1.1), teal.reporter (>= 0.2.0), teal.widgets (>= 0.4.0), From 0bc4d93c891c5eda21001cdc70357383dedb1439 Mon Sep 17 00:00:00 2001 From: m7pr Date: Tue, 14 Nov 2023 11:39:52 +0100 Subject: [PATCH 24/27] remove rlang --- DESCRIPTION | 1 - NAMESPACE | 1 - R/package.R | 1 - 3 files changed, 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index e2a455a5..7528158a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -40,7 +40,6 @@ Imports: lifecycle, logger (>= 0.2.0), MultiAssayExperiment, - rlang, rtables (>= 0.5.1), S4Vectors, shinyRadioMatrix (>= 0.2.1), diff --git a/NAMESPACE b/NAMESPACE index 6c9c9049..76c52089 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -72,4 +72,3 @@ import(teal) importFrom(S4Vectors,DataFrame) importFrom(S4Vectors,setListElement) importFrom(lifecycle,deprecate_soft) -importFrom(rlang,`!!!`) diff --git a/R/package.R b/R/package.R index c14a6c49..52a51eff 100644 --- a/R/package.R +++ b/R/package.R @@ -10,5 +10,4 @@ #' @import teal #' @importFrom S4Vectors setListElement DataFrame #' @importFrom lifecycle deprecate_soft -#' @importFrom rlang `!!!` NULL From 43a3c9d0ac317722d1bfd69f111e8359bf978ee6 Mon Sep 17 00:00:00 2001 From: vedhav Date: Fri, 17 Nov 2023 18:24:31 +0530 Subject: [PATCH 25/27] chore: replace `runApp` with `shinyApp` --- tests/testthat/sampleVarSpec/app.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/sampleVarSpec/app.R b/tests/testthat/sampleVarSpec/app.R index 28ec16fe..1e61ff0a 100644 --- a/tests/testthat/sampleVarSpec/app.R +++ b/tests/testthat/sampleVarSpec/app.R @@ -51,7 +51,7 @@ my_app <- function() { ) ) ) - runApp(app) + shinyApp(app$ui, app$server) } my_app() From 347054d2ea9a3d5fd8b2fb9abc6d73cfc506f973 Mon Sep 17 00:00:00 2001 From: vedhav Date: Mon, 20 Nov 2023 16:25:38 +0530 Subject: [PATCH 26/27] chore: vbump --- DESCRIPTION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7528158a..9108208a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -30,7 +30,7 @@ Depends: ggplot2, R (>= 3.6), shiny, - teal (>= 0.14.0) + teal (>= 0.14.0.9019) Imports: checkmate, DT, @@ -47,7 +47,7 @@ Imports: stats, stringr, SummarizedExperiment, - teal.data (>= 0.3.0.9009), + teal.data (>= 0.3.0.9010), teal.logger (>= 0.1.1), teal.reporter (>= 0.2.0), teal.widgets (>= 0.4.0), From 8e281896bc65379f8574a2b42ba85d33cacfc4fe Mon Sep 17 00:00:00 2001 From: vedhav Date: Mon, 20 Nov 2023 16:52:11 +0530 Subject: [PATCH 27/27] fix: use proper keys for km and forest module --- R/forestplot.R | 4 ++-- R/km.R | 4 ++-- man/tm_g_forest_tte.Rd | 2 +- man/tm_g_km.Rd | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/R/forestplot.R b/R/forestplot.R index 6153e6b3..3b9c0625 100644 --- a/R/forestplot.R +++ b/R/forestplot.R @@ -19,7 +19,7 @@ #' }) #' datanames <- c("ADTTE", "MAE") #' datanames(data) <- datanames -#' join_keys(data) <- default_cdisc_join_keys[datanames] +#' join_keys(data)["ADTTE", "ADTTE"] <- c("STUDYID", "USUBJID", "PARAMCD") #' #' app <- init( #' data = data, @@ -291,7 +291,7 @@ sample_tm_g_forest_tte <- function() { # nolint }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames - join_keys(data) <- default_cdisc_join_keys[datanames] + join_keys(data)["ADTTE", "ADTTE"] <- c("STUDYID", "USUBJID", "PARAMCD") app <- teal::init( data = data, diff --git a/R/km.R b/R/km.R index e1cd9eec..0da8f8b5 100644 --- a/R/km.R +++ b/R/km.R @@ -20,7 +20,7 @@ #' }) #' datanames <- c("ADTTE", "MAE") #' datanames(data) <- datanames -#' join_keys(data) <- default_cdisc_join_keys[datanames] +#' join_keys(data)["ADTTE", "ADTTE"] <- c("STUDYID", "USUBJID", "PARAMCD") #' #' #' modules <- modules( @@ -283,7 +283,7 @@ sample_tm_g_km <- function() { # nolint }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames - join_keys(data) <- default_cdisc_join_keys[datanames] + join_keys(data)["ADTTE", "ADTTE"] <- c("STUDYID", "USUBJID", "PARAMCD") modules <- teal::modules( tm_g_km( diff --git a/man/tm_g_forest_tte.Rd b/man/tm_g_forest_tte.Rd index 7ce6b38f..03af5e88 100644 --- a/man/tm_g_forest_tte.Rd +++ b/man/tm_g_forest_tte.Rd @@ -127,7 +127,7 @@ data <- within(data, { }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames -join_keys(data) <- default_cdisc_join_keys[datanames] +join_keys(data)["ADTTE", "ADTTE"] <- c("STUDYID", "USUBJID", "PARAMCD") app <- init( data = data, diff --git a/man/tm_g_km.Rd b/man/tm_g_km.Rd index 25d09a42..9ffcf7f0 100644 --- a/man/tm_g_km.Rd +++ b/man/tm_g_km.Rd @@ -110,7 +110,7 @@ data <- within(data, { }) datanames <- c("ADTTE", "MAE") datanames(data) <- datanames -join_keys(data) <- default_cdisc_join_keys[datanames] +join_keys(data)["ADTTE", "ADTTE"] <- c("STUDYID", "USUBJID", "PARAMCD") modules <- modules(