Skip to content

Commit

Permalink
339 migrate to teal data@main (#342)
Browse files Browse the repository at this point in the history
Fixes #339 


Part of
- insightsengineering/nestdevs-tasks#41
- insightsengineering/teal.data#184

Partner of 
- insightsengineering/teal.modules.clinical#845
- insightsengineering/teal.modules.general#592
- insightsengineering/teal.modules.helios#103

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: vedhav <[email protected]>
  • Loading branch information
4 people authored Nov 20, 2023
1 parent 2b1ea05 commit fd679d9
Show file tree
Hide file tree
Showing 33 changed files with 125 additions and 220 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Depends:
ggplot2,
R (>= 3.6),
shiny,
teal (>= 0.14.0)
teal (>= 0.14.0.9019)
Imports:
checkmate,
DT,
Expand All @@ -47,7 +47,7 @@ Imports:
stats,
stringr,
SummarizedExperiment,
teal.data (>= 0.3.0),
teal.data (>= 0.3.0.9010),
teal.logger (>= 0.1.1),
teal.reporter (>= 0.2.0),
teal.widgets (>= 0.4.0),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 9 additions & 13 deletions R/adtteSpec.R
Original file line number Diff line number Diff line change
Expand Up @@ -208,19 +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
#' dplyr::mutate(is_event = .data$CNSR == 0)"
#' ),
#' dataset("MAE", mae)
#' )
#' 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) <- default_cdisc_join_keys[datanames]
#'
#' app <- init(
#' data = data,
Expand Down
5 changes: 1 addition & 4 deletions R/assaySpec.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 2 additions & 6 deletions R/barplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -246,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(
Expand Down
8 changes: 2 additions & 6 deletions R/boxplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -247,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(
Expand Down
9 changes: 3 additions & 6 deletions R/experimentSpec.R
Original file line number Diff line number Diff line change
Expand Up @@ -183,19 +183,16 @@ 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(
#' 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"
#' )
#' )
Expand Down
44 changes: 18 additions & 26 deletions R/forestplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,16 @@
#' @export
#'
#' @examples
#' mae <- hermes::multi_assay_experiment
#' 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
#' join_keys(data)["ADTTE", "ADTTE"] <- c("STUDYID", "USUBJID", "PARAMCD")
#'
#' data <- teal_data(
#' dataset(
#' "ADTTE",
#' adtte,
#' code = "adtte <- teal.modules.hermes::rADTTE %>%
#' dplyr::mutate(is_event = (.data$CNSR == 0))"
#' ),
#' dataset("MAE", mae)
#' )
#' app <- init(
#' data = data,
#' modules = modules(
Expand Down Expand Up @@ -286,20 +283,15 @@ srv_g_forest_tte <- function(id,
#' sample_tm_g_forest_tte()
#' }
sample_tm_g_forest_tte <- 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 %>%
dplyr::mutate(is_event = .data$CNSR == 0)"
),
teal.data::dataset("MAE", mae)
)
data <- teal_data()
data <- within(data, {
ADTTE <- teal.modules.hermes::rADTTE %>% # nolint
dplyr::mutate(is_event = .data$CNSR == 0)
MAE <- hermes::multi_assay_experiment # nolint
})
datanames <- c("ADTTE", "MAE")
datanames(data) <- datanames
join_keys(data)["ADTTE", "ADTTE"] <- c("STUDYID", "USUBJID", "PARAMCD")

app <- teal::init(
data = data,
Expand Down
4 changes: 1 addition & 3 deletions R/geneSpec.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
44 changes: 18 additions & 26 deletions R/km.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,16 @@
#' @export
#'
#' @examples
#' mae <- hermes::multi_assay_experiment
#' 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
#' join_keys(data)["ADTTE", "ADTTE"] <- c("STUDYID", "USUBJID", "PARAMCD")
#'
#' data <- teal_data(
#' dataset(
#' "ADTTE",
#' adtte,
#' code = "adtte <- teal.modules.hermes::rADTTE %>%
#' dplyr::mutate(is_event = (.data$CNSR == 0))"
#' ),
#' dataset("MAE", mae)
#' )
#'
#' modules <- modules(
#' tm_g_km(
Expand Down Expand Up @@ -278,20 +275,15 @@ srv_g_km <- function(id,
#' sample_tm_g_km()
#' }
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 %>%
dplyr::mutate(is_event = (.data$CNSR == 0))"
),
teal.data::dataset("MAE", mae)
)
data <- teal_data()
data <- within(data, {
ADTTE <- teal.modules.hermes::rADTTE %>% # nolint
dplyr::mutate(is_event = .data$CNSR == 0)
MAE <- hermes::multi_assay_experiment # nolint
})
datanames <- c("ADTTE", "MAE")
datanames(data) <- datanames
join_keys(data)["ADTTE", "ADTTE"] <- c("STUDYID", "USUBJID", "PARAMCD")

modules <- teal::modules(
tm_g_km(
Expand Down
8 changes: 2 additions & 6 deletions R/pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -451,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(
Expand Down
8 changes: 2 additions & 6 deletions R/quality.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -418,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(
Expand Down
10 changes: 4 additions & 6 deletions R/sampleVarSpec.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -419,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(
Expand Down
8 changes: 2 additions & 6 deletions R/scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -245,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(
Expand Down
8 changes: 2 additions & 6 deletions R/volcanoplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -267,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(
Expand Down
Loading

0 comments on commit fd679d9

Please sign in to comment.