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

Data input fully functional but should be adjusted so user can select right...

Data input fully functional but should be adjusted so user can select right columns for IBD imputation.

IBD imputation moved to its own part but currently not working due to odd formatting while reading in files
parent e0a0d738
......@@ -8,6 +8,7 @@
library(shiny)
library(polyqtlR)
library(DT)
library(data.table)
# UI ----
# Define page layout, fluidPage automatically adjusts to user border dimensions
......@@ -15,38 +16,29 @@ library(DT)
ui <- fluidPage(
navbarPage(title = 'Polyploid QTL visualisation', inverse = TRUE,
tabPanel('Data import',
# Page for data import with instructions
tabPanel(# Page for data import with instructions ----
'Data import',
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'),
# Linkage map input
fileInput(inputId = 'i_link_map',
label = 'Phased linkage map files',
multiple = TRUE),
hr(),
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(),
hr(),
#IBD probability input
fileInput(inputId = 'i_IBD',
......@@ -70,11 +62,30 @@ ui <- fluidPage(
)
),
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
),
navbarMenu(# IBD page ----
'IBD estimation',
tabPanel('Heuristic',
sidebarLayout(
sidebarPanel(
h3('Estimation settings'),
# Ploidy level indicator
numericInput(inputId = 'ploidy',
label = 'Ploidy level',
value = 4),
# Estimate starter
actionButton('heu_estimate',
label = 'Estimate IBD')
),
mainPanel(
h3('Output heuristic method'),
DT::dataTableOutput('table_heu')
)
)),
tabPanel('HMM')
),
tabPanel('QTL visualisation'),
......@@ -104,39 +115,34 @@ server <- function(input, output) {
# Phenotype
phenotype <- reactive({
req(input$i_phenotype)
read.csv(input$i_phenotype$datapath, header = TRUE)
})
# Phased Linkage map
link_map_1 <- reactive({
req(input$i_link_map_1)
read.csv(input$i_link_map_1$datapath, header = TRUE)
fread(input$i_phenotype$datapath)
})
link_map_2 <- reactive({
req(input$i_link_map_2)
read.csv(input$i_link_map_2$datapath, header = TRUE)
# Phased Linkage maps
link_map <- reactive({
req(input$i_link_map)
lapply(input$i_link_map$datapath, fread)
})
# SNP Dosage data
dosage <- reactive({
req(input$i_dosage)
read.csv(input$i_dosage$datapath, header = TRUE)})
fread(input$i_dosage$datapath)})
# IBD
IBD <- reactive({
req(input$i_IBD)
read.csv(input$i_IBD$datapath, header = TRUE)})
fread(input$i_IBD$datapath)})
# 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())
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 linkage map 2 data
output$table_link_map_2 <- DT::renderDataTable(link_map()[[2]])
# Show table for SNP dosage data
output$table_dosage <- DT::renderDataTable(dosage())
......@@ -144,6 +150,17 @@ server <- function(input, output) {
# Show table for IBD probability data
output$table_IBD <- DT::renderDataTable(IBD())
# IBD imputation ----
# heuristic IBD estimation
heu_IBD <- eventReactive(input$heu_estimate, {
estimate_IBD(phased_maplist = link_map(),
genotypes = dosage(),
ploidy = input$ploidy,
ncores = 2)
})
# show table heuristic IBDs
output$table_heu <- DT::renderDataTable(heu_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