Skip to content

Commit

Permalink
Merge 94536be into cd1d9d9
Browse files Browse the repository at this point in the history
  • Loading branch information
Polkas authored Jul 29, 2022
2 parents cd1d9d9 + 94536be commit b2c9d9e
Show file tree
Hide file tree
Showing 16 changed files with 378 additions and 757 deletions.
8 changes: 4 additions & 4 deletions R/geneSpec.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ geneSpecInput <- function(inputId,

ns <- NS(inputId)
tagList(
include_css_files(pattern = "*"),
div(
class = "row",
div(
Expand Down Expand Up @@ -94,8 +95,7 @@ geneSpecInput <- function(inputId,
icon_off = icon("fas fa-lock-open"),
animation = "pulse"
)
),
include_css_files(pattern = "*")
)
)
),
div(
Expand All @@ -109,8 +109,8 @@ geneSpecInput <- function(inputId,
options = list(
render = I("{
option: function(item, escape) {
return '<div> <div style = \"font-size: inherit; display: inline\">' + item.label + '</div>' +
' <div style=\"color: #808080; font-size: xx-small; display: inline\" >' + item.value + '</div> </div>'
return '<div> <span style=\"font-size: inherit;\">' + item.label + '</div>' +
' <span style=\"color: #808080; font-size: xx-small;\" >' + item.value + '</div> </div>'
}
}"),
searchField = c("value", "label"),
Expand Down
149 changes: 77 additions & 72 deletions R/pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,82 +67,87 @@ ui_g_pca <- function(id,
mae <- datasets$get_data(mae_name, filtered = FALSE)
experiment_name_choices <- names(mae)

teal.widgets::standard_layout(
encoding = div(
### Reporter
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
###
tags$label("Encodings", class = "text-primary"),
helpText("Analysis of MAE:", tags$code(mae_name)),
experimentSpecInput(ns("experiment"), datasets, mae_name),
assaySpecInput(ns("assay")),
conditionalPanel(
condition = "input.tab_selected == 'PCA'",
ns = ns,
sampleVarSpecInput(ns("color"), "Optional color variable"),
selectizeInput(ns("x_var"), "Select X-axis PC", choices = ""),
selectizeInput(ns("y_var"), "Select Y-axis PC", choices = "")
tagList(
teal.widgets::standard_layout(
include_css_files(pattern = "*"),
encoding = div(
### Reporter
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
###
tags$label("Encodings", class = "text-primary"),
helpText("Analysis of MAE:", tags$code(mae_name)),
experimentSpecInput(ns("experiment"), datasets, mae_name),
assaySpecInput(ns("assay")),
conditionalPanel(
condition = "input.tab_selected == 'PCA'",
ns = ns,
sampleVarSpecInput(ns("color"), "Optional color variable"),
selectizeInput(ns("x_var"), "Select X-axis PC", choices = ""),
selectizeInput(ns("y_var"), "Select Y-axis PC", choices = "")
),
teal.widgets::panel_group(
teal.widgets::panel_item(
input_id = "settings_item",
collapsed = TRUE,
title = "Additional Settings",
tags$label("Use only Top Variance Genes"),
shinyWidgets::switchInput(ns("filter_top"), value = FALSE, size = "mini"),
conditionalPanel(
condition = "input.filter_top",
ns = ns,
sliderInput(ns("n_top"), label = "Number of Top Genes", min = 10, max = 5000, value = 500)
),
conditionalPanel(
condition = "input.tab_selected == 'PCA'",
ns = ns,
tags$label("Show Variance %"),
shinyWidgets::switchInput(ns("var_pct"), value = TRUE, size = "mini"),
tags$label("Show Label"),
shinyWidgets::switchInput(ns("label"), value = TRUE, size = "mini")
),
conditionalPanel(
condition = "input.tab_selected == 'PC and Sample Correlation'",
ns = ns,
tags$label("Cluster columns"),
shinyWidgets::switchInput(ns("cluster_columns"), value = FALSE, size = "mini")
),
tags$label("View Matrix"),
shinyWidgets::switchInput(ns("show_matrix"), value = TRUE, size = "mini")
)
)
),
teal.widgets::panel_group(
teal.widgets::panel_item(
input_id = "settings_item",
collapsed = TRUE,
title = "Additional Settings",
tags$label("Use only Top Variance Genes"),
shinyWidgets::switchInput(ns("filter_top"), value = FALSE, size = "mini"),
conditionalPanel(
condition = "input.filter_top",
ns = ns,
sliderInput(ns("n_top"), label = "Number of Top Genes", min = 10, max = 5000, value = 500)
),
conditionalPanel(
condition = "input.tab_selected == 'PCA'",
ns = ns,
tags$label("Show Variance %"),
shinyWidgets::switchInput(ns("var_pct"), value = TRUE, size = "mini"),
tags$label("Show Label"),
shinyWidgets::switchInput(ns("label"), value = TRUE, size = "mini")
output = div(
style = "display:flow-root",
tabsetPanel(
id = ns("tab_selected"),
type = "tabs",
tabPanel(
"PCA",
column(
width = 12,
div(
class = "my-5",
plotOutput(ns("plot_pca"))
),
DT::DTOutput(ns("table_pca"))
)
),
conditionalPanel(
condition = "input.tab_selected == 'PC and Sample Correlation'",
ns = ns,
tags$label("Cluster columns"),
shinyWidgets::switchInput(ns("cluster_columns"), value = FALSE, size = "mini")
),
tags$label("View Matrix"),
shinyWidgets::switchInput(ns("show_matrix"), value = TRUE, size = "mini")
)
)
),
output = div(
style = "display:flow-root",
tabsetPanel(
id = ns("tab_selected"),
type = "tabs",
tabPanel(
"PCA",
column(
width = 12,
div(style = "height:20px;"),
plotOutput(ns("plot_pca")),
br(), br(), br(),
DT::DTOutput(ns("table_pca"))
)
),
tabPanel(
"PC and Sample Correlation",
column(
width = 12,
div(style = "height:20px;"),
plotOutput(ns("plot_cor")),
br(), br(), br(),
DT::DTOutput(ns("table_cor"))
tabPanel(
"PC and Sample Correlation",
column(
width = 12,
div(
class = "my-5",
plotOutput(ns("plot_cor"))
),
DT::DTOutput(ns("table_cor"))
)
)
)
)
),
pre_output = pre_output,
post_output = post_output
),
pre_output = pre_output,
post_output = post_output
)
)
}

Expand Down
8 changes: 4 additions & 4 deletions R/sampleVarSpec.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ sampleVarSpecInput <- function(inputId,

ns <- NS(inputId)
tagList(
include_css_files(pattern = "*"),
div(
class = "row",
div(
Expand All @@ -39,8 +40,7 @@ sampleVarSpecInput <- function(inputId,
span(icon("fas fa-table")),
title = label_levels_button,
class = "pull-right list-genes"
),
include_css_files(pattern = "*")
)
)
),
div(
Expand Down Expand Up @@ -402,8 +402,8 @@ sampleVarSpecServer <- function(id,

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))) {
length(old_values) == length(sample_var_levels) &&
all(sort(old_values) == sort(sample_var_levels))) {
selected_groups <- assign_lists[[experiment_name]][[sample_var]]
}

Expand Down
3 changes: 1 addition & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ include_css_files <- function(pattern = "*") { # nolint
system.file("css", package = "teal.modules.hermes", mustWork = TRUE),
pattern = pattern, full.names = TRUE
)
return(singleton(lapply(css_files, includeCSS)))
return(shiny::singleton(shiny::tags$head(lapply(css_files, includeCSS))))
}


#' Include `JS` files from `/inst/js/` package directory to application header
#'
#' `system.file` should not be used to access files in other packages, it does
Expand Down
62 changes: 32 additions & 30 deletions design/design_combine_levels.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -213,42 +213,44 @@ ui_g_levels <- function(id,
mae <- datasets$get_data(mae_name, filtered = FALSE)
experiment_name_choices <- names(mae)
teal.widgets::standard_layout(
encoding = div(
selectInput(ns("experiment_name"), "Select experiment", experiment_name_choices),
div(
class = "row",
tagList(
include_css_files(pattern = "*"),
teal.widgets::standard_layout(
encoding = div(
selectInput(ns("experiment_name"), "Select experiment", experiment_name_choices),
div(
class = "col-sm-8",
tags$label(
class = "control-label",
"Select faceting variable"
class = "row",
div(
class = "col-sm-8",
tags$label(
class = "control-label",
"Select faceting variable"
)
),
div(
class = "col-sm-4",
actionButton(
ns("open_levels_input"),
span(icon("font fa-object-ungroup")),
title = "Combine factor levels",
class = "pull-right list-genes"
)
)
),
div(
class = "col-sm-4",
actionButton(
ns("open_levels_input"),
span(icon("font fa-object-ungroup")),
title = "Combine factor levels",
class = "pull-right list-genes"
),
include_css_files(pattern = "*")
class = "custom-select-input",
teal.widgets::optionalSelectInput(
ns("facet_var"),
label = NULL,
choices = "",
multiple = FALSE
)
)
),
div(
class = "custom-select-input",
teal.widgets::optionalSelectInput(
ns("facet_var"),
label = NULL,
choices = "",
multiple = FALSE
)
)
),
output = plotOutput(ns("plot")),
pre_output = pre_output,
post_output = post_output
output = plotOutput(ns("plot")),
pre_output = pre_output,
post_output = post_output
)
)
}
```
Expand Down
Loading

0 comments on commit b2c9d9e

Please sign in to comment.