Skip to content

Commit

Permalink
Merge pull request #339 from bigomics/fix-#335
Browse files Browse the repository at this point in the history
#335: from tipify to withToolTip
  • Loading branch information
ivokwee authored Apr 25, 2023
2 parents 29f7c52 + f9f7593 commit 4267df0
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 49 deletions.
15 changes: 8 additions & 7 deletions components/board.clustering/R/clustering_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ ClusteringInputs <- function(id) {
shiny::conditionalPanel(
"input.hm_features == '<contrast>'",
ns = ns,
tipifyR(
withTooltip(
shiny::selectInput(ns("hm_contrast"), NULL, choices = NULL),
"Select contrast to be used as signature."
"Select contrast to be used as signature.",
placement = "right", options = list(container = "body")
)
),
withTooltip(shiny::selectInput(ns("hm_group"), "Group by:", choices = NULL),
Expand All @@ -58,7 +59,7 @@ ClusteringInputs <- function(id) {
inline = TRUE
),
"Choose the layout method for clustering plots.",
),
),
shiny::conditionalPanel(
"input.hm_options % 2 == 1",
ns = ns,
Expand Down Expand Up @@ -92,7 +93,7 @@ ClusteringUI <- function(id) {

fullH <- "80vh" ## full height of full page
rowH <- "40vh"

div(
class = "row",
## h4("Cluster Samples"),
Expand Down Expand Up @@ -130,7 +131,7 @@ ClusteringUI <- function(id) {
"Parallel",
shinyjqui::jqui_sortable(
bslib::layout_column_wrap(
width = 1,
width = 1,
clustering_plot_parcoord_ui(
id = ns("parcoord"),
title = "Parallel coordinates",
Expand All @@ -147,9 +148,9 @@ ClusteringUI <- function(id) {
caption = "Table showing the expression in each sample of the genes displayed in the Parallel Coordinates.",
label = "a",
width = c("100%", "100%"),
height = c("calc(50vh - 100px)", TABLE_HEIGHT_MODAL)
height = c("calc(50vh - 100px)", TABLE_HEIGHT_MODAL)
)
) ## layout
) ## layout
) ## sortable
)
)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,29 @@ drugconnectivity_plot_cmap_dsea_ui <- function(
ns <- shiny::NS(id)

plot_opts <- shiny::tagList(
tipifyL(
withTooltip(
shiny::radioButtons(
ns("cmap_labeltype"), "label type:",
c("drugs", "MOA", "target"),
inline = TRUE
),
"Label point with drugs, MOA terms or targets (if no drug selected)."
"Label point with drugs, MOA terms or targets (if no drug selected).",
placement = "left", options = list(container = "body")
),
tipifyL(
withTooltip(
shiny::radioButtons(ns("cmap_nlabel"), "number of labels:", c(3, 10, 20, 100),
selected = 10, inline = TRUE
),
"Number of labels to show."
"Number of labels to show.",
placement = "left", options = list(container = "body")
),
tipifyL(shiny::checkboxGroupInput(
withTooltip(shiny::checkboxGroupInput(
ns("cmap_labeloptions"), "label options:",
choices = c("show", "fixed"),
selected = c("show"), inline = TRUE
), "Other labels options.")
), "Other labels options.",
placement = "left", options = list(container = "body")
)
)

PlotModuleUI(ns("plot"),
Expand Down
28 changes: 16 additions & 12 deletions components/board.featuremap/R/featuremap_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,31 @@ FeatureMapInputs <- function(id) {
"input.options % 2 == 1",
ns = ns,
shiny::tagList(
tipifyR(
withTooltip(
shiny::selectInput(ns("ref_group"), "Reference:", choices = NULL),
"Reference group. If no group is selected the average is used as reference."
"Reference group. If no group is selected the average is used as reference.",
placement = "right", options = list(container = "body")
),
tipifyR(
withTooltip(
shiny::radioButtons(ns("umap_type"), "UMAP datatype:",
choices = c("logCPM", "logFC"), inline = TRUE
),
"The UMAP can be computed from the normalized log-expression (logCPM), or from the log-foldchange matrix (logFC). Clustering based on logCPM is the default, but when batch/tissue effects are present the logFC might be better."
"The UMAP can be computed from the normalized log-expression (logCPM), or from the log-foldchange matrix (logFC). Clustering based on logCPM is the default, but when batch/tissue effects are present the logFC might be better.",
placement = "right", options = list(container = "body")
),
tipifyR(
withTooltip(
shiny::selectInput(ns("filter_genes"), "Show genes:",
choices = NULL, multiple = FALSE
),
"Filter the genes to highlight on the map."
"Filter the genes to highlight on the map.",
placement = "right", options = list(container = "body")
),
tipifyR(
withTooltip(
shiny::selectInput(ns("filter_gsets"), "Show genesets:",
choices = NULL, multiple = FALSE
),
"Filter the genesets to highlight on the map."
"Filter the genesets to highlight on the map.",
placement = "right", options = list(container = "body")
)
)
)
Expand All @@ -54,8 +58,8 @@ FeatureMapUI <- function(id) {
ns <- shiny::NS(id) ## namespace

height1 <- c("calc(60vh - 100px)", "70vh")
height2 <- c("calc(40vh - 100px)", "70vh")
height2 <- c("calc(40vh - 100px)", "70vh")

div(
boardHeader(title = "Cluster features", info_link = ns("info")),
shiny::tabsetPanel(
Expand All @@ -81,7 +85,7 @@ FeatureMapUI <- function(id) {
info.text = "UMAP clustering of genes colored by relative log-expression of the phenotype group. The distance metric is covariance. Genes that are clustered nearby have high covariance.",
caption = "Gene signature maps coloured by differential expression.",
height = height1,
width = c("auto", "100%")
width = c("auto", "100%")
)
),
featuremap_table_gene_map_ui(
Expand All @@ -108,7 +112,7 @@ FeatureMapUI <- function(id) {
caption = "Geneset UMAP coloured by level of variance. Shades of red indicate high variance.",
height = height1,
width = c("auto", "100%")
),
),
featuremap_plot_gset_sig_ui(
ns("gsetSigPlots"),
title = "Geneset signatures",
Expand Down
9 changes: 5 additions & 4 deletions components/modules/BatchCorrectModule.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ BatchCorrectUI <- function(id, height=720) {
width = 2
),
shiny::mainPanel(
shiny::plotOutput(ns("canvas"), width="100%", height=height) %>% shinycssloaders::withSpinner(),
shiny::plotOutput(ns("canvas"), width="100%", height=height) %>% bigLoaders::useSpinner(),
width = 10
)
)
Expand All @@ -48,7 +48,7 @@ BatchCorrectInputsUI <- function(id) {

BatchCorrectCanvas <- function(id, height=720) {
ns <- shiny::NS(id)
shiny::plotOutput(ns("canvas"), width="100%", height=height) %>% shinycssloaders::withSpinner()
shiny::plotOutput(ns("canvas"), width="100%", height=height) %>% bigLoaders::useSpinner()
}

BatchCorrectServer <- function(id, X, pheno, is.count=FALSE, height=720) {
Expand Down Expand Up @@ -230,10 +230,11 @@ BatchCorrectServer <- function(id, X, pheno, is.count=FALSE, height=720) {
shiny::br(),
shiny::br(),

tipify2(
withTooltip(
shiny::selectInput(ns("bc_modelpar"), "Model parameters:", pheno.par,
selected=sel.par, multiple=TRUE),
"Please specify <b>all</b> your model parameters. These are the parameters of interest that will determine your groupings."),
"Please specify <b>all</b> your model parameters. These are the parameters of interest that will determine your groupings.",
placement = "top", options = list(container = "body")),

## withTooltip(
## shiny::radioButtons(ns("bc_strength"), NULL,
Expand Down
10 changes: 6 additions & 4 deletions components/modules/MakeContrastModule.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ MakeContrastUI <- function(id) {
flex = c(1, 4),
shiny::fillCol(
flex = c(NA, NA, NA, NA, 1),
tipifyL(
withTooltip(
shiny::selectInput(ns("param"),
"Phenotype:",
choices = NULL,
selected = NULL,
multiple = TRUE
),
"Select phenotype(s) to create conditions for your groups. Select &ltgene&gt if you want to split by high/low expression of some gene. Select &ltsamples&gt if you want to group manually on sample names. You can select multiple phenotypes to create combinations."
"Select phenotype(s) to create conditions for your groups. Select &ltgene&gt if you want to split by high/low expression of some gene. Select &ltsamples&gt if you want to group manually on sample names. You can select multiple phenotypes to create combinations.",
placement = "left", options = list(container = "body")
),
shiny::conditionalPanel(
"input.param == '<gene>'",
Expand All @@ -49,12 +50,13 @@ MakeContrastUI <- function(id) {
)
),
shiny::br(),
tipifyL(
withTooltip(
shiny::textInput(ns("newname"),
"Comparison name:",
placeholder = "e.g. MAIN_vs_CONTROL"
),
"Give a name for your contrast as MAIN_vs_CONTROL, with the name of the main group first. You must keep _vs_ in the name to separate the names of the two groups."
"Give a name for your contrast as MAIN_vs_CONTROL, with the name of the main group first. You must keep _vs_ in the name to separate the names of the two groups.",
placement = "left", options = list(container = "body")
),
shiny::br(),
shiny::actionButton(ns("addcontrast"),
Expand Down
35 changes: 19 additions & 16 deletions components/modules/NormalizeCountsModule.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
##=====================================================================================

if(0) {
load("~/Playground/omicsplayground/data/GSE10846-dlbcl-nc.pgx")
load("~/Playground/omicsplayground/data/GSE10846-dlbcl-nc.pgx")
NormalizeCountsGadget(X=ngs$X, pheno=ngs$samples)
out <- gadgetize2(
NormalizeCountsUI, NormalizeCountsServer,
title = "UploadGadget", height=640, size="l",
title = "UploadGadget", height=640, size="l",
X = ngs$X, pheno=ngs$samples )
names(out)
}
Expand All @@ -36,8 +36,8 @@ NormalizeCountsServerRT <- function(id, counts, height=720) {
shiny::moduleServer(
id,
function(input, output, session) {
all.methods <- c("none","scale","quantile", "CPM","TMM","RLE")

all.methods <- c("none","scale","quantile", "CPM","TMM","RLE")
nc_info = "normalization module"
nc_info = ""

Expand All @@ -48,21 +48,24 @@ NormalizeCountsServerRT <- function(id, counts, height=720) {
shiny::sidebarLayout(
shiny::sidebarPanel(
shiny::helpText(nc_info),
##br(),
##br(),
##radioButtons(ns("selectmethod"),"Select normalization:",
## choices=all.methods, selected="CPM"),
tipify2(
withTooltip(
shiny::selectInput(ns("selectmethod"),"Select normalization:",
choices=all.methods, selected="CPM"),
"Select initial normalization method."
"Select initial normalization method.",
placement = "top", options = list(container = "body")
),
tipify2(
withTooltip(
shiny::checkboxInput(ns("postqn"),"Post quantile normalization"),
"Apply additional quantile normalization after scaling method."
"Apply additional quantile normalization after scaling method.",
placement = "top", options = list(container = "body")
),
tipify2(
withTooltip(
shiny::checkboxInput(ns("addnoise"),"Simulate unnormalized"),
"Simulated unnormalized data by adding random scaling to raw data"
"Simulated unnormalized data by adding random scaling to raw data",
placement = "top", options = list(container = "body")
),
width = 2
),
Expand All @@ -73,7 +76,7 @@ NormalizeCountsServerRT <- function(id, counts, height=720) {
)
})
shiny::outputOptions(output, "UI", suspendWhenHidden=FALSE) ## important!!!

pgx <- shiny::reactive({
if(is.null(input$addnoise)) return(NULL)
pgx <- list(counts=counts())
Expand All @@ -89,11 +92,11 @@ NormalizeCountsServerRT <- function(id, counts, height=720) {
}
pgx
})

output$canvas <- shiny::renderPlot({
shiny::req(counts())
## Show all methods
postqn <- input$postqn
postqn <- input$postqn
viz.NormalizeCounts(
pgx(),
methods = all.methods,
Expand All @@ -108,10 +111,10 @@ NormalizeCountsServerRT <- function(id, counts, height=720) {
methods = NULL,
post.qn = FALSE,
title=NULL, subtitle=NULL, caption=NULL)


}

normalized_counts <- shiny::reactive({
##req(input$selectmethod)
method <- input$selectmethod
Expand Down

0 comments on commit 4267df0

Please sign in to comment.