From 71111ad58da1d6512cdbd418becf1f9a0763e481 Mon Sep 17 00:00:00 2001 From: JohnFOuyang Date: Tue, 6 Jul 2021 15:15:38 +0800 Subject: [PATCH] updated subset cell functionality to all plots --- DESCRIPTION | 2 +- R/makeShinyApp.R | 7 +- R/makeShinyCodes.R | 20 +- R/makeShinyCodesMulti.R | 25 ++- R/writer.R | 372 +++++++++++++++++++------------------ man/makeShinyApp.Rd | 8 + man/makeShinyCodes.Rd | 8 + man/makeShinyCodesMulti.Rd | 12 +- man/wrSVmain.Rd | 2 +- man/wrUImain.Rd | 2 +- 10 files changed, 261 insertions(+), 197 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b06ed6b..29599e9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: ShinyCell Type: Package Title: Shiny Interactive Web Apps for Single-Cell Data -Version: 2.0.0 +Version: 2.1.0 Author: John F. Ouyang Maintainer: John F. Ouyang Description: Shiny apps for interactive exploration of single-cell data diff --git a/R/makeShinyApp.R b/R/makeShinyApp.R index 150b9e0..1236820 100644 --- a/R/makeShinyApp.R +++ b/R/makeShinyApp.R @@ -33,6 +33,10 @@ #' page, year, doi, link. See example below. #' @param shiny.dir specify directory to create the shiny app in. Default is #' to create a new directory named "shinyApp" +#' @param enableSubset specify whether to enable "Toggle to subset cells" +#' functionality in the shiny app. Default is to enable this functionality +#' @param defPtSiz specify default point size for single cells. For example, a +#' smaller size can be used if you have many cells in your dataset #' @param ganalytics Google analytics tracking ID (e.g. "UA-123456789-0") #' @param default.gene1 specify primary default gene to show #' @param default.gene2 specify secondary default gene to show @@ -71,7 +75,7 @@ makeShinyApp <- function( obj, scConf, gex.assay = NA, gex.slot = c("data", "scale.data", "counts"), gene.mapping = FALSE, shiny.title = "scRNA-seq shiny app", shiny.footnotes = "", - shiny.dir = "shinyApp/", ganalytics = NA, + shiny.dir = "shinyApp/", enableSubset = TRUE, defPtSiz = 1.25, ganalytics=NA, default.gene1 = NA, default.gene2 = NA, default.multigene = NA, default.dimred = NA){ @@ -84,6 +88,7 @@ makeShinyApp <- function( default.gene1, default.gene2, default.multigene, default.dimred) makeShinyCodes(shiny.title = shiny.title, shiny.footnotes = shiny.footnotes, shiny.prefix = "sc1", shiny.dir = shiny.dir, + enableSubset = enableSubset, defPtSiz = defPtSiz, ganalytics = ganalytics) } diff --git a/R/makeShinyCodes.R b/R/makeShinyCodes.R index 0656dd6..abfb16b 100644 --- a/R/makeShinyCodes.R +++ b/R/makeShinyCodes.R @@ -13,6 +13,10 @@ #' page, year, doi, link. See example below. #' @param shiny.prefix specify file prefix #' @param shiny.dir specify directory to create the shiny app in +#' @param enableSubset specify whether to enable "Toggle to subset cells" +#' functionality in the shiny app. Default is to enable this functionality +#' @param defPtSiz specify default point size for single cells. For example, a +#' smaller size can be used if you have many cells in your dataset #' @param ganalytics Google analytics tracking ID (e.g. "UA-123456789-0") #' #' @return server.R and ui.R required for shiny app @@ -37,7 +41,13 @@ #' #' @export makeShinyCodes <- function(shiny.title, shiny.footnotes, - shiny.prefix, shiny.dir, ganalytics = NA){ + shiny.prefix, shiny.dir, + enableSubset = TRUE, defPtSiz = 1.25, + ganalytics = NA){ + subst = "#" + if(enableSubset){subst = ""} + defPtSiz = as.character(defPtSiz) + if(packageVersion("readr") >= "1.4.0"){ ### Write code for server.R fname = paste0(shiny.dir, "/server.R") @@ -46,7 +56,7 @@ makeShinyCodes <- function(shiny.title, shiny.footnotes, "ggrepel","hdf5r","ggdendro","gridExtra")), file = fname) readr::write_file(wrSVload(shiny.prefix), append = TRUE, file = fname) readr::write_file(wrSVfix(), append = TRUE, file = fname) - readr::write_file(wrSVmain(shiny.prefix), append = TRUE, file = fname) + readr::write_file(wrSVmain(shiny.prefix, subst), append = TRUE, file = fname) readr::write_file(wrSVend(), append = TRUE, file = fname) @@ -56,7 +66,7 @@ makeShinyCodes <- function(shiny.title, shiny.footnotes, c("shiny","shinyhelper","data.table","Matrix","DT","magrittr")), file = fname) readr::write_file(wrUIload(shiny.prefix), append = TRUE, file = fname) readr::write_file(wrUIsingle(shiny.title, ganalytics), append = TRUE, file = fname) - readr::write_file(wrUImain(shiny.prefix), append = TRUE, file = fname) + readr::write_file(wrUImain(shiny.prefix, subst, defPtSiz), append = TRUE, file = fname) readr::write_file(glue::glue(', \n'), append = TRUE, file = fname) readr::write_file(wrUIend(shiny.footnotes), append = TRUE, file = fname) @@ -75,7 +85,7 @@ makeShinyCodes <- function(shiny.title, shiny.footnotes, "ggrepel","hdf5r","ggdendro","gridExtra")), path = fname) readr::write_file(wrSVload(shiny.prefix), append = TRUE, path = fname) readr::write_file(wrSVfix(), append = TRUE, path = fname) - readr::write_file(wrSVmain(shiny.prefix), append = TRUE, path = fname) + readr::write_file(wrSVmain(shiny.prefix, subst), append = TRUE, path = fname) readr::write_file(wrSVend(), append = TRUE, path = fname) @@ -85,7 +95,7 @@ makeShinyCodes <- function(shiny.title, shiny.footnotes, c("shiny","shinyhelper","data.table","Matrix","DT","magrittr")), path = fname) readr::write_file(wrUIload(shiny.prefix), append = TRUE, path = fname) readr::write_file(wrUIsingle(shiny.title, ganalytics), append = TRUE, path = fname) - readr::write_file(wrUImain(shiny.prefix), append = TRUE, path = fname) + readr::write_file(wrUImain(shiny.prefix, subst, defPtSiz), append = TRUE, path = fname) readr::write_file(glue::glue(', \n'), append = TRUE, path = fname) readr::write_file(wrUIend(shiny.footnotes), append = TRUE, path = fname) diff --git a/R/makeShinyCodesMulti.R b/R/makeShinyCodesMulti.R index 9c5082a..ac52460 100644 --- a/R/makeShinyCodesMulti.R +++ b/R/makeShinyCodesMulti.R @@ -16,6 +16,12 @@ #' @param shiny.headers specify the tab header names for each dataset. Length #' must match that of \code{shiny.prefix} #' @param shiny.dir specify directory to create the shiny app in +#' @param enableSubset specify whether to enable "Toggle to subset cells" +#' functionality in the shiny app. Default is to enable this functionality +#' @param defPtSiz specify default point size for single cells. For example, a +#' smaller size can be used if you have many cells in your dataset. A single +#' value can be specified to set the point size for all datasets. Otherwise, +#' users have to specify one value for each dataset #' @param ganalytics Google analytics tracking ID (e.g. "UA-123456789-0") #' #' @return server.R and ui.R required for shiny app @@ -36,18 +42,25 @@ #' doi = "10.1038/s41586-020-2734-6", #' link = "https://www.nature.com/articles/s41586-020-2734-6") #' makeShinyCodes(shiny.title = "scRNA-seq shiny app", shiny.footnotes = "", -#' shiny.prefix = c("sc1", "sc2"), +#' shiny.prefix = c("sc1", "sc2"), defPtSiz = c(1.25, 1.5), #' shiny.headers = c("dataset1", "dataset2"), #' shiny.dir = "shinyApp/") #' #' @export makeShinyCodesMulti <- function(shiny.title, shiny.footnotes, shiny.prefix, shiny.headers, shiny.dir, + enableSubset = TRUE, defPtSiz = 1.25, ganalytics = NA){ ### Checks if(length(shiny.prefix) != length(shiny.headers)){ stop("length of shiny.prefix and shiny.headers does not match!") } + subst = "#" + if(enableSubset){subst = ""} + if(length(shiny.prefix) != length(defPtSiz)){ + defPtSiz = rep(defPtSiz[1], length(shiny.prefix)) + } + defPtSiz = as.character(defPtSiz) if(packageVersion("readr") >= "1.4.0"){ ### Write code for server.R @@ -60,7 +73,7 @@ makeShinyCodesMulti <- function(shiny.title, shiny.footnotes, } readr::write_file(wrSVfix(), append = TRUE, file = fname) for(i in shiny.prefix){ - readr::write_file(wrSVmain(i), append = TRUE, file = fname) + readr::write_file(wrSVmain(i, subst), append = TRUE, file = fname) } readr::write_file(wrSVend(), append = TRUE, file = fname) @@ -77,7 +90,8 @@ makeShinyCodesMulti <- function(shiny.title, shiny.footnotes, hhh = shiny.headers[i] readr::write_file(glue::glue('navbarMenu("{hhh}",'), append = TRUE, file = fname) - readr::write_file(wrUImain(shiny.prefix[i]), append = TRUE, file = fname) + readr::write_file(wrUImain(shiny.prefix[i], subst, defPtSiz[i]), + append = TRUE, file = fname) readr::write_file(glue::glue('), \n\n\n'), append = TRUE, file = fname) } readr::write_file(wrUIend(shiny.footnotes), append = TRUE, file = fname) @@ -100,7 +114,7 @@ makeShinyCodesMulti <- function(shiny.title, shiny.footnotes, } readr::write_file(wrSVfix(), append = TRUE, path = fname) for(i in shiny.prefix){ - readr::write_file(wrSVmain(i), append = TRUE, path = fname) + readr::write_file(wrSVmain(i, subst), append = TRUE, path = fname) } readr::write_file(wrSVend(), append = TRUE, path = fname) @@ -117,7 +131,8 @@ makeShinyCodesMulti <- function(shiny.title, shiny.footnotes, hhh = shiny.headers[i] readr::write_file(glue::glue('navbarMenu("{hhh}",'), append = TRUE, path = fname) - readr::write_file(wrUImain(shiny.prefix[i]), append = TRUE, path = fname) + readr::write_file(wrUImain(shiny.prefix[i], subst, defPtSiz[i]), + append = TRUE, path = fname) readr::write_file(glue::glue('), \n\n\n'), append = TRUE, path = fname) } readr::write_file(wrUIend(shiny.footnotes), append = TRUE, path = fname) diff --git a/R/writer.R b/R/writer.R index e0cf8c9..18acce0 100644 --- a/R/writer.R +++ b/R/writer.R @@ -89,6 +89,7 @@ wrSVfix <- function() { '# Plot cell information on dimred \n', 'scDRcell <- function(inpConf, inpMeta, inpdrX, inpdrY, inp1, inpsub1, inpsub2, \n', ' inpsiz, inpcol, inpord, inpfsz, inpasp, inptxt, inplab){{ \n', + ' if(is.null(inpsub1)){{inpsub1 = inpConf$UI[1]}} \n', ' # Prepare ggData \n', ' ggData = inpMeta[, c(inpConf[UI == inpdrX]$ID, inpConf[UI == inpdrY]$ID, \n', ' inpConf[UI == inp1]$ID, inpConf[UI == inpsub1]$ID), \n', @@ -157,6 +158,7 @@ wrSVfix <- function() { ' \n', 'scDRnum <- function(inpConf, inpMeta, inp1, inp2, inpsub1, inpsub2, \n', ' inpH5, inpGene, inpsplt){{ \n', + ' if(is.null(inpsub1)){{inpsub1 = inpConf$UI[1]}} \n', ' # Prepare ggData \n', ' ggData = inpMeta[, c(inpConf[UI == inp1]$ID, inpConf[UI == inpsub1]$ID), \n', ' with = FALSE] \n', @@ -194,6 +196,7 @@ wrSVfix <- function() { 'scDRgene <- function(inpConf, inpMeta, inpdrX, inpdrY, inp1, inpsub1, inpsub2, \n', ' inpH5, inpGene, \n', ' inpsiz, inpcol, inpord, inpfsz, inpasp, inptxt){{ \n', + ' if(is.null(inpsub1)){{inpsub1 = inpConf$UI[1]}} \n', ' # Prepare ggData \n', ' ggData = inpMeta[, c(inpConf[UI == inpdrX]$ID, inpConf[UI == inpdrY]$ID, \n', ' inpConf[UI == inpsub1]$ID), \n', @@ -248,6 +251,7 @@ wrSVfix <- function() { 'scDRcoex <- function(inpConf, inpMeta, inpdrX, inpdrY, inp1, inp2, \n', ' inpsub1, inpsub2, inpH5, inpGene, \n', ' inpsiz, inpcol, inpord, inpfsz, inpasp, inptxt){{ \n', + ' if(is.null(inpsub1)){{inpsub1 = inpConf$UI[1]}} \n', ' # Prepare ggData \n', ' ggData = inpMeta[, c(inpConf[UI == inpdrX]$ID, inpConf[UI == inpdrY]$ID, \n', ' inpConf[UI == inpsub1]$ID), \n', @@ -365,6 +369,7 @@ wrSVfix <- function() { ' \n', 'scDRcoexNum <- function(inpConf, inpMeta, inp1, inp2, \n', ' inpsub1, inpsub2, inpH5, inpGene){{ \n', + ' if(is.null(inpsub1)){{inpsub1 = inpConf$UI[1]}} \n', ' # Prepare ggData \n', ' ggData = inpMeta[, c(inpConf[UI == inpsub1]$ID), with = FALSE] \n', ' colnames(ggData) = c("sub") \n', @@ -396,6 +401,7 @@ wrSVfix <- function() { 'scVioBox <- function(inpConf, inpMeta, inp1, inp2, \n', ' inpsub1, inpsub2, inpH5, inpGene, \n', ' inptyp, inppts, inpsiz, inpfsz){{ \n', + ' if(is.null(inpsub1)){{inpsub1 = inpConf$UI[1]}} \n', ' # Prepare ggData \n', ' ggData = inpMeta[, c(inpConf[UI == inp1]$ID, inpConf[UI == inpsub1]$ID), \n', ' with = FALSE] \n', @@ -444,6 +450,7 @@ wrSVfix <- function() { '# Plot proportion plot \n', 'scProp <- function(inpConf, inpMeta, inp1, inp2, inpsub1, inpsub2, \n', ' inptyp, inpflp, inpfsz){{ \n', + ' if(is.null(inpsub1)){{inpsub1 = inpConf$UI[1]}} \n', ' # Prepare ggData \n', ' ggData = inpMeta[, c(inpConf[UI == inp1]$ID, inpConf[UI == inp2]$ID, \n', ' inpConf[UI == inpsub1]$ID), \n', @@ -494,6 +501,7 @@ wrSVfix <- function() { 'scBubbHeat <- function(inpConf, inpMeta, inp, inpGrp, inpPlt, \n', ' inpsub1, inpsub2, inpH5, inpGene, inpScl, inpRow, inpCol, \n', ' inpcols, inpfsz, save = FALSE){{ \n', + ' if(is.null(inpsub1)){{inpsub1 = inpConf$UI[1]}} \n', ' # Identify genes that are in our dataset \n', ' geneList = scGeneList(inp, inpGene) \n', ' geneList = geneList[present == TRUE] \n', @@ -645,7 +653,7 @@ wrSVfix <- function() { #' @rdname wrSVmain #' @export wrSVmain #' -wrSVmain <- function(prefix) { +wrSVmain <- function(prefix, subst = "") { glue::glue('optCrt="{{ option_create: function(data,escape) {{return(\'
\' + \'
\');}} }}" \n', ' updateSelectizeInput(session, "{prefix}a1inp2", choices = names({prefix}gene), server = TRUE, \n', ' selected = {prefix}def$gene1, options = list( \n', @@ -670,21 +678,21 @@ wrSVmain <- function(prefix) { ' \n', ' \n', ' ### Plots for tab a1 \n', - ' output${prefix}a1sub1.ui <- renderUI({{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}a1sub1]$fID, "\\\\|")[[1]] \n', - ' checkboxGroupInput("{prefix}a1sub2", "Select which cells to show", inline = TRUE, \n', - ' choices = sub, selected = sub) \n', - ' }}) \n', - ' observeEvent(input${prefix}a1sub1non, {{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}a1sub1]$fID, "\\\\|")[[1]] \n', - ' updateCheckboxGroupInput(session, inputId = "{prefix}a1sub2", label = "Select which cells to show", \n', - ' choices = sub, selected = NULL, inline = TRUE) \n', - ' }}) \n', - ' observeEvent(input${prefix}a1sub1all, {{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}a1sub1]$fID, "\\\\|")[[1]] \n', - ' updateCheckboxGroupInput(session, inputId = "{prefix}a1sub2", label = "Select which cells to show", \n', - ' choices = sub, selected = sub, inline = TRUE) \n', - ' }}) \n', + '{subst} output${prefix}a1sub1.ui <- renderUI({{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}a1sub1]$fID, "\\\\|")[[1]] \n', + '{subst} checkboxGroupInput("{prefix}a1sub2", "Select which cells to show", inline = TRUE, \n', + '{subst} choices = sub, selected = sub) \n', + '{subst} }}) \n', + '{subst} observeEvent(input${prefix}a1sub1non, {{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}a1sub1]$fID, "\\\\|")[[1]] \n', + '{subst} updateCheckboxGroupInput(session, inputId = "{prefix}a1sub2", label = "Select which cells to show", \n', + '{subst} choices = sub, selected = NULL, inline = TRUE) \n', + '{subst} }}) \n', + '{subst} observeEvent(input${prefix}a1sub1all, {{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}a1sub1]$fID, "\\\\|")[[1]] \n', + '{subst} updateCheckboxGroupInput(session, inputId = "{prefix}a1sub2", label = "Select which cells to show", \n', + '{subst} choices = sub, selected = sub, inline = TRUE) \n', + '{subst} }}) \n', ' output${prefix}a1oup1 <- renderPlot({{ \n', ' scDRcell({prefix}conf, {prefix}meta, input${prefix}a1drX, input${prefix}a1drY, input${prefix}a1inp1, \n', ' input${prefix}a1sub1, input${prefix}a1sub2, \n', @@ -758,21 +766,21 @@ wrSVmain <- function(prefix) { ' \n', ' \n', ' ### Plots for tab a2 \n', - ' output${prefix}a2sub1.ui <- renderUI({{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}a2sub1]$fID, "\\\\|")[[1]] \n', - ' checkboxGroupInput("{prefix}a2sub2", "Select which cells to show", inline = TRUE, \n', - ' choices = sub, selected = sub) \n', - ' }}) \n', - ' observeEvent(input${prefix}a2sub1non, {{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}a2sub1]$fID, "\\\\|")[[1]] \n', - ' updateCheckboxGroupInput(session, inputId = "{prefix}a2sub2", label = "Select which cells to show", \n', - ' choices = sub, selected = NULL, inline = TRUE) \n', - ' }}) \n', - ' observeEvent(input${prefix}a2sub1all, {{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}a2sub1]$fID, "\\\\|")[[1]] \n', - ' updateCheckboxGroupInput(session, inputId = "{prefix}a2sub2", label = "Select which cells to show", \n', - ' choices = sub, selected = sub, inline = TRUE) \n', - ' }}) \n', + '{subst} output${prefix}a2sub1.ui <- renderUI({{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}a2sub1]$fID, "\\\\|")[[1]] \n', + '{subst} checkboxGroupInput("{prefix}a2sub2", "Select which cells to show", inline = TRUE, \n', + '{subst} choices = sub, selected = sub) \n', + '{subst} }}) \n', + '{subst} observeEvent(input${prefix}a2sub1non, {{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}a2sub1]$fID, "\\\\|")[[1]] \n', + '{subst} updateCheckboxGroupInput(session, inputId = "{prefix}a2sub2", label = "Select which cells to show", \n', + '{subst} choices = sub, selected = NULL, inline = TRUE) \n', + '{subst} }}) \n', + '{subst} observeEvent(input${prefix}a2sub1all, {{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}a2sub1]$fID, "\\\\|")[[1]] \n', + '{subst} updateCheckboxGroupInput(session, inputId = "{prefix}a2sub2", label = "Select which cells to show", \n', + '{subst} choices = sub, selected = sub, inline = TRUE) \n', + '{subst} }}) \n', ' output${prefix}a2oup1 <- renderPlot({{ \n', ' scDRcell({prefix}conf, {prefix}meta, input${prefix}a2drX, input${prefix}a2drY, input${prefix}a2inp1, \n', ' input${prefix}a2sub1, input${prefix}a2sub2, \n', @@ -835,21 +843,21 @@ wrSVmain <- function(prefix) { ' \n', ' \n', ' ### Plots for tab a3 \n', - ' output${prefix}a3sub1.ui <- renderUI({{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}a3sub1]$fID, "\\\\|")[[1]] \n', - ' checkboxGroupInput("{prefix}a3sub2", "Select which cells to show", inline = TRUE, \n', - ' choices = sub, selected = sub) \n', - ' }}) \n', - ' observeEvent(input${prefix}a3sub1non, {{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}a3sub1]$fID, "\\\\|")[[1]] \n', - ' updateCheckboxGroupInput(session, inputId = "{prefix}a3sub2", label = "Select which cells to show", \n', - ' choices = sub, selected = NULL, inline = TRUE) \n', - ' }}) \n', - ' observeEvent(input${prefix}a3sub1all, {{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}a3sub1]$fID, "\\\\|")[[1]] \n', - ' updateCheckboxGroupInput(session, inputId = "{prefix}a3sub2", label = "Select which cells to show", \n', - ' choices = sub, selected = sub, inline = TRUE) \n', - ' }}) \n', + '{subst} output${prefix}a3sub1.ui <- renderUI({{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}a3sub1]$fID, "\\\\|")[[1]] \n', + '{subst} checkboxGroupInput("{prefix}a3sub2", "Select which cells to show", inline = TRUE, \n', + '{subst} choices = sub, selected = sub) \n', + '{subst} }}) \n', + '{subst} observeEvent(input${prefix}a3sub1non, {{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}a3sub1]$fID, "\\\\|")[[1]] \n', + '{subst} updateCheckboxGroupInput(session, inputId = "{prefix}a3sub2", label = "Select which cells to show", \n', + '{subst} choices = sub, selected = NULL, inline = TRUE) \n', + '{subst} }}) \n', + '{subst} observeEvent(input${prefix}a3sub1all, {{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}a3sub1]$fID, "\\\\|")[[1]] \n', + '{subst} updateCheckboxGroupInput(session, inputId = "{prefix}a3sub2", label = "Select which cells to show", \n', + '{subst} choices = sub, selected = sub, inline = TRUE) \n', + '{subst} }}) \n', ' output${prefix}a3oup1 <- renderPlot({{ \n', ' scDRgene({prefix}conf, {prefix}meta, input${prefix}a3drX, input${prefix}a3drY, input${prefix}a3inp1, \n', ' input${prefix}a3sub1, input${prefix}a3sub2, \n', @@ -918,21 +926,21 @@ wrSVmain <- function(prefix) { ' \n', ' \n', ' ### Plots for tab b2 \n', - ' output${prefix}b2sub1.ui <- renderUI({{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}b2sub1]$fID, "\\\\|")[[1]] \n', - ' checkboxGroupInput("{prefix}b2sub2", "Select which cells to show", inline = TRUE, \n', - ' choices = sub, selected = sub) \n', - ' }}) \n', - ' observeEvent(input${prefix}b2sub1non, {{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}b2sub1]$fID, "\\\\|")[[1]] \n', - ' updateCheckboxGroupInput(session, inputId = "{prefix}b2sub2", label = "Select which cells to show", \n', - ' choices = sub, selected = NULL, inline = TRUE) \n', - ' }}) \n', - ' observeEvent(input${prefix}b2sub1all, {{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}b2sub1]$fID, "\\\\|")[[1]] \n', - ' updateCheckboxGroupInput(session, inputId = "{prefix}b2sub2", label = "Select which cells to show", \n', - ' choices = sub, selected = sub, inline = TRUE) \n', - ' }}) \n', + '{subst} output${prefix}b2sub1.ui <- renderUI({{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}b2sub1]$fID, "\\\\|")[[1]] \n', + '{subst} checkboxGroupInput("{prefix}b2sub2", "Select which cells to show", inline = TRUE, \n', + '{subst} choices = sub, selected = sub) \n', + '{subst} }}) \n', + '{subst} observeEvent(input${prefix}b2sub1non, {{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}b2sub1]$fID, "\\\\|")[[1]] \n', + '{subst} updateCheckboxGroupInput(session, inputId = "{prefix}b2sub2", label = "Select which cells to show", \n', + '{subst} choices = sub, selected = NULL, inline = TRUE) \n', + '{subst} }}) \n', + '{subst} observeEvent(input${prefix}b2sub1all, {{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}b2sub1]$fID, "\\\\|")[[1]] \n', + '{subst} updateCheckboxGroupInput(session, inputId = "{prefix}b2sub2", label = "Select which cells to show", \n', + '{subst} choices = sub, selected = sub, inline = TRUE) \n', + '{subst} }}) \n', ' output${prefix}b2oup1 <- renderPlot({{ \n', ' scDRcoex({prefix}conf, {prefix}meta, input${prefix}b2drX, input${prefix}b2drY, \n', ' input${prefix}b2inp1, input${prefix}b2inp2, input${prefix}b2sub1, input${prefix}b2sub2, \n', @@ -995,21 +1003,21 @@ wrSVmain <- function(prefix) { ' \n', ' \n', ' ### Plots for tab c1 \n', - ' output${prefix}c1sub1.ui <- renderUI({{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}c1sub1]$fID, "\\\\|")[[1]] \n', - ' checkboxGroupInput("{prefix}c1sub2", "Select which cells to show", inline = TRUE, \n', - ' choices = sub, selected = sub) \n', - ' }}) \n', - ' observeEvent(input${prefix}c1sub1non, {{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}c1sub1]$fID, "\\\\|")[[1]] \n', - ' updateCheckboxGroupInput(session, inputId = "{prefix}c1sub2", label = "Select which cells to show", \n', - ' choices = sub, selected = NULL, inline = TRUE) \n', - ' }}) \n', - ' observeEvent(input${prefix}c1sub1all, {{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}c1sub1]$fID, "\\\\|")[[1]] \n', - ' updateCheckboxGroupInput(session, inputId = "{prefix}c1sub2", label = "Select which cells to show", \n', - ' choices = sub, selected = sub, inline = TRUE) \n', - ' }}) \n', + '{subst} output${prefix}c1sub1.ui <- renderUI({{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}c1sub1]$fID, "\\\\|")[[1]] \n', + '{subst} checkboxGroupInput("{prefix}c1sub2", "Select which cells to show", inline = TRUE, \n', + '{subst} choices = sub, selected = sub) \n', + '{subst} }}) \n', + '{subst} observeEvent(input${prefix}c1sub1non, {{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}c1sub1]$fID, "\\\\|")[[1]] \n', + '{subst} updateCheckboxGroupInput(session, inputId = "{prefix}c1sub2", label = "Select which cells to show", \n', + '{subst} choices = sub, selected = NULL, inline = TRUE) \n', + '{subst} }}) \n', + '{subst} observeEvent(input${prefix}c1sub1all, {{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}c1sub1]$fID, "\\\\|")[[1]] \n', + '{subst} updateCheckboxGroupInput(session, inputId = "{prefix}c1sub2", label = "Select which cells to show", \n', + '{subst} choices = sub, selected = sub, inline = TRUE) \n', + '{subst} }}) \n', ' output${prefix}c1oup <- renderPlot({{ \n', ' scVioBox({prefix}conf, {prefix}meta, input${prefix}c1inp1, input${prefix}c1inp2, \n', ' input${prefix}c1sub1, input${prefix}c1sub2, \n', @@ -1042,21 +1050,21 @@ wrSVmain <- function(prefix) { ' \n', ' \n', '### Plots for tab c2 \n', - ' output${prefix}c2sub1.ui <- renderUI({{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}c2sub1]$fID, "\\\\|")[[1]] \n', - ' checkboxGroupInput("{prefix}c2sub2", "Select which cells to show", inline = TRUE, \n', - ' choices = sub, selected = sub) \n', - ' }}) \n', - ' observeEvent(input${prefix}c2sub1non, {{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}c2sub1]$fID, "\\\\|")[[1]] \n', - ' updateCheckboxGroupInput(session, inputId = "{prefix}c2sub2", label = "Select which cells to show", \n', - ' choices = sub, selected = NULL, inline = TRUE) \n', - ' }}) \n', - ' observeEvent(input${prefix}c2sub1all, {{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}c2sub1]$fID, "\\\\|")[[1]] \n', - ' updateCheckboxGroupInput(session, inputId = "{prefix}c2sub2", label = "Select which cells to show", \n', - ' choices = sub, selected = sub, inline = TRUE) \n', - ' }}) \n', + '{subst} output${prefix}c2sub1.ui <- renderUI({{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}c2sub1]$fID, "\\\\|")[[1]] \n', + '{subst} checkboxGroupInput("{prefix}c2sub2", "Select which cells to show", inline = TRUE, \n', + '{subst} choices = sub, selected = sub) \n', + '{subst} }}) \n', + '{subst} observeEvent(input${prefix}c2sub1non, {{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}c2sub1]$fID, "\\\\|")[[1]] \n', + '{subst} updateCheckboxGroupInput(session, inputId = "{prefix}c2sub2", label = "Select which cells to show", \n', + '{subst} choices = sub, selected = NULL, inline = TRUE) \n', + '{subst} }}) \n', + '{subst} observeEvent(input${prefix}c2sub1all, {{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}c2sub1]$fID, "\\\\|")[[1]] \n', + '{subst} updateCheckboxGroupInput(session, inputId = "{prefix}c2sub2", label = "Select which cells to show", \n', + '{subst} choices = sub, selected = sub, inline = TRUE) \n', + '{subst} }}) \n', 'output${prefix}c2oup <- renderPlot({{ \n', ' scProp({prefix}conf, {prefix}meta, input${prefix}c2inp1, input${prefix}c2inp2, \n', ' input${prefix}c2sub1, input${prefix}c2sub2, \n', @@ -1086,21 +1094,21 @@ wrSVmain <- function(prefix) { ' \n', ' \n', ' ### Plots for tab d1 \n', - ' output${prefix}d1sub1.ui <- renderUI({{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}d1sub1]$fID, "\\\\|")[[1]] \n', - ' checkboxGroupInput("{prefix}d1sub2", "Select which cells to show", inline = TRUE, \n', - ' choices = sub, selected = sub) \n', - ' }}) \n', - ' observeEvent(input${prefix}d1sub1non, {{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}d1sub1]$fID, "\\\\|")[[1]] \n', - ' updateCheckboxGroupInput(session, inputId = "{prefix}d1sub2", label = "Select which cells to show", \n', - ' choices = sub, selected = NULL, inline = TRUE) \n', - ' }}) \n', - ' observeEvent(input${prefix}d1sub1all, {{ \n', - ' sub = strsplit({prefix}conf[UI == input${prefix}d1sub1]$fID, "\\\\|")[[1]] \n', - ' updateCheckboxGroupInput(session, inputId = "{prefix}d1sub2", label = "Select which cells to show", \n', - ' choices = sub, selected = sub, inline = TRUE) \n', - ' }}) \n', + '{subst} output${prefix}d1sub1.ui <- renderUI({{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}d1sub1]$fID, "\\\\|")[[1]] \n', + '{subst} checkboxGroupInput("{prefix}d1sub2", "Select which cells to show", inline = TRUE, \n', + '{subst} choices = sub, selected = sub) \n', + '{subst} }}) \n', + '{subst} observeEvent(input${prefix}d1sub1non, {{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}d1sub1]$fID, "\\\\|")[[1]] \n', + '{subst} updateCheckboxGroupInput(session, inputId = "{prefix}d1sub2", label = "Select which cells to show", \n', + '{subst} choices = sub, selected = NULL, inline = TRUE) \n', + '{subst} }}) \n', + '{subst} observeEvent(input${prefix}d1sub1all, {{ \n', + '{subst} sub = strsplit({prefix}conf[UI == input${prefix}d1sub1]$fID, "\\\\|")[[1]] \n', + '{subst} updateCheckboxGroupInput(session, inputId = "{prefix}d1sub2", label = "Select which cells to show", \n', + '{subst} choices = sub, selected = sub, inline = TRUE) \n', + '{subst} }}) \n', ' output${prefix}d1oupTxt <- renderUI({{ \n', ' geneList = scGeneList(input${prefix}d1inp, {prefix}gene) \n', ' if(nrow(geneList) > 50){{ \n', @@ -1211,7 +1219,7 @@ wrUIsingle <- function(title, ganalytics) { #' @rdname wrUImain #' @export wrUImain #' -wrUImain <- function(prefix) { +wrUImain <- function(prefix, subst = "", ptsiz = "1.25") { glue::glue(' ### Tab1.a1: cellInfo vs geneExpr on dimRed \n', ' tabPanel( \n', ' HTML("CellInfo vs GeneExpr"), \n', @@ -1231,16 +1239,16 @@ wrUImain <- function(prefix) { ' ) \n', ' ), # End of column (6 space) \n', ' column( \n', - ' 3, actionButton("{prefix}a1togL", "Toggle to subset cells"), \n', - ' conditionalPanel( \n', - ' condition = "input.{prefix}a1togL % 2 == 1", \n', - ' selectInput("{prefix}a1sub1", "Cell information to subset:", \n', - ' choices = {prefix}conf[grp == TRUE]$UI, \n', - ' selected = {prefix}def$grp1), \n', - ' uiOutput("{prefix}a1sub1.ui"), \n', - ' actionButton("{prefix}a1sub1all", "Select all groups", class = "btn btn-primary"), \n', - ' actionButton("{prefix}a1sub1non", "Deselect all groups", class = "btn btn-primary") \n', - ' ) \n', + ' 3{subst}, actionButton("{prefix}a1togL", "Toggle to subset cells"), \n', + '{subst} conditionalPanel( \n', + '{subst} condition = "input.{prefix}a1togL % 2 == 1", \n', + '{subst} selectInput("{prefix}a1sub1", "Cell information to subset:", \n', + '{subst} choices = {prefix}conf[grp == TRUE]$UI, \n', + '{subst} selected = {prefix}def$grp1), \n', + '{subst} uiOutput("{prefix}a1sub1.ui"), \n', + '{subst} actionButton("{prefix}a1sub1all", "Select all groups", class = "btn btn-primary"), \n', + '{subst} actionButton("{prefix}a1sub1non", "Deselect all groups", class = "btn btn-primary") \n', + '{subst} ) \n', ' ), # End of column (6 space) \n', ' column( \n', ' 6, actionButton("{prefix}a1tog0", "Toggle graphics controls"), \n', @@ -1249,7 +1257,7 @@ wrUImain <- function(prefix) { ' fluidRow( \n', ' column( \n', ' 6, sliderInput("{prefix}a1siz", "Point size:", \n', - ' min = 0, max = 4, value = 1.25, step = 0.25), \n', + ' min = 0, max = 4, value = {ptsiz}, step = 0.25), \n', ' radioButtons("{prefix}a1psz", "Plot size:", \n', ' choices = c("Small", "Medium", "Large"), \n', ' selected = "Medium", inline = TRUE), \n', @@ -1373,16 +1381,16 @@ wrUImain <- function(prefix) { ' ) \n', ' ), # End of column (6 space) \n', ' column( \n', - ' 3, actionButton("{prefix}a2togL", "Toggle to subset cells"), \n', - ' conditionalPanel( \n', - ' condition = "input.{prefix}a2togL % 2 == 1", \n', - ' selectInput("{prefix}a2sub1", "Cell information to subset:", \n', - ' choices = {prefix}conf[grp == TRUE]$UI, \n', - ' selected = {prefix}def$grp1), \n', - ' uiOutput("{prefix}a2sub1.ui"), \n', - ' actionButton("{prefix}a2sub1all", "Select all groups", class = "btn btn-primary"), \n', - ' actionButton("{prefix}a2sub1non", "Deselect all groups", class = "btn btn-primary") \n', - ' ) \n', + ' 3{subst}, actionButton("{prefix}a2togL", "Toggle to subset cells"), \n', + '{subst} conditionalPanel( \n', + '{subst} condition = "input.{prefix}a2togL % 2 == 1", \n', + '{subst} selectInput("{prefix}a2sub1", "Cell information to subset:", \n', + '{subst} choices = {prefix}conf[grp == TRUE]$UI, \n', + '{subst} selected = {prefix}def$grp1), \n', + '{subst} uiOutput("{prefix}a2sub1.ui"), \n', + '{subst} actionButton("{prefix}a2sub1all", "Select all groups", class = "btn btn-primary"), \n', + '{subst} actionButton("{prefix}a2sub1non", "Deselect all groups", class = "btn btn-primary") \n', + '{subst} ) \n', ' ), # End of column (6 space) \n', ' column( \n', ' 6, actionButton("{prefix}a2tog0", "Toggle graphics controls"), \n', @@ -1391,7 +1399,7 @@ wrUImain <- function(prefix) { ' fluidRow( \n', ' column( \n', ' 6, sliderInput("{prefix}a2siz", "Point size:", \n', - ' min = 0, max = 4, value = 1.25, step = 0.25), \n', + ' min = 0, max = 4, value = {ptsiz}, step = 0.25), \n', ' radioButtons("{prefix}a2psz", "Plot size:", \n', ' choices = c("Small", "Medium", "Large"), \n', ' selected = "Medium", inline = TRUE), \n', @@ -1512,16 +1520,16 @@ wrUImain <- function(prefix) { ' ) \n', ' ), # End of column (6 space) \n', ' column( \n', - ' 3, actionButton("{prefix}a3togL", "Toggle to subset cells"), \n', - ' conditionalPanel( \n', - ' condition = "input.{prefix}a3togL % 2 == 1", \n', - ' selectInput("{prefix}a3sub1", "Cell information to subset:", \n', - ' choices = {prefix}conf[grp == TRUE]$UI, \n', - ' selected = {prefix}def$grp1), \n', - ' uiOutput("{prefix}a3sub1.ui"), \n', - ' actionButton("{prefix}a3sub1all", "Select all groups", class = "btn btn-primary"), \n', - ' actionButton("{prefix}a3sub1non", "Deselect all groups", class = "btn btn-primary") \n', - ' ) \n', + ' 3{subst}, actionButton("{prefix}a3togL", "Toggle to subset cells"), \n', + '{subst} conditionalPanel( \n', + '{subst} condition = "input.{prefix}a3togL % 2 == 1", \n', + '{subst} selectInput("{prefix}a3sub1", "Cell information to subset:", \n', + '{subst} choices = {prefix}conf[grp == TRUE]$UI, \n', + '{subst} selected = {prefix}def$grp1), \n', + '{subst} uiOutput("{prefix}a3sub1.ui"), \n', + '{subst} actionButton("{prefix}a3sub1all", "Select all groups", class = "btn btn-primary"), \n', + '{subst} actionButton("{prefix}a3sub1non", "Deselect all groups", class = "btn btn-primary") \n', + '{subst} ) \n', ' ), # End of column (6 space) \n', ' column( \n', ' 6, actionButton("{prefix}a3tog0", "Toggle graphics controls"), \n', @@ -1530,7 +1538,7 @@ wrUImain <- function(prefix) { ' fluidRow( \n', ' column( \n', ' 6, sliderInput("{prefix}a3siz", "Point size:", \n', - ' min = 0, max = 4, value = 1.25, step = 0.25), \n', + ' min = 0, max = 4, value = {ptsiz}, step = 0.25), \n', ' radioButtons("{prefix}a3psz", "Plot size:", \n', ' choices = c("Small", "Medium", "Large"), \n', ' selected = "Medium", inline = TRUE), \n', @@ -1643,16 +1651,16 @@ wrUImain <- function(prefix) { ' ) \n', ' ), # End of column (6 space) \n', ' column( \n', - ' 3, actionButton("{prefix}b2togL", "Toggle to subset cells"), \n', - ' conditionalPanel( \n', - ' condition = "input.{prefix}b2togL % 2 == 1", \n', - ' selectInput("{prefix}b2sub1", "Cell information to subset:", \n', - ' choices = {prefix}conf[grp == TRUE]$UI, \n', - ' selected = {prefix}def$grp1), \n', - ' uiOutput("{prefix}b2sub1.ui"), \n', - ' actionButton("{prefix}b2sub1all", "Select all groups", class = "btn btn-primary"), \n', - ' actionButton("{prefix}b2sub1non", "Deselect all groups", class = "btn btn-primary") \n', - ' ) \n', + ' 3{subst}, actionButton("{prefix}b2togL", "Toggle to subset cells"), \n', + '{subst} conditionalPanel( \n', + '{subst} condition = "input.{prefix}b2togL % 2 == 1", \n', + '{subst} selectInput("{prefix}b2sub1", "Cell information to subset:", \n', + '{subst} choices = {prefix}conf[grp == TRUE]$UI, \n', + '{subst} selected = {prefix}def$grp1), \n', + '{subst} uiOutput("{prefix}b2sub1.ui"), \n', + '{subst} actionButton("{prefix}b2sub1all", "Select all groups", class = "btn btn-primary"), \n', + '{subst} actionButton("{prefix}b2sub1non", "Deselect all groups", class = "btn btn-primary") \n', + '{subst} ) \n', ' ), # End of column (6 space) \n', ' column( \n', ' 6, actionButton("{prefix}b2tog0", "Toggle graphics controls"), \n', @@ -1661,7 +1669,7 @@ wrUImain <- function(prefix) { ' fluidRow( \n', ' column( \n', ' 6, sliderInput("{prefix}b2siz", "Point size:", \n', - ' min = 0, max = 4, value = 1.5, step = 0.25), \n', + ' min = 0, max = 4, value = {ptsiz}, step = 0.25), \n', ' radioButtons("{prefix}b2psz", "Plot size:", \n', ' choices = c("Small", "Medium", "Large"), \n', ' selected = "Medium", inline = TRUE), \n', @@ -1760,21 +1768,21 @@ wrUImain <- function(prefix) { ' choices = c("violin", "boxplot"), \n', ' selected = "violin", inline = TRUE), \n', ' checkboxInput("{prefix}c1pts", "Show data points", value = FALSE), \n', - ' actionButton("{prefix}c1togL", "Toggle to subset cells"), \n', - ' conditionalPanel( \n', - ' condition = "input.{prefix}c1togL % 2 == 1", \n', - ' selectInput("{prefix}c1sub1", "Cell information to subset:", \n', - ' choices = {prefix}conf[grp == TRUE]$UI, \n', - ' selected = {prefix}def$grp1), \n', - ' uiOutput("{prefix}c1sub1.ui"), \n', - ' actionButton("{prefix}c1sub1all", "Select all groups", class = "btn btn-primary"), \n', - ' actionButton("{prefix}c1sub1non", "Deselect all groups", class = "btn btn-primary") \n', - ' ), br(), br(), \n', + '{subst} actionButton("{prefix}c1togL", "Toggle to subset cells"), \n', + '{subst} conditionalPanel( \n', + '{subst} condition = "input.{prefix}c1togL % 2 == 1", \n', + '{subst} selectInput("{prefix}c1sub1", "Cell information to subset:", \n', + '{subst} choices = {prefix}conf[grp == TRUE]$UI, \n', + '{subst} selected = {prefix}def$grp1), \n', + '{subst} uiOutput("{prefix}c1sub1.ui"), \n', + '{subst} actionButton("{prefix}c1sub1all", "Select all groups", class = "btn btn-primary"), \n', + '{subst} actionButton("{prefix}c1sub1non", "Deselect all groups", class = "btn btn-primary") \n', + '{subst} ), br(), br(), \n', ' actionButton("{prefix}c1tog", "Toggle graphics controls"), \n', ' conditionalPanel( \n', ' condition = "input.{prefix}c1tog % 2 == 1", \n', ' sliderInput("{prefix}c1siz", "Data point size:", \n', - ' min = 0, max = 4, value = 1.25, step = 0.25), \n', + ' min = 0, max = 4, value = {ptsiz}, step = 0.25), \n', ' radioButtons("{prefix}c1psz", "Plot size:", \n', ' choices = c("Small", "Medium", "Large"), \n', ' selected = "Medium", inline = TRUE), \n', @@ -1824,16 +1832,16 @@ wrUImain <- function(prefix) { ' choices = c("Proportion", "CellNumbers"), \n', ' selected = "Proportion", inline = TRUE), \n', ' checkboxInput("{prefix}c2flp", "Flip X/Y", value = FALSE), \n', - ' actionButton("{prefix}c2togL", "Toggle to subset cells"), \n', - ' conditionalPanel( \n', - ' condition = "input.{prefix}c2togL % 2 == 1", \n', - ' selectInput("{prefix}c2sub1", "Cell information to subset:", \n', - ' choices = {prefix}conf[grp == TRUE]$UI, \n', - ' selected = {prefix}def$grp1), \n', - ' uiOutput("{prefix}c2sub1.ui"), \n', - ' actionButton("{prefix}c2sub1all", "Select all groups", class = "btn btn-primary"), \n', - ' actionButton("{prefix}c2sub1non", "Deselect all groups", class = "btn btn-primary") \n', - ' ), br(), br(), \n', + '{subst} actionButton("{prefix}c2togL", "Toggle to subset cells"), \n', + '{subst} conditionalPanel( \n', + '{subst} condition = "input.{prefix}c2togL % 2 == 1", \n', + '{subst} selectInput("{prefix}c2sub1", "Cell information to subset:", \n', + '{subst} choices = {prefix}conf[grp == TRUE]$UI, \n', + '{subst} selected = {prefix}def$grp1), \n', + '{subst} uiOutput("{prefix}c2sub1.ui"), \n', + '{subst} actionButton("{prefix}c2sub1all", "Select all groups", class = "btn btn-primary"), \n', + '{subst} actionButton("{prefix}c2sub1non", "Deselect all groups", class = "btn btn-primary") \n', + '{subst} ), br(), br(), \n', ' actionButton("{prefix}c2tog", "Toggle graphics controls"), \n', ' conditionalPanel( \n', ' condition = "input.{prefix}c2tog % 2 == 1", \n', @@ -1893,16 +1901,16 @@ wrUImain <- function(prefix) { ' checkboxInput("{prefix}d1row", "Cluster rows (genes)", value = TRUE), \n', ' checkboxInput("{prefix}d1col", "Cluster columns (samples)", value = FALSE), \n', ' br(), \n', - ' actionButton("{prefix}d1togL", "Toggle to subset cells"), \n', - ' conditionalPanel( \n', - ' condition = "input.{prefix}d1togL % 2 == 1", \n', - ' selectInput("{prefix}d1sub1", "Cell information to subset:", \n', - ' choices = {prefix}conf[grp == TRUE]$UI, \n', - ' selected = {prefix}def$grp1), \n', - ' uiOutput("{prefix}d1sub1.ui"), \n', - ' actionButton("{prefix}d1sub1all", "Select all groups", class = "btn btn-primary"), \n', - ' actionButton("{prefix}d1sub1non", "Deselect all groups", class = "btn btn-primary") \n', - ' ), br(), br(), \n', + '{subst} actionButton("{prefix}d1togL", "Toggle to subset cells"), \n', + '{subst} conditionalPanel( \n', + '{subst} condition = "input.{prefix}d1togL % 2 == 1", \n', + '{subst} selectInput("{prefix}d1sub1", "Cell information to subset:", \n', + '{subst} choices = {prefix}conf[grp == TRUE]$UI, \n', + '{subst} selected = {prefix}def$grp1), \n', + '{subst} uiOutput("{prefix}d1sub1.ui"), \n', + '{subst} actionButton("{prefix}d1sub1all", "Select all groups", class = "btn btn-primary"), \n', + '{subst} actionButton("{prefix}d1sub1non", "Deselect all groups", class = "btn btn-primary") \n', + '{subst} ), br(), br(), \n', ' actionButton("{prefix}d1tog", "Toggle graphics controls"), \n', ' conditionalPanel( \n', ' condition = "input.{prefix}d1tog % 2 == 1", \n', diff --git a/man/makeShinyApp.Rd b/man/makeShinyApp.Rd index 8a96240..5bb175f 100644 --- a/man/makeShinyApp.Rd +++ b/man/makeShinyApp.Rd @@ -13,6 +13,8 @@ makeShinyApp( shiny.title = "scRNA-seq shiny app", shiny.footnotes = "", shiny.dir = "shinyApp/", + enableSubset = TRUE, + defPtSiz = 1.25, ganalytics = NA, default.gene1 = NA, default.gene2 = NA, @@ -59,6 +61,12 @@ page, year, doi, link. See example below.} \item{shiny.dir}{specify directory to create the shiny app in. Default is to create a new directory named "shinyApp"} +\item{enableSubset}{specify whether to enable "Toggle to subset cells" +functionality in the shiny app. Default is to enable this functionality} + +\item{defPtSiz}{specify default point size for single cells. For example, a +smaller size can be used if you have many cells in your dataset} + \item{ganalytics}{Google analytics tracking ID (e.g. "UA-123456789-0")} \item{default.gene1}{specify primary default gene to show} diff --git a/man/makeShinyCodes.Rd b/man/makeShinyCodes.Rd index 95b5ec4..4b7347b 100644 --- a/man/makeShinyCodes.Rd +++ b/man/makeShinyCodes.Rd @@ -9,6 +9,8 @@ makeShinyCodes( shiny.footnotes, shiny.prefix, shiny.dir, + enableSubset = TRUE, + defPtSiz = 1.25, ganalytics = NA ) } @@ -23,6 +25,12 @@ page, year, doi, link. See example below.} \item{shiny.dir}{specify directory to create the shiny app in} +\item{enableSubset}{specify whether to enable "Toggle to subset cells" +functionality in the shiny app. Default is to enable this functionality} + +\item{defPtSiz}{specify default point size for single cells. For example, a +smaller size can be used if you have many cells in your dataset} + \item{ganalytics}{Google analytics tracking ID (e.g. "UA-123456789-0")} } \value{ diff --git a/man/makeShinyCodesMulti.Rd b/man/makeShinyCodesMulti.Rd index 964ec7c..a559727 100644 --- a/man/makeShinyCodesMulti.Rd +++ b/man/makeShinyCodesMulti.Rd @@ -10,6 +10,8 @@ makeShinyCodesMulti( shiny.prefix, shiny.headers, shiny.dir, + enableSubset = TRUE, + defPtSiz = 1.25, ganalytics = NA ) } @@ -28,6 +30,14 @@ must match that of \code{shiny.prefix}} \item{shiny.dir}{specify directory to create the shiny app in} +\item{enableSubset}{specify whether to enable "Toggle to subset cells" +functionality in the shiny app. Default is to enable this functionality} + +\item{defPtSiz}{specify default point size for single cells. For example, a +smaller size can be used if you have many cells in your dataset. A single +value can be specified to set the point size for all datasets. Otherwise, +users have to specify one value for each dataset} + \item{ganalytics}{Google analytics tracking ID (e.g. "UA-123456789-0")} } \value{ @@ -53,7 +63,7 @@ citation = list( doi = "10.1038/s41586-020-2734-6", link = "https://www.nature.com/articles/s41586-020-2734-6") makeShinyCodes(shiny.title = "scRNA-seq shiny app", shiny.footnotes = "", - shiny.prefix = c("sc1", "sc2"), + shiny.prefix = c("sc1", "sc2"), defPtSiz = c(1.25, 1.5), shiny.headers = c("dataset1", "dataset2"), shiny.dir = "shinyApp/") diff --git a/man/wrSVmain.Rd b/man/wrSVmain.Rd index 7891200..60a4edf 100644 --- a/man/wrSVmain.Rd +++ b/man/wrSVmain.Rd @@ -4,7 +4,7 @@ \alias{wrSVmain} \title{Write code for main block of server.R} \usage{ -wrSVmain(prefix) +wrSVmain(prefix, subst = "") } \arguments{ \item{prefix}{file prefix} diff --git a/man/wrUImain.Rd b/man/wrUImain.Rd index 2247dc1..c230a4f 100644 --- a/man/wrUImain.Rd +++ b/man/wrUImain.Rd @@ -4,7 +4,7 @@ \alias{wrUImain} \title{Write code for main block of ui.R} \usage{ -wrUImain(prefix) +wrUImain(prefix, subst = "", ptsiz = "1.25") } \arguments{ \item{prefix}{file prefix}