Commit e0a0d738 authored by Kunst, Jonathan's avatar Kunst, Jonathan
Browse files

Add tabs for data tables and made data import functional

parent 5f39d0e2
......@@ -7,98 +7,143 @@
# Packages ----
library(shiny)
library(polyqtlR)
library(DT)
# UI ----
# Define page layout, fluidPage automatically adjusts to user border dimensions
# navbarPage allows for multiple sheets for several pages
ui <- fluidPage(
navbarPage(title = 'Polyploid QTL visualisation', inverse = TRUE,
tabPanel('Data import',
# Page for data import with instructions
sidebarLayout(
sidebarPanel(
h3('Input'),
# Linkage map input
fileInput(inputId = 'i_link_map',
label = 'Phased linkage map file'),
fluidRow(column(10, verbatimTextOutput("o_link_map"))),
hr(),
fileInput(inputId = 'i_dosage',
label = 'SNP dosage score file'),
fluidRow(column(10, verbatimTextOutput("o_dosage"))),
# IBD probability imputation method
radioButtons(inputId = "i_IBD_choide",
label = 'IBD imputation method',
choices = c('Heuristic' = 1, 'HMM' = 2)),
# IBD probability imputation
actionButton(inputId = 'i_IBD_impute',
label = 'Impute IBD probabilities'),
hr(),
tabPanel('Data import',
# Page for data import with instructions
sidebarLayout(
sidebarPanel(
h3('Input'),
# Phenotype input
fileInput(inputId = 'i_phenotype',
label = 'Phenotype file'),
hr(),
# Linkage map 1 input
fileInput(inputId = 'i_link_map_1',
label = 'Phased linkage map 1 file'),
# Linkage map 2 input
fileInput(inputId = 'i_link_map_2',
label = 'Phased linkage map 2 file'),
hr(),
fileInput(inputId = 'i_dosage',
label = 'SNP dosage score file'),
# IBD probability imputation method
radioButtons(inputId = "i_IBD_choide",
label = 'IBD imputation method',
choices = c('Heuristic' = 1, 'HMM' = 2)),
# IBD probability imputation
actionButton(inputId = 'i_IBD_impute',
label = 'Impute IBD probabilities'),
hr(),
#IBD probability input
fileInput(inputId = 'i_IBD',
label = 'IBD probability file'),
),
mainPanel(
tabsetPanel(
tabPanel('Phenotype',
DT::dataTableOutput('table_phenotype')),
tabPanel('Linkage Map 1',
DT::dataTableOutput('table_link_map_1')),
tabPanel('Linkage Map 2',
DT::dataTableOutput('table_link_map_2')),
tabPanel('SNP Dosage Score',
DT::dataTableOutput('table_dosage')),
tabPanel('IBD Probability',
DT::dataTableOutput('table_IBD'))
)
)
)
),
#IBD probability input
fileInput(inputId = 'i_IBD',
label = 'IBD probability file'),
fluidRow(column(10, verbatimTextOutput("o_IBD")))
),
mainPanel(
p("Welcome to the R Shiny Polyploid QTL Visualisation application.
Please enter SNP dosage score in the appropiate format of
... Additionally, a linkage map is required in the following format
...")
)
)
),
tabPanel('Model Creation',
# Page for model creation by selection of which type of model
# (e.g. fixed effect), interactions,
# and which trait QTLs should be found for
),
tabPanel('QTL visualisation'),
tabPanel('Data export'),
tabPanel('Contact',
fluidPage(
mainPanel(
p('This R Shiny application was built to make polyploid QTL analysis
tabPanel('Model Creation',
# Page for model creation by selection of which type of model
# (e.g. fixed effect), interactions,
# and which trait QTLs should be found for
),
tabPanel('QTL visualisation'),
tabPanel('Data export'),
tabPanel('About',
fluidPage(
mainPanel(
p('This R Shiny application was built to make polyploid QTL analysis
package available for non-R users. Packages are:'),
strong('polyqtlR'),
br(),
br(),
p('For questions and feedback please contact Jonathan Kunst at jonathan.kunst@wur.nl')
strong('polyqtlR'),
br(),
br(),
p('For questions and feedback please contact Jonathan Kunst at jonathan.kunst@wur.nl')
)
)
)
)
)
)
)
# Server functions ----
# input read function #TODO
# Define server ----
# Server ----
server <- function(input, output) {
# Input check of IBD probability data
output$o_IBD <- renderPrint({
str(input$i_IBD)
})
# Read Data ----
# Phenotype
phenotype <- reactive({
req(input$i_phenotype)
read.csv(input$i_phenotype$datapath, header = TRUE)
})
# Input check of SNP dosage data
output$o_dosage <- renderPrint({
str(input$i_dosage)
# Phased Linkage map
link_map_1 <- reactive({
req(input$i_link_map_1)
read.csv(input$i_link_map_1$datapath, header = TRUE)
})
# Input check of linkage map data
output$o_link_map<- renderPrint({
str(input$i_link_map)
link_map_2 <- reactive({
req(input$i_link_map_2)
read.csv(input$i_link_map_2$datapath, header = TRUE)
})
# SNP Dosage data
dosage <- reactive({
req(input$i_dosage)
read.csv(input$i_dosage$datapath, header = TRUE)})
# IBD
IBD <- reactive({
req(input$i_IBD)
read.csv(input$i_IBD$datapath, header = TRUE)})
# Data tables ----
# Show table for phenotype data
output$table_phenotype <- DT::renderDataTable(phenotype())
# Show table for linkage map 1 data
output$table_link_map_1 <- DT::renderDataTable(link_map_1())
# Show table for linkage map 1 data
output$table_link_map_2 <- DT::renderDataTable(link_map_2())
# Show table for SNP dosage data
output$table_dosage <- DT::renderDataTable(dosage())
# Show table for IBD probability data
output$table_IBD <- DT::renderDataTable(IBD())
}
......
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