Skip to content

Commit

Permalink
added the split by group to all tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
Konrad1991 committed Oct 31, 2024
1 parent 9e24a9d commit ef1fc6f
Show file tree
Hide file tree
Showing 6 changed files with 270 additions and 6 deletions.
56 changes: 56 additions & 0 deletions bs/R/DoseResponse.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ DoseResponseSidebarUI <- function(id) {
),
uiOutput(NS(id,"open_formula_editor_corr")),
br(),
div(
class = "boxed-output",
uiOutput(NS(id, "open_split_by_group")),
uiOutput(NS(id, "data_splitted")),
verbatimTextOutput(NS(id, "applied_filter"))
),
br(),
textInput(NS(id, "substanceNames"), "Names column of dependent Variable", value = "names"),
textInput(NS(id, "negIdentifier"), "Identifier for the negative control", value = "neg"),
textInput(NS(id, "posIdentifier"), "Identifier for the positive control", value = "pos"),
Expand Down Expand Up @@ -42,6 +49,55 @@ DoseResponseUI <- function(id) {
DoseResponseServer <- function(id, data, listResults) {
moduleServer(id, function(input, output, session) {

# Render split by group
output$open_split_by_group <- renderUI({
actionButton(NS(id, "open_split_by_group"),
"Open the split by group functionality",
title = "Open the split by group helper window",
disabled = is.null(data$df) || !is.data.frame(data$df)
)
})

observeEvent(input[["open_split_by_group"]], {
showModal(modalDialog(
title = "SplitByGroup",
SplitByGroupUI("SG"),
easyClose = TRUE,
size = "l",
footer = NULL
))
})

# check if data is splitted
output$data_splitted <- renderUI({
actionButton(NS(id, "remove_filter"),
"Remove the filter from the dataset",
title = "remove the filter of the dataset",
disabled = is.null(data$backup_df) || !is.data.frame(data$backup_df)
)
})

observe({
output$applied_filter <- renderText(NULL)
req(!is.null(data$filter_col))
req(!is.null(data$filter_group))
output$applied_filter <- renderText({
paste0(
"The dataset is splitted by the variable ",
data$filter_col,
" and the group is ",
data$filter_group)
})
})

# Remove filter
observeEvent(input[["remove_filter"]], {
data$df <- data$backup_df
data$backup_df <- NULL
data$filter_col <- NULL
data$filter_group <- NULL
})

observeEvent(input[["df_help_icon"]], {
showModal(modalDialog(
title = "Example Dataframe",
Expand Down
56 changes: 56 additions & 0 deletions bs/R/assumption.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ assSidebarUI <- function(id) {
"Assumption",
tags$hr(),
uiOutput(NS(id, "open_formula_editor_corr")),
div(
class = "boxed-output",
uiOutput(NS(id, "open_split_by_group")),
uiOutput(NS(id, "data_splitted")),
verbatimTextOutput(NS(id, "applied_filter"))
),
tags$hr(),
tags$div(
class = "header", checked = NA,
Expand Down Expand Up @@ -59,6 +65,56 @@ assUI <- function(id) {

assServer <- function(id, data, listResults) {
moduleServer(id, function(input, output, session) {
# Render split by group
output$open_split_by_group <- renderUI({
actionButton(NS(id, "open_split_by_group"),
"Open the split by group functionality",
title = "Open the split by group helper window",
disabled = is.null(data$df) || !is.data.frame(data$df)
)
})

observeEvent(input[["open_split_by_group"]], {
showModal(modalDialog(
title = "SplitByGroup",
SplitByGroupUI("SG"),
easyClose = TRUE,
size = "l",
footer = NULL
))
})

# check if data is splitted
output$data_splitted <- renderUI({
actionButton(NS(id, "remove_filter"),
"Remove the filter from the dataset",
title = "remove the filter of the dataset",
disabled = is.null(data$backup_df) || !is.data.frame(data$backup_df)
)
})

observe({
output$applied_filter <- renderText(NULL)
req(!is.null(data$filter_col))
req(!is.null(data$filter_group))
output$applied_filter <- renderText({
paste0(
"The dataset is splitted by the variable ",
data$filter_col,
" and the group is ",
data$filter_group
)
})
})

# Remove filter
observeEvent(input[["remove_filter"]], {
data$df <- data$backup_df
data$backup_df <- NULL
data$filter_col <- NULL
data$filter_group <- NULL
})


output$open_formula_editor_corr <- renderUI({
actionButton(NS(id, "open_formula_editor"),
Expand Down
14 changes: 8 additions & 6 deletions bs/R/correlation.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ corrSidebarUI <- function(id) {
"Correlation",
uiOutput(NS(id, "open_formula_editor_corr")),
br(),
uiOutput(NS(id, "open_split_by_group")),
br(),
uiOutput(NS(id, "data_splitted")),
verbatimTextOutput(NS(id, "applied_filter")),
div(
class = "boxed-output",
uiOutput(NS(id, "open_split_by_group")),
uiOutput(NS(id, "data_splitted")),
verbatimTextOutput(NS(id, "applied_filter"))
),
br(),
actionButton(NS(id, "pear"), "Pearson correlation"),
actionButton(NS(id, "spear"), "Spearman correlation"),
Expand Down Expand Up @@ -44,7 +46,6 @@ corrUI <- function(id) {

corrServer <- function(id, data, listResults) {
moduleServer(id, function(input, output, session) {

# Render split by group
output$open_split_by_group <- renderUI({
actionButton(NS(id, "open_split_by_group"),
Expand Down Expand Up @@ -82,7 +83,8 @@ corrServer <- function(id, data, listResults) {
"The dataset is splitted by the variable ",
data$filter_col,
" and the group is ",
data$filter_group)
data$filter_group
)
})
})

Expand Down
55 changes: 55 additions & 0 deletions bs/R/statisticalTests.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ testsSidebarUI <- function(id) {
"Tests",
uiOutput(NS(id, "open_formula_editor_corr")),
br(),
div(
class = "boxed-output",
uiOutput(NS(id, "open_split_by_group")),
uiOutput(NS(id, "data_splitted")),
verbatimTextOutput(NS(id, "applied_filter"))
),
conditionalPanel(
condition = "input.TestsConditionedPanels == 'Two groups'",
sliderInput(NS(id, "confLevel"), "Confidence level of the interval",
Expand Down Expand Up @@ -111,6 +117,55 @@ testsUI <- function(id) {
testsServer <- function(id, data, listResults) {
moduleServer(id, function(input, output, session) {

# Render split by group
output$open_split_by_group <- renderUI({
actionButton(NS(id, "open_split_by_group"),
"Open the split by group functionality",
title = "Open the split by group helper window",
disabled = is.null(data$df) || !is.data.frame(data$df)
)
})

observeEvent(input[["open_split_by_group"]], {
showModal(modalDialog(
title = "SplitByGroup",
SplitByGroupUI("SG"),
easyClose = TRUE,
size = "l",
footer = NULL
))
})

# check if data is splitted
output$data_splitted <- renderUI({
actionButton(NS(id, "remove_filter"),
"Remove the filter from the dataset",
title = "remove the filter of the dataset",
disabled = is.null(data$backup_df) || !is.data.frame(data$backup_df)
)
})

observe({
output$applied_filter <- renderText(NULL)
req(!is.null(data$filter_col))
req(!is.null(data$filter_group))
output$applied_filter <- renderText({
paste0(
"The dataset is splitted by the variable ",
data$filter_col,
" and the group is ",
data$filter_group)
})
})

# Remove filter
observeEvent(input[["remove_filter"]], {
data$df <- data$backup_df
data$backup_df <- NULL
data$filter_col <- NULL
data$filter_group <- NULL
})

output$open_formula_editor_corr <- renderUI({
actionButton(NS(id, "open_formula_editor"),
"Open formula editor",
Expand Down
56 changes: 56 additions & 0 deletions bs/R/visualisation.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
visSidebarUI <- function(id) {
tabPanel(
"Visualisation",
div(
class = "boxed-output",
uiOutput(NS(id, "open_split_by_group")),
uiOutput(NS(id, "data_splitted")),
verbatimTextOutput(NS(id, "applied_filter"))
),
textInput(NS(id, "yVar"), "Y variable", value = "y"),
textInput(NS(id, "xVar"), "X variable", value = "x"),
radioButtons(NS(id, "xType"), "Type of x",
Expand Down Expand Up @@ -122,6 +128,56 @@ visUI <- function(id) {

visServer <- function(id, data, listResults) {
moduleServer(id, function(input, output, session) {

# Render split by group
output$open_split_by_group <- renderUI({
actionButton(NS(id, "open_split_by_group"),
"Open the split by group functionality",
title = "Open the split by group helper window",
disabled = is.null(data$df) || !is.data.frame(data$df)
)
})

observeEvent(input[["open_split_by_group"]], {
showModal(modalDialog(
title = "SplitByGroup",
SplitByGroupUI("SG"),
easyClose = TRUE,
size = "l",
footer = NULL
))
})

# check if data is splitted
output$data_splitted <- renderUI({
actionButton(NS(id, "remove_filter"),
"Remove the filter from the dataset",
title = "remove the filter of the dataset",
disabled = is.null(data$backup_df) || !is.data.frame(data$backup_df)
)
})

observe({
output$applied_filter <- renderText(NULL)
req(!is.null(data$filter_col))
req(!is.null(data$filter_group))
output$applied_filter <- renderText({
paste0(
"The dataset is splitted by the variable ",
data$filter_col,
" and the group is ",
data$filter_group)
})
})

# Remove filter
observeEvent(input[["remove_filter"]], {
data$df <- data$backup_df
data$backup_df <- NULL
data$filter_col <- NULL
data$filter_group <- NULL
})

plotFct <- function(method) {
req(is.data.frame(data$df))
df <- data$df
Expand Down
39 changes: 39 additions & 0 deletions bs/R/www/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.boxed-output {
border: 2px solid #900C3F;
padding: 10px;
border-radius: 5px;
margin-top: 10px;
}
.add-button {
position: relative;
padding-right: 20px;
}
.add-button::after {
content: '\\2295';
position: absolute;
top: 1.1px;
right: 5px;
font-size: 16px;
font-weight: bold;
color: #900C3F;
background-color: white;
width: 15px;
height: 15px;
display: flex;
justify-content: center;
align-items: center;
}
.model {
background-color: #f8f9fa;
padding: 15px;
border: 2px solid #c8c8c8;
border-radius: 5px;
margin-top: 10px;
}
.title {
font-size: 14px;
font-weight: bold;
margin-bottom: 10px;
color: #333;
}

0 comments on commit ef1fc6f

Please sign in to comment.