Skip to content

Commit

Permalink
Merge pull request #30 from allaway/drug-selector
Browse files Browse the repository at this point in the history
Drug selector
  • Loading branch information
allaway authored Mar 31, 2020
2 parents a8be9df + ab48396 commit 8e356ca
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 11 deletions.
58 changes: 58 additions & 0 deletions R/mod_cell_line_selector.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#' cell_line_selector UI Function
#'
#' @description A shiny Module.
#'
#' @param id,input,output,session Internal parameters for {shiny}.
#'
#' @noRd
#'
#' @importFrom shiny NS tagList
mod_cell_line_selector_ui <- function(id){
ns <- NS(id)
tagList(
box(
column(checkboxGroupInput(ns("nf1_genotypes"),label = "NF1 Genotype", choices = unique(kairos::drug_screening$nf1Genotype),
selected = unique(kairos::drug_screening$nf1Genotype)),
width = 2),
column(checkboxGroupInput(ns("nf2_genotypes"),label = "NF2 Genotype", choices = unique(kairos::drug_screening$nf2Genotype),
selected = unique(kairos::drug_screening$nf2Genotype)),
width = 2),
checkboxGroupInput(ns("nf2_knockdowns"),label = "NF1 Knockdowns", choices = unique(kairos::drug_screening$nf1Knockdown),
selected = unique(kairos::drug_screening$nf1Knockdown)),
checkboxGroupInput(ns("nf2_knockdowns"),label = "NF2 Knockdowns", choices = unique(kairos::drug_screening$nf2Knockdown),
selected = unique(kairos::drug_screening$nf2Knockdown)),
width = 12),
box("Selected Cell Lines:",
DT::dataTableOutput(ns("cell_lines_table")),
width = 12)
)
}

#' cell_line_selector Server Function
#'
#' @noRd
mod_cell_line_selector_server <- function(input, output, session){
ns <- session$ns

models <- reactive({
kairos::drug_screening %>%
dplyr::select(model_name, disease_name, symptom_name, nf1Genotype, nf2Genotype, nf1Knockdown, nf2Knockdown) %>%
dplyr::distinct()
})

output$cell_lines_table <- DT::renderDataTable({
models() %>% dplyr::filter(nf1Genotype %in% input$nf1_genotypes,
nf2Genotype %in% input$nf2_genotypes)
})

cell_lines <- reactive({models() %>%
purrr::pluck('model_name') %>%
unique()})
}

## To be copied in the UI
# mod_cell_line_selector_ui("cell_line_selector_ui_1")

## To be copied in the server
# callModule(mod_cell_line_selector_server, "cell_line_selector_ui_1")

30 changes: 30 additions & 0 deletions R/mod_compound_selector.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#' compound_selector UI Function
#'
#' @description A shiny Module.
#'
#' @param id,input,output,session Internal parameters for {shiny}.
#'
#' @noRd
#'
#' @importFrom shiny NS tagList
mod_compound_selector_ui <- function(id){
ns <- NS(id)
tagList(

)
}

#' compound_selector Server Function
#'
#' @noRd
mod_compound_selector_server <- function(input, output, session){
ns <- session$ns

}

## To be copied in the UI
# mod_compound_selector_ui("compound_selector_ui_1")

## To be copied in the server
# callModule(mod_compound_selector_server, "compound_selector_ui_1")

2 changes: 1 addition & 1 deletion R/mod_dose_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mod_dose_response_ui <- function(id){
#' dose_response Server Function
#'
#' @noRd
mod_dose_response_server <- function(input, output, session, cell_lines){
mod_dose_response_server <- function(input, output, session, cell_lines, compounds){
ns <- session$ns

}
Expand Down
26 changes: 16 additions & 10 deletions R/mod_drug_screening_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,30 @@ mod_drug_screening_page_ui <- function(id){
icon = icon("pills")
),
menuItem("Select Cell Lines",
tabName = 'cohort',
tabName = 'cell_lines',
icon = icon("wrench")
),
menuItem("Run Analyses",
icon = icon("chart-area"), startExpanded = TRUE,
menuSubItem(
"Dose-Response",
menuItem("Select Compounds",
tabName = 'compounds',
icon = icon("wrench")
),
menuItem("Dose-Response",
tabName = "dose_response",
icon = icon("cog")
)))),
))),
dashboardBody(
tagList(
tabItems(
tabItem(
tabName = "dashboard"
),
tabItem(
tabName = 'cohort',
mod_cohort_page_ui(ns("cohort_page_ui_1"))
tabName = 'cell_lines',
mod_cell_line_selector_ui(ns("cell_line_selector_ui_1"))
),
tabItem(
tabName = 'compounds',
mod_compound_selector_ui(ns("compound_selector_ui_1"))
),
tabItem(
tabName = 'dose_response',
Expand All @@ -64,8 +69,9 @@ mod_drug_screening_page_ui <- function(id){

mod_drug_screening_page_server <- function(input, output, session){
ns <- session$ns
cell_lines <- NULL
callModule(mod_dose_response_server, "dose_response_ui_1", cell_lines)
cell_lines <- callModule(mod_cell_line_selector_server, "cell_line_selector_ui_1")
compounds <-callModule(mod_compound_selector_server, "compound_selector_ui_1")
callModule(mod_dose_response_server, "dose_response_ui_1", cell_lines, compounds)
}

## To be copied in the UI
Expand Down
18 changes: 18 additions & 0 deletions data-raw/drug_screening.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## code to prepare `drug_screening` dataset goes here
library(synapser)
library(tidyverse)
synLogin()

drug_screening <- synGet("syn20700260")$path %>% readr::read_csv(
col_types = "cccccdcdccccdcdccdc"
)

genotypes <- synTableQuery('select * from syn21830362', includeRowIdAndRowVersion = F)$filepath %>%
read_csv() %>%
rename(model_name = specimenID)

drug_screening <- left_join(drug_screening, genotypes)

usethis::use_data(drug_screening,
#overwrite = T
)
Binary file added data/drug_screening.rda
Binary file not shown.

0 comments on commit 8e356ca

Please sign in to comment.