Commit 2f1d670f authored by Kunst, Jonathan's avatar Kunst, Jonathan
Browse files

Added a panel for model building and visualisation

parent 5d4ff407
library(plotly)
# plotly ----
data("diamonds", package = 'ggplot2')
diamonds
......
......@@ -2,7 +2,7 @@
# R Shiny Script
# Author: Jonathan Kunst
# Date created: 27-09-2021
# Date updated: 27-09-2021
# Date updated: 21-10-2021
# Packages ----
library(DT)
......@@ -88,7 +88,7 @@ ui <- fluidPage(
numericInput(inputId = 'IBD_core',
label = 'Numbers of processing cores',
min = 1,
value = 1,
value = detectCores() / 2,
max = detectCores() - 2),
# Estimate starter
......@@ -255,15 +255,16 @@ server <- function(input, output, session) {
select_offspring = rv$select_offspring(),
multiplot = c(1, 1))
)
output$plot_haplo_imp <- renderPlot(visualiseHaplo(IBD_list = IBD_imp(),
display_by = "name",
linkage_group = 1,
select_offspring = IBD_imp()[1]$offspring[3:11],
multiplot = c(3, 3))
)
#
# output$plot_haplo_imp <- renderPlot(visualiseHaplo(IBD_list = IBD_imp(),
# display_by = "name",
# linkage_group = 1,
# select_offspring = IBD_imp()[1]$offspring[3:11],
# multiplot = c(3, 3))
# )
}
# Run Shiny app example ----
shinyApp(ui = ui, server = server)
\ No newline at end of file
shinyApp(ui = ui, server = server)
......@@ -14,4 +14,6 @@ app_server <- function( input, output, session ) {
# IBD estimation ----
mod_IBD_panel_server("IBD_panel_ui_1", rv = rv)
mod_model_panel_server("model_panel_ui_1", rv = rv)
}
......@@ -17,7 +17,10 @@ app_ui <- function(request) {
# IBD panel ----
tabPanel('IBD',
mod_IBD_panel_ui("IBD_panel_ui_1")
)
),
# Model panel
tabPanel('Model',
mod_model_panel_ui("model_panel_ui_1"))
)
)
}
......
......@@ -27,7 +27,7 @@ mod_import_server <- function(id, rv, rvlab){
observeEvent(input$file, {
req(input$file)
if(rvlab == 'snp'){
rv[[rvlab]] <- read.csv(input$file$datapath, row.names = 1)
rv[[rvlab]] <- as.matrix(read.csv(input$file$datapath, row.names = 1))
} else {
name <- input$file$name[1] # if multiple csv length too long
extension <- tools::file_ext(name)
......
#' model_panel UI Function
#'
#' @description A shiny Module.
#'
#' @param id,input,output,session Internal parameters for {shiny}.
#'
#' @noRd
#'
#' @importFrom shiny NS tagList
mod_model_panel_ui <- function(id){
ns <- NS(id)
tagList(
sidebarLayout(
sidebarPanel(
tabsetPanel(
tabPanel('PolyqtlR'),
tabPanel('qtlpoly')
)
),
mainPanel()
)
)
}
#' model_panel Server Functions
#'
#' @noRd
mod_model_panel_server <- function(id, rv){
moduleServer( id, function(input, output, session){
ns <- session$ns
})
}
## To be copied in the UI
# mod_model_panel_ui("model_panel_ui_1")
## To be copied in the server
# mod_model_panel_server("model_panel_ui_1")
......@@ -16,13 +16,14 @@
## Dependencies ----
## Add one line by package you want to add as dependency
usethis::use_package('polyqtlR')
usethis::use_package('plotly')
usethis::use_package('readr')
usethis::use_package('parallel')
usethis::use_package('tools')
## Add modules ----
## Create a module infrastructure in R/
golem::add_module(name = "import_panel") # Name of the module
golem::add_module(name = "model_panel") # Name of the module
## Add helper functions ----
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment