diff --git a/DESCRIPTION b/DESCRIPTION index e200cc1..342618b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: wilson Type: Package Title: Web-Based Interactive Omics Visualization -Version: 2.3.0 +Version: 2.3.1 Authors@R: c( person("Hendrik", "Schultheis", email = "hendrik.schultheis@mpi-bn.mpg.de", role = c("aut", "cre")), person("Jens", "Preussner", email = "jens.preussner@mpi-bn.mpg.de", role = "aut"), @@ -16,7 +16,7 @@ LazyData: true Imports: shiny, data.table, ggplot2, - plotly, + plotly (> 4.8.0), scales, shinydashboard, DT (>= 0.3), @@ -46,7 +46,8 @@ Imports: shiny, openssl, methods, R6, - magrittr + magrittr, + zip RoxygenNote: 6.1.1 biocViews: Suggests: knitr, diff --git a/R/function.R b/R/function.R index 10b16c3..58fcb2f 100644 --- a/R/function.R +++ b/R/function.R @@ -1207,7 +1207,7 @@ searchData <- function(input, choices, options = c("=", "<", ">"), min. = min(ch #' @param save_plot Logical if plot object should be saved as .RData. #' @param ui List of user inputs. Will be converted to JavaScript Object Notation. See \code{\link[RJSONIO]{toJSON}} #' -#' @return See \code{\link[utils]{zip}}. +#' @return Path to zip archive invisibly. See \code{\link[zip]{zipr}}. download <- function(file, filename, plot, width, height, ppi = 72, save_plot = TRUE, ui = NULL) { session <- shiny::getDefaultReactiveDomain() @@ -1246,8 +1246,9 @@ download <- function(file, filename, plot, width, height, ppi = 72, save_plot = wd <- getwd() on.exit(setwd(wd)) # make sure working directory will be restored setwd(tempdir()) - plotly::export(p = plot, file = plot_file_pdf) - plotly::export(p = plot, file = plot_file_png) + # Omit file path because orca adds it regardles of it already being there. + plotly::orca(p = plot, file = basename(plot_file_pdf)) + plotly::orca(p = plot, file = basename(plot_file_png)) setwd(wd) } else if (class(plot) == "Heatmap") { # TODO: find better way to check for complexHeatmap object # complexHeatmap @@ -1288,7 +1289,7 @@ download <- function(file, filename, plot, width, height, ppi = 72, save_plot = } # create zip file - out <- utils::zip(zipfile = file, files = files, flags = "-j") # discard file path + out <- zip::zipr(zipfile = file, files = files, include_directories = FALSE) # remove tmp files file.remove(files) diff --git a/R/parser.R b/R/parser.R index c2ca756..6ad959e 100644 --- a/R/parser.R +++ b/R/parser.R @@ -365,7 +365,13 @@ parser <- function(file, dec = ".") { names(metadata) <- as.character(metadata[1]) # remove empty columns - metadata <- metadata[, which(unlist(lapply(metadata, function(x) !all(is.na(x) || x == "")))), with = FALSE] + empty_cols <- union( + which(colSums(is.na(metadata)) == nrow(metadata)), # indices of full na columns + which(colSums(metadata == "") == nrow(metadata)) # indices of full "" columns + ) + if (length(empty_cols) > 0) { + metadata[, (empty_cols) := NULL] + } # delete first line metadata <- metadata[-1] diff --git a/man/download.Rd b/man/download.Rd index a74245e..e500b7d 100644 --- a/man/download.Rd +++ b/man/download.Rd @@ -27,7 +27,7 @@ download(file, filename, plot, width, height, ppi = 72, \item{ui}{List of user inputs. Will be converted to JavaScript Object Notation. See \code{\link[RJSONIO]{toJSON}}} } \value{ -See \code{\link[utils]{zip}}. +Path to zip archive invisibly. See \code{\link[zip]{zipr}}. } \description{ Function used for downloading. diff --git a/tests/figs/create-static-plots/static-geneview.svg b/tests/figs/create-static-plots/static-geneview.svg index 6793332..22556ee 100644 --- a/tests/figs/create-static-plots/static-geneview.svg +++ b/tests/figs/create-static-plots/static-geneview.svg @@ -2,7 +2,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -190,25 +190,25 @@ - + - + - + - + - + @@ -222,25 +222,25 @@ - + - + - + - + - + @@ -254,270 +254,271 @@ - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Mazda RX4 -Mazda RX4 Wag -Datsun 710 -Hornet 4 Drive -Hornet Sportabout -Valiant -Duster 360 -Merc 240D -Merc 230 -Merc 280 -Merc 280C -Merc 450SE -Merc 450SL -Merc 450SLC -Cadillac Fleetwood -Lincoln Continental -Chrysler Imperial -Fiat 128 -Honda Civic -Toyota Corolla -Toyota Corona -Dodge Challenger -AMC Javelin -Camaro Z28 -Pontiac Firebird -Fiat X1-9 -Porsche 914-2 -Lotus Europa -Ford Pantera L -Ferrari Dino -Maserati Bora -Volvo 142E -mpg -cyl -disp -hp -drat -wt -qsec -vs -am -gear -carb -auto -0 -100 -200 -300 -400 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Mazda RX4 +Mazda RX4 Wag +Datsun 710 +Hornet 4 Drive +Hornet Sportabout +Valiant +Duster 360 +Merc 240D +Merc 230 +Merc 280 +Merc 280C +Merc 450SE +Merc 450SL +Merc 450SLC +Cadillac Fleetwood +Lincoln Continental +Chrysler Imperial +Fiat 128 +Honda Civic +Toyota Corolla +Toyota Corona +Dodge Challenger +AMC Javelin +Camaro Z28 +Pontiac Firebird +Fiat X1-9 +Porsche 914-2 +Lotus Europa +Ford Pantera L +Ferrari Dino +Maserati Bora +Volvo 142E +mpg +cyl +disp +hp +drat +wt +qsec +vs +am +gear +carb +auto +0 +100 +200 +300 +400 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/figs/create-static-plots/static-pca.svg b/tests/figs/create-static-plots/static-pca.svg index 609ff93..81b3f45 100644 --- a/tests/figs/create-static-plots/static-pca.svg +++ b/tests/figs/create-static-plots/static-pca.svg @@ -2,7 +2,7 @@