Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review #91

Open
wants to merge 9 commits into
base: cris_bridge
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM rocker/r-ver:4.4.2
RUN apt-get update && apt-get install -y cmake libz-dev libcurl4-openssl-dev libssl-dev
RUN R -e 'install.packages("remotes")'
RUN Rscript -e 'remotes::install_version("adegenet",upgrade="never", version = "2.1.10")'
RUN Rscript -e 'remotes::install_version("curl",upgrade="never", version = "6.0.1")'
RUN Rscript -e 'remotes::install_version("DT",upgrade="never", version = "0.33")'
RUN Rscript -e 'remotes::install_version("dplyr",upgrade="never", version = "1.1.4")'
RUN Rscript -e 'remotes::install_version("vcfR",upgrade="never", version = "1.15.0")'
RUN Rscript -e 'remotes::install_version("ggplot2",upgrade="never", version = "3.5.1")'
RUN Rscript -e 'remotes::install_version("tidyr",upgrade="never", version = "1.3.1")'
RUN Rscript -e 'remotes::install_version("curl",upgrade="never", version = "6.0.1")'
RUN Rscript -e 'remotes::install_version("shiny",upgrade="never", version = "1.9.1")'
RUN Rscript -e 'remotes::install_version("config",upgrade="never", version = "0.3.2")'
RUN Rscript -e 'remotes::install_version("bs4Dash",upgrade="never", version = "2.3.4")'
RUN Rscript -e 'remotes::install_version("golem",upgrade="never", version = "0.5.1")'
RUN Rscript -e 'remotes::install_version("purrr",upgrade="never", version = "1.0.2")'
RUN Rscript -e 'remotes::install_version("markdown",upgrade="never", version = "1.13")'
RUN Rscript -e 'remotes::install_version("scales",upgrade="never", version = "1.3.0")'
RUN Rscript -e 'remotes::install_version("plotly",upgrade="never", version = "4.10.4")'
RUN Rscript -e 'remotes::install_version("shinyWidgets",upgrade="never", version = "0.8.7")'
RUN Rscript -e 'remotes::install_version("shinyjs",upgrade="never", version = "2.1.0")'
RUN Rscript -e 'remotes::install_version("shinydisconnect",upgrade="never", version = "0.1.1")'
RUN Rscript -e 'remotes::install_version("shinyalert",upgrade="never", version = "3.1.0")'
RUN Rscript -e 'remotes::install_version("stringr",upgrade="never", version = "1.5.1")'
RUN Rscript -e 'remotes::install_version("updog",upgrade="never", version = "2.1.5")'
RUN Rscript -e 'remotes::install_version("AGHmatrix",upgrade="never", version = "2.1.4")'
RUN Rscript -e 'remotes::install_version("factoextra",upgrade="never", version = "1.0.7")'
RUN Rscript -e 'remotes::install_version("httr",upgrade="never", version = "1.4.7")'
RUN Rscript -e 'remotes::install_version("future",upgrade="never", version = "1.34.0")'
RUN Rscript -e 'remotes::install_version("shinycssloaders",upgrade="never", version = "1.1.0")'
RUN Rscript -e 'remotes::install_version("RColorBrewer",upgrade="never", version = "1.1.3")'
RUN Rscript -e 'remotes::install_version("tibble",upgrade="never", version = "3.2.1")'
RUN Rscript -e 'remotes::install_version("rrBLUP",upgrade="never", version = "4.6.3")'
RUN Rscript -e 'remotes::install_version("MASS",upgrade="never", version = "7.3.60.2")'
RUN Rscript -e 'remotes::install_version("Matrix",upgrade="never", version = "1.7.0")'
RUN Rscript -e 'remotes::install_version("matrixcalc",upgrade="never", version = "1.0.6")'
RUN Rscript -e 'remotes::install_github("Breeding-Insight/BIGr",upgrade="never")'
RUN Rscript -e 'remotes::install_github("jendelman/GWASpoly",upgrade="never")'

RUN mkdir /build_zone
ADD . /build_zone
WORKDIR /build_zone
RUN R -e 'remotes::install_local(upgrade="never")'
RUN rm -rf /build_zone
EXPOSE 80
CMD R -e "options('shiny.port'=80,shiny.host='0.0.0.0');BIGapp::run_app()"

