Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

framework #3

Merged
merged 7 commits into from
Jan 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ Imports:
htmltools,
ggplot2,
plotly,
shinydashboard
RoxygenNote: 6.1.0
shinydashboard,
readr
RoxygenNote: 7.0.2
Suggests:
testthat (>= 2.1.0),
knitr,
Expand Down
30 changes: 30 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
# Generated by roxygen2: do not edit by hand

export(includeRMarkdown)
export(mod_about_page_server)
export(mod_about_page_ui)
export(mod_cohort_display_server)
export(mod_cohort_display_ui)
export(mod_cohort_page_server)
export(mod_cohort_page_ui)
export(mod_cohort_selector_server)
export(mod_cohort_selector_ui)
export(mod_docs_page_server)
export(mod_docs_page_ui)
export(mod_explore_body_server)
export(mod_explore_body_ui)
export(mod_explore_menu_server)
export(mod_explore_menu_ui)
export(mod_explore_page_server)
export(mod_explore_page_ui)
export(mod_resources_page_server)
export(mod_resources_page_ui)
export(run_app)
import(shiny)
import(shinydashboard)
importFrom(glue,glue)
importFrom(golem,with_golem_options)
importFrom(htmltools,HTML)
importFrom(htmltools,tagAppendAttributes)
importFrom(htmltools,tagList)
importFrom(htmltools,tags)
importFrom(markdown,markdownToHTML)
importFrom(rmarkdown,render)
importFrom(shiny,NS)
importFrom(shiny,column)
importFrom(shiny,shinyApp)
importFrom(shiny,tagList)
6 changes: 5 additions & 1 deletion R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
#' @import shinydashboard

app_server <- function(input, output,session) {
callModule(mod_cohort_server, "cohort_ui_1")
callModule(mod_cohort_page_server, "cohort_page_ui_1")
callModule(mod_explore_page_server, "explore_page_ui_1")
callModule(mod_docs_page_server, "docs_page_ui_1")
callModule(mod_about_page_server, "about_page_ui_1")
callModule(mod_resources_page_server, "resources_page_ui_1")
}
31 changes: 21 additions & 10 deletions R/app_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,25 @@ app_ui <- function() {
tagList(
# Leave this function for adding external resources
golem_add_external_resources(),
# List the first level UI elements here
kashboardPage(
dashboardHeader(),
dashboardSidebar(
mod_cohort_ui("cohort_ui_1")
),
dashboardBody()
)
navbarPage(
title = strong("kairos"), selected = "Cohort Builder",
tabPanel("Cohort Builder",
mod_cohort_page_ui("cohort_page_ui_1"),
icon = icon("wrench")),
tabPanel("Explore",
mod_explore_page_ui("explore_page_ui_1"),
icon = icon("chart-area")),
tabPanel("Documentation",
mod_docs_page_ui("docs_page_ui_1"),
icon = icon("book-reader")),
tabPanel("About",
mod_about_page_ui("about_page_ui_1"),
icon = icon("info-circle")),
tabPanel("Resources",
mod_resources_page_ui("resources_page_ui_1"),
icon = icon("external-link")),
collapsible = TRUE, inverse = TRUE,
windowTitle = "kairos")
)
}

Expand All @@ -25,10 +36,10 @@ golem_add_external_resources <- function(){

tags$head(
golem::activate_js(),
golem::favicon()
golem::favicon(),
# Add here all the external resources
# If you have a custom.css in the inst/app/www
# Or for example, you can add shinyalert::useShinyalert() here
#tags$link(rel="stylesheet", type="text/css", href="www/custom.css")
tags$link(rel="stylesheet", type="text/css", href="www/custom.css")
)
}
38 changes: 38 additions & 0 deletions R/mod_about_page.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Module UI

#' @title mod_about_page_ui and mod_about_page_server
#' @description A shiny Module.
#'
#' @param id shiny id
#' @param input internal
#' @param output internal
#' @param session internal
#'
#' @rdname mod_about_page
#'
#' @keywords internal
#' @export
#' @importFrom shiny NS tagList
mod_about_page_ui <- function(id){
ns <- NS(id)
tagList(

)
}

# Module Server

#' @rdname mod_about_page
#' @export
#' @keywords internal

mod_about_page_server <- function(input, output, session){
ns <- session$ns
}

## To be copied in the UI
# mod_about_page_ui("about_page_ui_1")

## To be copied in the server
# callModule(mod_about_page_server, "about_page_ui_1")

35 changes: 35 additions & 0 deletions R/mod_cohort_display.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Module UI

#' @title mod_cohort_display_ui and mod_cohort_display_server
#' @description A shiny Module.
#'
#' @param id shiny id
#' @param input internal
#' @param output internal
#' @param session internal
#'
#' @rdname mod_cohort_display
#'
#' @keywords internal
#' @export
#' @importFrom shiny NS tagList
mod_cohort_display_ui <- function(id){
ns <- NS(id)
}

# Module Server

#' @rdname mod_cohort_display
#' @export
#' @keywords internal

mod_cohort_display_server <- function(input, output, session){
ns <- session$ns
}

## To be copied in the UI
# mod_cohort_display_ui("cohort_display_ui_1")

## To be copied in the server
# callModule(mod_cohort_display_server, "cohort_display_ui_1")

68 changes: 68 additions & 0 deletions R/mod_cohort_page.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Module UI

