Skip to content

Commit

Permalink
added tab summary info
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-sandercock committed Sep 24, 2024
1 parent cc49743 commit 86bbcbf
Show file tree
Hide file tree
Showing 10 changed files with 536 additions and 18 deletions.
8 changes: 4 additions & 4 deletions R/app_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ app_ui <- function(request) {
sidebarMenu(id = "MainMenu",
flat = FALSE,
tags$li(class = "header", style = "color: grey; margin-top: 10px; margin-bottom: 10px; padding-left: 15px;", "Menu"),
menuItem("Home", tabName = "welcome", icon = icon("house")),
menuItem("Home", tabName = "welcome", icon = icon("house")),
tags$li(class = "header", style = "color: grey; margin-top: 18px; margin-bottom: 10px; padding-left: 15px;", "Genotype Processing"),
menuItem("DArT Report2VCF", tabName = "dosage2vcf", icon = icon("share-from-square")),
menuItem("Updog Dosage Calling", tabName = "updog", icon = icon("list-ol")),
menuItem("VCF Filtering", tabName = "filtering", icon = icon("filter")),
tags$li(class = "header", style = "color: grey; margin-top: 18px; margin-bottom: 10px; padding-left: 15px;", "Summary Metrics"),
menuItem("Genomic Diversity", tabName = "diversity", icon = icon("chart-pie")),
tags$li(class = "header", style = "color: grey; margin-top: 18px; margin-bottom: 10px; padding-left: 15px;", "Population Structure"),
menuItem("PCA", tabName = "pca", icon = icon("chart-simple")),
menuItem("DAPC", tabName = "dapc", icon = icon("circle-nodes")),
tags$li(class = "header", style = "color: grey; margin-top: 18px; margin-bottom: 10px; padding-left: 15px;", "Summary Metrics"),
menuItem("Genomic Diversity", tabName = "diversity", icon = icon("chart-pie")),
tags$li(class = "header", style = "color: grey; margin-top: 18px; margin-bottom: 10px; padding-left: 15px;", "GWAS"),
menuItem("GWASpoly", tabName = "gwas", icon = icon("think-peaks")),
menuItem("GWASpoly", tabName = "gwas", icon = icon("think-peaks")),
tags$li(class = "header", style = "color: grey; margin-top: 18px; margin-bottom: 10px; padding-left: 15px;", "Genomic Selection"),
menuItem(
span("Predictive Ability", bs4Badge("beta", position = "right", color = "success")),
Expand Down
65 changes: 64 additions & 1 deletion R/mod_DosageCall.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ mod_DosageCall_ui <- function(id){
p(HTML("<b>Parameters description:</b>"), actionButton(ns("goPar"), icon("arrow-up-right-from-square", verify_fa = FALSE) )), hr(),
p(HTML("<b>Results description:</b>"), actionButton(ns("goRes"), icon("arrow-up-right-from-square", verify_fa = FALSE) )), hr(),
p(HTML("<b>How to cite:</b>"), actionButton(ns("goCite"), icon("arrow-up-right-from-square", verify_fa = FALSE) )), hr(),
p(HTML("<b>Updog tutorial:</b>"), actionButton(ns("goUpdog"), icon("arrow-up-right-from-square", verify_fa = FALSE), onclick ="window.open('https://dcgerard.github.io/updog/', '_blank')" )),
p(HTML("<b>Updog tutorial:</b>"), actionButton(ns("goUpdog"), icon("arrow-up-right-from-square", verify_fa = FALSE), onclick ="window.open('https://dcgerard.github.io/updog/', '_blank')" )), hr(),
actionButton(ns("dosage_summary"), "Summary"),
circle = FALSE,
status = "warning",
icon = icon("info"), width = "500px",
Expand Down Expand Up @@ -429,6 +430,68 @@ mod_DosageCall_server <- function(input, output, session, parent_session){
ex <- system.file("iris_DArT_MADC.csv", package = "BIGapp")
file.copy(ex, file)
})

##Summary Info
dosage_summary_info <- function() {
#Handle possible NULL values for inputs
genotype_file_name <- if (!is.null(input$madc_file$name)) input$madc_file$name else "No file selected"
report_file_name <- if (!is.null(input$madc_passport$name)) input$madc_passport$name else "No file selected"
selected_ploidy <- if (!is.null(input$ploidy)) as.character(input$ploidy) else "Not selected"

#Print the summary information
cat(
"BIGapp Dosage Calling Summary\n",
"\n",
paste0("Date: ", Sys.Date()), "\n",
paste("R Version:", R.Version()$version.string), "\n",
"\n",
"### Input Files ###\n",
"\n",
paste("Input Genotype File:", genotype_file_name), "\n",
paste("Input Passport File:", report_file_name), "\n",
"\n",
"### User Selected Parameters ###\n",
"\n",
paste("Selected Ploidy:", selected_ploidy), "\n",
paste("Selected Updog Model:", input$updog_model), "\n",
"\n",
"### R Packages Used ###\n",
"\n",
paste("BIGapp:", packageVersion("BIGapp")), "\n",
paste("BIGr:", packageVersion("BIGr")), "\n",
paste("Updog:", packageVersion("updog")), "\n",
paste("dplyr:", packageVersion("dplyr")), "\n",
sep = ""
)
}

# Popup for analysis summary
observeEvent(input$dosage_summary, {
showModal(modalDialog(
title = "Summary Information",
size = "l",
easyClose = TRUE,
footer = tagList(
modalButton("Close"),
downloadButton("download_dosage_info", "Download")
),
pre(
paste(capture.output(dosage_summary_info()), collapse = "\n")
)
))
})


# Download Summary Info
output$download_dosage_info <- downloadHandler(
filename = function() {
paste("DosageCalling_summary_", Sys.Date(), ".txt", sep = "")
},
content = function(file) {
# Write the summary info to a file
writeLines(paste(capture.output(dosage_summary_info()), collapse = "\n"), file)
}
)
}

## To be copied in the UI
Expand Down
74 changes: 70 additions & 4 deletions R/mod_Filtering.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ mod_Filtering_ui <- function(id){
div(style="display:inline-block; float:right",dropdownButton(
tags$h3("Updog Filter Parameters"),
"You can download examples of the expected file here: \n",
downloadButton(ns('download_vcf'), "Download VCF Example File"),
# "Add description of each filter. Presently, all filtering parameters that are typically used for processing
# a VCF file from Updog dosage calling are included. If a VCF file does not contain these values, it will only be
# filtered for read depth, missing data, and maf.",
downloadButton(ns('download_vcf'), "Download VCF Example File"), hr(),
actionButton(ns("filtering_summary"), "Summary"),
circle = FALSE,
status = "warning",
icon = icon("info"), width = "300px",
Expand Down Expand Up @@ -624,6 +622,74 @@ mod_Filtering_server <- function(input, output, session, parent_session){
ex <- system.file("iris_DArT_VCF.vcf.gz", package = "BIGapp")
file.copy(ex, file)
})

##Summary Info
filtering_summary_info <- function() {
#Handle possible NULL values for inputs
genotype_file_name <- if (!is.null(input$updog_rdata$name)) input$updog_rdata$name else "No file selected"
selected_ploidy <- if (!is.null(input$filter_ploidy)) as.character(input$filter_ploidy) else "Not selected"

#Print the summary information
cat(
"BIGapp VCF Filtering Summary\n",
"\n",
paste0("Date: ", Sys.Date()), "\n",
paste(R.Version()$version.string), "\n",
"\n",
"### Input Files ###\n",
"\n",
paste("Input Genotype File:", genotype_file_name), "\n",
"\n",
"### User Selected Parameters ###\n",
"\n",
paste("Selected Ploidy:", selected_ploidy), "\n",
paste("MAF Filter:", input$filter_maf), "\n",
paste("Min Read Depth (Marker per Sample):", input$size_depth), "\n",
paste("Remove SNPs with >= % missing data:", input$snp_miss), "\n",
paste("Remove Samples with >= % missing data:", input$sample_miss), "\n",
paste("Use Updog Filtering Parameters?:", input$use_updog), "\n",
paste("Max OD (Updog filter):", ifelse(input$use_updog,input$OD_filter, "NA")), "\n",
paste("Bias Minimum (Updog filter):", ifelse(input$use_updog,input$Bias[1], "NA")), "\n",
paste("Bias Maximum (Updog filter):", ifelse(input$use_updog,input$Bias[2], "NA")), "\n",
paste("Max Prop_mis (Updog filter):", ifelse(input$use_updog,input$Prop_mis,"NA")), "\n",
paste("Minimum maxpostprob (Updog filter):", ifelse(input$use_updog,input$maxpostprob_filter,"NA")), "\n",
"\n",
"### R Packages Used ###\n",
"\n",
paste("BIGapp:", packageVersion("BIGapp")), "\n",
paste("BIGr:", packageVersion("BIGr")), "\n",
paste("Updog:", packageVersion("updog")), "\n",
sep = ""
)
}

# Popup for analysis summary
observeEvent(input$filtering_summary, {
showModal(modalDialog(
title = "Summary Information",
size = "l",
easyClose = TRUE,
footer = tagList(
modalButton("Close"),
downloadButton("download_filtering_info", "Download")
),
pre(
paste(capture.output(filtering_summary_info()), collapse = "\n")
)
))
})


# Download Summary Info
output$download_filtering_info <- downloadHandler(
filename = function() {
paste("Filtering_summary_", Sys.Date(), ".txt", sep = "")
},
content = function(file) {
# Write the summary info to a file
writeLines(paste(capture.output(filtering_summary_info()), collapse = "\n"), file)
}
)
}

## To be copied in the UI
Expand Down
75 changes: 72 additions & 3 deletions R/mod_GS.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ mod_GS_ui <- function(id){
"You can download examples of the expected input input files here: \n",
downloadButton(ns('download_vcft'), "Download Training VCF Example File"),
downloadButton(ns('download_pheno'), "Download Passport Example File"),
downloadButton(ns('download_vcfp'), "Download Prediction VCF Example File"),

#"GP uses the rrBLUP package: It can impute missing data, adapt to different ploidy, perform 5-fold cross validations with different number of iterations, run multiple traits, and accept multiple fixed effects.",
downloadButton(ns('download_vcfp'), "Download Prediction VCF Example File"),hr(),
actionButton(ns("pred_summary"), "Summary"),
circle = FALSE,
status = "warning",
icon = icon("info"), width = "300px",
Expand Down Expand Up @@ -720,6 +719,76 @@ mod_GS_server <- function(input, output, session, parent_session){
ex <- system.file("iris_passport_file.csv", package = "BIGapp")
file.copy(ex, file)
})

##Summary Info
pred_summary_info <- function() {
# Handle possible NULL values for inputs
dosage_file_name <- if (!is.null(input$pred_known_file$name)) input$pred_known_file$name else "No file selected"
est_file_name <- if (!is.null(input$pred_est_file$name)) input$pred_est_file$name else "No file selected"
passport_file_name <- if (!is.null(input$pred_trait_file$name)) input$pred_trait_file$name else "No file selected"
selected_ploidy <- if (!is.null(input$pred_est_ploidy)) as.character(input$pred_est_ploidy) else "Not selected"

# Print the summary information
cat(
"BIGapp Selection Summary\n",
"\n",
paste0("Date: ", Sys.Date()), "\n",
paste("R Version:", R.Version()$version.string), "\n",
"\n",
"### Input Files ###\n",
"\n",
paste("Input Genotype File 1:", dosage_file_name), "\n",
paste("Input Genotype File 2:", est_file_name), "\n",
paste("Input Passport File:", passport_file_name), "\n",
"\n",
"### User Selected Parameters ###\n",
"\n",
paste("Selected Ploidy:", selected_ploidy), "\n",
paste("Selected Trait(s):", input$pred_trait_info2), "\n",
paste("Selected Fixed Effects:", input$pred_fixed_info2), "\n",
#paste("Selected Model:", input$pred_fixed_info2), "\n",
#paste("Selected Matrix:", input$pred_fixed_info2), "\n",
"\n",
"### R Packages Used ###\n",
"\n",
paste("BIGapp:", packageVersion("BIGapp")), "\n",
paste("AGHmatrix:", packageVersion("AGHmatrix")), "\n",
paste("ggplot2:", packageVersion("ggplot2")), "\n",
paste("rrBLUP:", packageVersion("rrBLUP")), "\n",
paste("vcfR:", packageVersion("vcfR")), "\n",
paste("dplyr:", packageVersion("dplyr")), "\n",
paste("tidyr:", packageVersion("tidyr")), "\n",
sep = ""
)
}

# Popup for analysis summary
observeEvent(input$pred_summary, {
showModal(modalDialog(
title = "Summary Information",
size = "l",
easyClose = TRUE,
footer = tagList(
modalButton("Close"),
downloadButton("download_pred_info", "Download")
),
pre(
paste(capture.output(pred_summary_info()), collapse = "\n")
)
))
})


# Download Summary Info
output$download_pred_info <- downloadHandler(
filename = function() {
paste("pred_summary_", Sys.Date(), ".txt", sep = "")
},
content = function(file) {
# Write the summary info to a file
writeLines(paste(capture.output(pred_summary_info()), collapse = "\n"), file)
}
)
}

## To be copied in the UI
Expand Down
71 changes: 70 additions & 1 deletion R/mod_GSAcc.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ mod_GSAcc_ui <- function(id){
tags$h3("GP Parameters"),
"You can download examples of the expected input input files here: \n",
downloadButton(ns('download_vcf'), "Download VCF Example File"),
downloadButton(ns('download_pheno'), "Download Passport Example File"),
downloadButton(ns('download_pheno'), "Download Passport Example File"),hr(),
actionButton(ns("predAcc_summary"), "Summary"),
circle = FALSE,
status = "warning",
icon = icon("info"), width = "300px",
Expand Down Expand Up @@ -783,6 +784,74 @@ mod_GSAcc_server <- function(input, output, session, parent_session){
ex <- system.file("iris_passport_file.csv", package = "BIGapp")
file.copy(ex, file)
})

##Summary Info
predAcc_summary_info <- function() {
# Handle possible NULL values for inputs
dosage_file_name <- if (!is.null(input$pred_file$name)) input$pred_file$name else "No file selected"
passport_file_name <- if (!is.null(input$trait_file$name)) input$trait_file$name else "No file selected"
selected_ploidy <- if (!is.null(input$pred_ploidy)) as.character(input$pred_ploidy) else "Not selected"

# Print the summary information
cat(
"BIGapp Selection Model CV Summary\n",
"\n",
paste0("Date: ", Sys.Date()), "\n",
paste("R Version:", R.Version()$version.string), "\n",
"\n",
"### Input Files ###\n",
"\n",
paste("Input Genotype File:", dosage_file_name), "\n",
paste("Input Passport File:", passport_file_name), "\n",
"\n",
"### User Selected Parameters ###\n",
"\n",
paste("Selected Ploidy:", selected_ploidy), "\n",
paste("Selected Trait(s):", input$pred_trait_info), "\n",
paste("Selected Fixed Effects:", input$pred_fixed_info), "\n",
paste("Selected Model:", advanced_options$pred_model), "\n",
paste("Selected Matrix:", advanced_options$pred_matrix), "\n",
"\n",
"### R Packages Used ###\n",
"\n",
paste("BIGapp:", packageVersion("BIGapp")), "\n",
paste("AGHmatrix:", packageVersion("AGHmatrix")), "\n",
paste("ggplot2:", packageVersion("ggplot2")), "\n",
paste("rrBLUP:", packageVersion("rrBLUP")), "\n",
paste("vcfR:", packageVersion("vcfR")), "\n",
paste("dplyr:", packageVersion("dplyr")), "\n",
paste("tidyr:", packageVersion("tidyr")), "\n",
sep = ""
)
}

# Popup for analysis summary
observeEvent(input$predAcc_summary, {
showModal(modalDialog(
title = "Summary Information",
size = "l",
easyClose = TRUE,
footer = tagList(
modalButton("Close"),
downloadButton("download_predAcc_info", "Download")
),
pre(
paste(capture.output(predAcc_summary_info()), collapse = "\n")
)
))
})


# Download Summary Info
output$download_predAcc_info <- downloadHandler(
filename = function() {
paste("predAcc_summary_", Sys.Date(), ".txt", sep = "")
},
content = function(file) {
# Write the summary info to a file
writeLines(paste(capture.output(predAcc_summary_info()), collapse = "\n"), file)
}
)
}

## To be copied in the UI
Expand Down
2 changes: 1 addition & 1 deletion R/mod_PCA.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ mod_PCA_ui <- function(id){
tags$h3("PCA Inputs"),
"You can download examples of the expected files here: \n",
downloadButton(ns('download_vcf'), "Download VCF Example File"),
downloadButton(ns('download_pheno'), "Download Passport Example File"),
downloadButton(ns('download_pheno'), "Download Passport Example File"),hr(),
actionButton(ns("pca_summary"), "Summary"),
circle = FALSE,
status = "warning",
Expand Down
Loading

0 comments on commit 86bbcbf

Please sign in to comment.