48 changes: 20 additions & 28 deletions R/mod_DosageCall.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#'
#' @noRd
#'
#' @importFrom shinyjs enable disable useShinyjs
#' @importFrom shiny NS tagList
#' @importFrom future availableCores
#' @importFrom bs4Dash renderValueBox
Expand All @@ -16,6 +15,7 @@
mod_DosageCall_ui <- function(id){
ns <- NS(id)
tagList(
useShinyjs(),
fluidPage(
disconnectMessage(
text = "An unexpected error occurred, please reload the application and check the input file(s).",
Expand Down Expand Up @@ -55,22 +55,22 @@ mod_DosageCall_ui <- function(id){
)
)
),
textInput(ns("output_name"), "Output File Name"),
numericInput(ns("ploidy"), "Species Ploidy", min = 1, value = NULL),
selectInput(ns("updog_model"), "Updog Model", choices = c("norm","hw","bb","s1","s1pp","f1","f1pp","flex","uniform"), selected = "norm"),
textInput(ns("output_name"), "Output File Name*"),
numericInput(ns("ploidy"), "Species Ploidy*", min = 1, value = NULL),
selectInput(ns("updog_model"), "Updog Model*", choices = c("norm","hw","bb","s1","s1pp","f1","f1pp","flex","uniform"), selected = "norm"),
conditionalPanel(
condition = "input.updog_model == 'f1' | input.updog_model == 'f1pp'",
ns = ns,
tags$div(
style = "padding-left: 20px;", # Add padding/indentation
textInput(
inputId = ns("parent1"),
label = "Enter parent1 ID:",
label = "Enter parent1 ID*:",
value = NULL
),
textInput(
inputId = ns("parent2"),
label = "Enter parent2 ID:",
label = "Enter parent2 ID*:",
value = NULL
)
)
Expand All @@ -82,15 +82,14 @@ mod_DosageCall_ui <- function(id){
style = "padding-left: 20px;", # Add padding/indentation
textInput(
inputId = ns("parent"),
label = "Enter parent ID:",
label = "Enter parent ID*:",
value = NULL
)
)
),
numericInput(ns("cores"), "Number of CPU Cores", min = 1, max = (future::availableCores() - 1), value = 1),
numericInput(ns("cores"), "Number of CPU Cores*", min = 1, max = (future::availableCores() - 1), value = 1),
actionButton(ns("run_analysis"), "Run Analysis"),
useShinyjs(),
downloadButton(ns('download_updog_vcf'), "Download VCF File", class = "butt"),
uiOutput(ns('mybutton')),

div(style="display:inline-block; float:right",dropdownButton(
HTML("<b>Input files</b>"),
Expand Down Expand Up @@ -123,7 +122,6 @@ mod_DosageCall_ui <- function(id){
#' @import vcfR
#' @import updog
#' @importFrom BIGr updog2vcf
#' @importFrom shinyjs enable disable
#' @import dplyr
#'
#' @noRd
Expand Down Expand Up @@ -207,8 +205,6 @@ mod_DosageCall_server <- function(input, output, session, parent_session){
valueBox(snp_number(), "Markers in uploaded file", icon = icon("dna"), color = "info")
})

disable("download_updog_vcf")

##This is for performing Updog Dosage Calling
updog_out <- eventReactive(input$run_analysis,{

Expand Down Expand Up @@ -374,7 +370,7 @@ mod_DosageCall_server <- function(input, output, session, parent_session){

return()
}

if (nrow(matrices$ref_matrix) == 0 || nrow(matrices$size_matrix) == 0) {
shinyalert(
title = "Data Warning!",
Expand All @@ -390,7 +386,7 @@ mod_DosageCall_server <- function(input, output, session, parent_session){
showCancelButton = FALSE,
animation = TRUE
)

return()
}

Expand All @@ -410,14 +406,9 @@ mod_DosageCall_server <- function(input, output, session, parent_session){
})

# Only make available the download button when analysis is finished
observe({
if (!is.null(updog_out())) {
Sys.sleep(1)
# enable the download button
enable("download_updog_vcf")
} else {
disable("download_updog_vcf")
}
output$mybutton <- renderUI({
if(isTruthy(updog_out()))
downloadButton(ns("download_updog_vcf"), "Download VCF file", class = "butt")
})

output$download_updog_vcf <- downloadHandler(
Expand All @@ -426,6 +417,7 @@ mod_DosageCall_server <- function(input, output, session, parent_session){
paste0(output_name, ".vcf.gz")
},
content = function(file) {

#Save Updog output as VCF file
temp <- tempfile()
updog2vcf(
Expand Down Expand Up @@ -459,14 +451,14 @@ 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",
Expand All @@ -493,7 +485,7 @@ mod_DosageCall_server <- function(input, output, session, parent_session){
sep = ""
)
}

# Popup for analysis summary
observeEvent(input$dosage_summary, {
showModal(modalDialog(
Expand All @@ -509,8 +501,8 @@ mod_DosageCall_server <- function(input, output, session, parent_session){
)
))
})


# Download Summary Info
output$download_dosage_info <- downloadHandler(
filename = function() {
Expand Down
44 changes: 17 additions & 27 deletions R/mod_Filtering.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ mod_Filtering_ui <- function(id){
)
),
actionButton(ns("run_filters"), "Apply Filters"),
useShinyjs(),
downloadButton(ns("start_updog_filter"), "Download", icon = icon("download"), class = "butt"),
uiOutput(ns("mybutton")),
div(style="display:inline-block; float:right",dropdownButton(
HTML("<b>Input files</b>"),
p(downloadButton(ns('download_vcf'),""), "VCF Example File"),
Expand All @@ -75,8 +74,7 @@ mod_Filtering_ui <- function(id){
valueBoxOutput(ns("snp_removed_box"), width = NULL),
box(title = "Plot Controls", status = "warning", solidHeader = TRUE, collapsible = TRUE,
sliderInput(ns("hist_bins"),"Histogram Bins", min = 1, max = 1200, value = c(50), step = 1), width = NULL,
div(style="display:inline-block; float:left",dropdownButton(
tags$h3("Save Image"),
div(style="display:inline-block; float:left", dropdownButton(
selectInput(inputId = ns('filter_hist'), label = 'Figure', choices = c("Bias Histogram",
"OD Histogram",
"Prop_mis Histogram",
Expand All @@ -88,7 +86,7 @@ mod_Filtering_ui <- function(id){
sliderInput(inputId = ns('image_height'), label = 'Height', value = 5, min = 1, max = 20, step = 0.5),
downloadButton(ns("download_filter_hist"), "Save"),
circle = FALSE,
status = "danger",
status = "danger", label = "Save Image",
icon = icon("floppy-disk"), width = "300px",
tooltip = tooltipOptions(title = "Click to see inputs!")
))
Expand All @@ -112,37 +110,37 @@ mod_Filtering_ui <- function(id){
mod_Filtering_server <- function(input, output, session, parent_session){

ns <- session$ns

# Help links
observeEvent(input$goPar, {
# change to help tab
updatebs4TabItems(session = parent_session, inputId = "MainMenu",
selected = "help")

# select specific tab
updateTabsetPanel(session = parent_session, inputId = "VCF_Filtering_tabset",
selected = "VCF_Filtering_par")
# expand specific box
updateBox(id = "VCF_Filtering_box", action = "toggle", session = parent_session)
})

observeEvent(input$goRes, {
# change to help tab
updatebs4TabItems(session = parent_session, inputId = "MainMenu",
selected = "help")

# select specific tab
updateTabsetPanel(session = parent_session, inputId = "VCF_Filtering_tabset",
selected = "VCF_Filtering_results")
# expand specific box
updateBox(id = "VCF_Filtering_box", action = "toggle", session = parent_session)
})

observeEvent(input$goCite, {
# change to help tab
updatebs4TabItems(session = parent_session, inputId = "MainMenu",
selected = "help")

# select specific tab
updateTabsetPanel(session = parent_session, inputId = "VCF_Filtering_tabset",
selected = "VCF_Filtering_cite")
Expand Down Expand Up @@ -177,8 +175,6 @@ mod_Filtering_server <- function(input, output, session, parent_session){
)
})

disable("start_updog_filter")

output$din_tabs <- renderUI({
tabBox(width =12, collapsible = FALSE, status = "info",
id = "updog_tab", height = "600px",
Expand Down Expand Up @@ -351,17 +347,11 @@ mod_Filtering_server <- function(input, output, session, parent_session){
})

# Only make available the download button when analysis is finished
observe({
if (!is.null(vcf())) {
Sys.sleep(1)
# enable the download button
enable("start_updog_filter")
} else {
disable("start_updog_filter")
}
output$mybutton <- renderUI({
if(isTruthy(vcf()))
downloadButton(ns("start_updog_filter"), "Download VCF file", class = "butt")
})


#Updog filtering
output$start_updog_filter <- downloadHandler(
filename = function() {
Expand Down Expand Up @@ -671,13 +661,13 @@ 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",
Expand Down Expand Up @@ -711,7 +701,7 @@ mod_Filtering_server <- function(input, output, session, parent_session){
sep = ""
)
}

# Popup for analysis summary
observeEvent(input$filtering_summary, {
showModal(modalDialog(
Expand All @@ -727,8 +717,8 @@ mod_Filtering_server <- function(input, output, session, parent_session){
)
))
})


# Download Summary Info
output$download_filtering_info <- downloadHandler(
filename = function() {
Expand Down
Loading