#' @title mod_cohort_page_ui and mod_cohort_page_server
#' @description A shiny Module.
#'
#' @param id shiny id
#' @param input internal
#' @param output internal
#' @param session internal
#'
#' @rdname mod_cohort_page
#'
#' @keywords internal
#' @export
#' @importFrom shiny NS tagList
mod_cohort_page_ui <- function(id){
ns <- NS(id)
tagList(
dashboardPage(
dashboardHeader(disable = T),
dashboardSidebar(
checkboxGroupInput(ns('isCellLine'), label = "Is Cell Line", choices = unique(cohort$isCellLine),
selected = unique(cohort$isCellLine)),
checkboxGroupInput(ns("tumorType"), label = "Tumor Type", choices = unique(cohort$tumorType),
selected = unique(cohort$tumorType)),
checkboxGroupInput(ns("species"), label = "Species", choices = unique(cohort$species),
selected = unique(cohort$species)),
selectizeInput(ns("studyName"), label = "Study Name", choices = unique(cohort$studyName),
selected = unique(cohort$studyName), multiple = T)),
dashboardBody(
box(width = 12, div(DT::dataTableOutput(ns('data_table')))),
)))
}

# Module Server

#' @rdname mod_cohort_page
#' @export
#' @keywords internal

mod_cohort_page_server <- function(input, output, session){
ns <- session$ns

output$data_table <- DT::renderDataTable({
kairos::cohort %>%
dplyr::filter(studyName %in% input$studyName,
isCellLine %in% input$isCellLine,
tumorType %in% input$tumorType,
species %in% input$species) # kairos::cohort
})

output$specimens <- reactive({
kairos::cohort %>%
dplyr::filter(studyName %in% input$studyName,
isCellLine %in% input$isCellLine,
tumorType %in% input$tumorType,
species %in% input$species) %>%
purrr::pluck("specimenID") %>%
unique()
})
}

## To be copied in the UI
# mod_cohort_page_ui("cohort_page_ui_1")

## To be copied in the server
# callModule(mod_cohort_page_server, "cohort_page_ui_1")

69 changes: 69 additions & 0 deletions R/mod_cohort_selector.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Module UI

#' @title mod_cohort_selector_ui and mod_cohort_selector_server
#' @description A shiny Module.
#'
#' @param id shiny id
#' @param input internal
#' @param output internal
#' @param session internal
#'
#' @rdname mod_cohort_selector
#'
#' @keywords internal
#' @export
#' @importFrom shiny NS tagList
mod_cohort_selector_ui <- function(id){
ns <- NS(id)
tagList(
# actionButton(ns('button'), label = "Build!"),
checkboxGroupInput(ns('isCellLine'), label = "Is Cell Line", choices = unique(cohort$isCellLine),
selected = unique(cohort$isCellLine)),
# ,
# checkboxGroupInput(ns("tumorType"), label = "Tumor Type", choices = unique(cohort$tumorType),
# selected = unique(cohort$tumorType)),
# checkboxGroupInput(ns("species"), label = "Species", choices = unique(cohort$species),
# selected = unique(cohort$species)),
# selectizeInput(ns("modelSystemName"), label = "Model System Name", choices = unique(cohort$modelSystemName),
# selected = unique(cohort$modelSystemName), multiple = T),
# selectizeInput(ns("studyName"), label = "Study Name", choices = unique(cohort$studyName),
# selected = unique(cohort$studyName), multiple = T)
textOutput(ns("foo"))

)

}

# Module Server

#' @rdname mod_cohort_selector
#' @export
#' @keywords internal

mod_cohort_selector_server <- function(input, output, session){
ns <- session$ns

foo <- renderText(paste0("You have chosen: ", input$isCellLine))


# output$specimens <- reactive(input$isCellLine, {
# print(input$isCellLine)
# kairos::cohort %>%
# dplyr::filter(#studyName %in% input$studyName,
# # modelSystemName %in% input$modelSystemName,
# isCellLine %in% input$isCellLine
# # ,
# # tumorType %in% input$tumorType,
# # species %in% input$species
# ) %>%
# purrr::pluck("specimenID") %>%
# unique() })

}

## To be copied in the UI
# mod_cohort_selector_ui("cohort_selector_ui_1")

## To be copied in the server
# callModule(mod_cohort_selector_server, "cohort_selector_ui_1")

14 changes: 7 additions & 7 deletions R/mod_cohort.R → R/mod_docs_page.R
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Module UI

#' @title mod_cohort_ui and mod_cohort_server
#' @title mod_docs_page_ui and mod_docs_page_server
#' @description A shiny Module.
#'
#' @param id shiny id
#' @param input internal
#' @param output internal
#' @param session internal
#'
#' @rdname mod_cohort
#' @rdname mod_docs_page
#'
#' @keywords internal
#' @export
#' @importFrom shiny NS tagList
mod_cohort_ui <- function(id){
mod_docs_page_ui <- function(id){
ns <- NS(id)
tagList(

Expand All @@ -22,17 +22,17 @@ mod_cohort_ui <- function(id){

# Module Server

#' @rdname mod_cohort
#' @rdname mod_docs_page
#' @export
#' @keywords internal

mod_cohort_server <- function(input, output, session){
mod_docs_page_server <- function(input, output, session){
ns <- session$ns
}

## To be copied in the UI
# mod_cohort_ui("cohort_ui_1")
# mod_docs_page_ui("docs_page_ui_1")

## To be copied in the server
# callModule(mod_cohort_server, "cohort_ui_1")
# callModule(mod_docs_page_server, "docs_page_ui_1")

Loading