Skip to content

Commit

Permalink
Merge branch 'main' into propagation-march-2024
Browse files Browse the repository at this point in the history
  • Loading branch information
walkowif authored Apr 3, 2024
2 parents c25591f + 37fc2a6 commit 9b94d23
Show file tree
Hide file tree
Showing 108 changed files with 5,068 additions and 243 deletions.
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/lorenzwalthert/precommit
rev: v0.4.0
rev: v0.4.1
hooks:
- id: style-files
name: Style code with `styler`
Expand All @@ -24,7 +24,6 @@ repos:
- forcats
- bioc::hermes
- lifecycle
- logger
- bioc::MultiAssayExperiment
- rtables
- S4Vectors
Expand Down
11 changes: 6 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: teal.modules.hermes
Title: RNA-Seq Analysis Modules to Add to a Teal Application
Version: 0.1.6.9003
Date: 2024-02-22
Version: 0.1.6.9010
Date: 2024-04-02
Authors@R: c(
person("Daniel", "Sabanés Bové", , "[email protected]", role = c("aut", "cre")),
person("Nikolas", "Burkoff", role = "aut"),
Expand Down Expand Up @@ -40,7 +40,6 @@ Imports:
forcats,
hermes (>= 1.7.1),
lifecycle,
logger (>= 0.2.0),
MultiAssayExperiment,
rtables (>= 0.5.1),
S4Vectors,
Expand All @@ -50,16 +49,18 @@ Imports:
stringr,
SummarizedExperiment,
teal.data (>= 0.3.0.9018),
teal.logger (>= 0.1.1),
teal.logger (>= 0.1.3.9013),
teal.reporter (>= 0.2.0),
teal.widgets (>= 0.4.0),
tern (>= 0.7.10)
tern (>= 0.7.10),
utils
Suggests:
BiocStyle,
covr,
dplyr,
globals,
knitr,
logger (>= 0.2.0),
matrixStats,
R6,
rmarkdown,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ import(teal.data)
importFrom(S4Vectors,DataFrame)
importFrom(S4Vectors,setListElement)
importFrom(lifecycle,deprecate_soft)
importFrom(utils,str)
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# teal.modules.hermes 0.1.6.9003
# teal.modules.hermes 0.1.6.9010

### Miscellaneous
* Added placeholders for `assaySpec`, `adtteSpec` and `geneSpec` inputs when no option is selected.
Expand Down
2 changes: 1 addition & 1 deletion R/adtteSpec.R
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ adtteSpecInput <- function(inputId, # nolint
#' checkmate::assert_class(shiny::isolate(data()), "teal_data")
#' moduleServer(id, function(input, output, session) {
#' output$encoding_ui <- renderUI({
#' div(
#' tags$div(
#' experimentSpecInput(session$ns("experiment"), data, mae_name = "MAE"),
#' assaySpecInput(session$ns("assay")),
#' geneSpecInput(session$ns("genes"), funs = list(Mean = colMeans)),
Expand Down
1 change: 1 addition & 0 deletions R/argument_convention.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#' @param plot_width (`list`)\cr list of integers to set the default, minimum,
#' and maximum plot width.
#' @param filter_panel_api (`FilterPanelAPI`)\cr object describing the actual filter panel API.
#' @param .test (`flag`)\cr whether to display the internal structure of the plot for testing purposes.
#'
#' @name module_arguments
#' @keywords internal
Expand Down
2 changes: 1 addition & 1 deletion R/assaySpec.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ assaySpecInput <- function(inputId, # nolint
#' server <- function(id, data, filter_panel_api) {
#' moduleServer(id, module = function(input, output, session) {
#' output$encoding_ui <- renderUI({
#' div(
#' tags$div(
#' experimentSpecInput(session$ns("experiment"), data, "MAE"),
#' assaySpecInput(
#' session$ns("assay"),
Expand Down
39 changes: 29 additions & 10 deletions R/barplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,33 @@ tm_g_barplot <- function(label,
Max = matrixStats::colMaxs
),
pre_output = NULL,
post_output = NULL) {
logger::log_info("Initializing tm_g_barplot")
post_output = NULL,
.test = FALSE) {
message("Initializing tm_g_barplot")
assert_string(label)
assert_string(mae_name)
assert_character(exclude_assays)
assert_summary_funs(summary_funs)
assert_tag(pre_output, null.ok = TRUE)
assert_tag(post_output, null.ok = TRUE)
assert_flag(.test)

module(
label = label,
server = srv_g_barplot,
server_args = list(
mae_name = mae_name,
exclude_assays = exclude_assays,
summary_funs = summary_funs
summary_funs = summary_funs,
.test = .test
),
ui = ui_g_barplot,
ui_args = list(
mae_name = mae_name,
summary_funs = summary_funs,
pre_output = pre_output,
post_output = post_output
post_output = post_output,
.test = .test
),
datanames = mae_name
)
Expand All @@ -69,10 +73,11 @@ ui_g_barplot <- function(id,
mae_name,
summary_funs,
pre_output,
post_output) {
post_output,
.test = FALSE) {
ns <- NS(id)
teal.widgets::standard_layout(
encoding = div(
encoding = tags$div(
### Reporter
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
###
Expand Down Expand Up @@ -101,7 +106,10 @@ ui_g_barplot <- function(id,
)
)
),
output = teal.widgets::plot_with_settings_ui(ns("plot")),
output = div(
if (.test) verbatimTextOutput(ns("table")) else NULL,
teal.widgets::plot_with_settings_ui(ns("plot"))
),
pre_output = pre_output,
post_output = post_output
)
Expand All @@ -116,11 +124,13 @@ srv_g_barplot <- function(id,
reporter,
mae_name,
exclude_assays,
summary_funs) {
summary_funs,
.test = FALSE) {
with_reporter <- !missing(reporter) && inherits(reporter, "Reporter")
assert_class(filter_panel_api, "FilterPanelAPI")
checkmate::assert_class(data, "reactive")
checkmate::assert_class(shiny::isolate(data()), "teal_data")
assert_flag(.test)
moduleServer(id, function(input, output, session) {
output$experiment_ui <- renderUI({
experimentSpecInput(session$ns("experiment"), data, mae_name)
Expand Down Expand Up @@ -189,6 +199,13 @@ srv_g_barplot <- function(id,
plot_r = plot_r
)

if (.test) {
table_r <- reactive({
utils::str(layer_data(plot_r()))
})
output$table <- renderPrint(table_r())
}

### REPORTER
if (with_reporter) {
card_fun <- function(comment, label) {
Expand Down Expand Up @@ -230,6 +247,7 @@ srv_g_barplot <- function(id,
card$append_text("Comment", "header3")
card$append_text(comment)
}

card
}
teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun)
Expand All @@ -246,14 +264,15 @@ srv_g_barplot <- function(id,
#' if (interactive()) {
#' sample_tm_g_barplot()
#' }
sample_tm_g_barplot <- function() {
sample_tm_g_barplot <- function(.test = FALSE) {
data <- teal.data::teal_data(MAE = hermes::multi_assay_experiment)
app <- teal::init(
data = data,
modules = teal::modules(
tm_g_barplot(
label = "barplot",
mae_name = "MAE"
mae_name = "MAE",
.test = .test
)
)
)
Expand Down
37 changes: 27 additions & 10 deletions R/boxplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,33 @@ tm_g_boxplot <- function(label,
Max = matrixStats::colMaxs
),
pre_output = NULL,
post_output = NULL) {
logger::log_info("Initializing tm_g_boxplot")
post_output = NULL,
.test = FALSE) {
message("Initializing tm_g_boxplot")
assert_string(label)
assert_string(mae_name)
assert_character(exclude_assays, any.missing = FALSE)
assert_summary_funs(summary_funs, null.ok = TRUE)
assert_tag(pre_output, null.ok = TRUE)
assert_tag(post_output, null.ok = TRUE)
assert_flag(.test)

teal::module(
label = label,
server = srv_g_boxplot,
server_args = list(
mae_name = mae_name,
summary_funs = summary_funs,
exclude_assays = exclude_assays
exclude_assays = exclude_assays,
.test = .test
),
ui = ui_g_boxplot,
ui_args = list(
mae_name = mae_name,
summary_funs = summary_funs,
pre_output = pre_output,
post_output = post_output
post_output = post_output,
.test = .test
),
datanames = mae_name
)
Expand All @@ -70,10 +74,11 @@ ui_g_boxplot <- function(id,
mae_name,
summary_funs,
pre_output,
post_output) {
post_output,
.test = FALSE) {
ns <- NS(id)
teal.widgets::standard_layout(
encoding = div(
encoding = tags$div(
### Reporter
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
###
Expand All @@ -97,7 +102,10 @@ ui_g_boxplot <- function(id,
)
)
),
output = teal.widgets::plot_with_settings_ui(ns("plot")),
output = div(
if (.test) verbatimTextOutput(ns("table")) else NULL,
teal.widgets::plot_with_settings_ui(ns("plot"))
),
pre_output = pre_output,
post_output = post_output
)
Expand All @@ -112,7 +120,8 @@ srv_g_boxplot <- function(id,
reporter,
mae_name,
exclude_assays,
summary_funs) {
summary_funs,
.test = FALSE) {
with_reporter <- !missing(reporter) && inherits(reporter, "Reporter")
assert_class(filter_panel_api, "FilterPanelAPI")
checkmate::assert_class(data, "reactive")
Expand Down Expand Up @@ -184,6 +193,13 @@ srv_g_boxplot <- function(id,
plot_r = plot_r
)

if (.test) {
table_r <- reactive({
utils::str(layer_data(plot_r()))
})
output$table <- renderPrint(table_r())
}

### REPORTER
if (with_reporter) {
card_fun <- function(comment, label) {
Expand Down Expand Up @@ -247,14 +263,15 @@ srv_g_boxplot <- function(id,
#' if (interactive()) {
#' sample_tm_g_boxplot()
#' }
sample_tm_g_boxplot <- function() {
sample_tm_g_boxplot <- function(.test = FALSE) {
data <- teal.data::teal_data(MAE = hermes::multi_assay_experiment)
app <- teal::init(
data = data,
modules = teal::modules(
tm_g_boxplot(
label = "boxplot",
mae_name = "MAE"
mae_name = "MAE",
.test = .test
)
)
)
Expand Down
4 changes: 2 additions & 2 deletions R/experimentSpec.R
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ h_gene_data <- function(object, name_annotation) {
#' ns <- NS(id)
#' teal.widgets::standard_layout(
#' encoding = uiOutput(ns("encoding_ui")),
#' output = div(
#' output = tags$div(
#' verbatimTextOutput(ns("summary")),
#' verbatimTextOutput(ns("head"))
#' )
Expand All @@ -145,7 +145,7 @@ h_gene_data <- function(object, name_annotation) {
#' mae_name) {
#' moduleServer(id, function(input, output, session) {
#' output$encoding_ui <- renderUI({
#' div(
#' tags$div(
#' experimentSpecInput(
#' session$ns("my_experiment"),
#' data,
Expand Down
Loading

0 comments on commit 9b94d23

Please sign in to comment.