Skip to content

Commit

Permalink
feat: enables upload of paramsRData file for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
ivokwee committed Aug 4, 2024
1 parent 256a7b2 commit 2023089
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
20 changes: 18 additions & 2 deletions components/board.upload/R/upload_module_preview_counts.R
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ upload_table_preview_counts_server <- function(

# check if counts is csv (necessary due to drag and drop of any file)
ext <- tools::file_ext(input$counts_csv$name)
if (!all(ext == "csv")) {
if (!all(ext %in% c("csv","RData"))) {
shinyalert::shinyalert(
title = "File format not supported.",
text = "Please make sure the file is a CSV file.",
Expand All @@ -244,7 +244,7 @@ upload_table_preview_counts_server <- function(
}

# if counts not in file name, give warning and return
if (!any(grepl("count|expression|abundance", tolower(input$counts_csv$name)))) {
if (!any(grepl("count|expression|abundance|params.rdata", tolower(input$counts_csv$name)))) {
shinyalert::shinyalert(
title = tspan("Counts not in filename."),
text = tspan("Please make sure the file name contains 'counts', such as counts_dataset.csv or counts.csv."),
Expand All @@ -270,6 +270,22 @@ upload_table_preview_counts_server <- function(
df <- playbase::read_contrasts(input$counts_csv$datapath[sel[1]])
uploaded$contrasts.csv <- df
}

sel <- grep("params.RData", input$counts_csv$name)
if (length(sel)) {
params <- readRDS(input$counts_csv$datapath[sel[1]])
uploaded$samples.csv <- params$samples
uploaded$contrasts.csv <- params$contrasts
uploaded$counts.csv <- params$counts
## recompute_info(
## list(
## "name" = params$name,
## "description" = params$description
## )
## )
}


})

observeEvent(input$remove_counts, {
Expand Down
1 change: 0 additions & 1 deletion components/board.upload/R/upload_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ UploadBoard <- function(id,

# Some 'global' reactive variables used in this file
uploaded <- shiny::reactiveValues()
## checked <- shiny::reactiveValues()
checklist <- shiny::reactiveValues()
# this directory is used to save pgx files, logs, inputs, etc..
raw_dir <- reactiveVal(NULL)
Expand Down

0 comments on commit 2023089

Please sign in to comment.