Skip to content
This repository has been archived by the owner. It is now read-only.

Download #37

Merged
merged 7 commits into from
Oct 17, 2019
Merged
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
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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"),
Expand All @@ -16,7 +16,7 @@ LazyData: true
Imports: shiny,
data.table,
ggplot2,
plotly,
plotly (> 4.8.0),
scales,
shinydashboard,
DT (>= 0.3),
Expand Down Expand Up @@ -46,7 +46,8 @@ Imports: shiny,
openssl,
methods,
R6,
magrittr
magrittr,
zip
RoxygenNote: 6.1.1
biocViews:
Suggests: knitr,
Expand Down
9 changes: 5 additions & 4 deletions R/function.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion R/parser.R
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion man/download.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

704 changes: 352 additions & 352 deletions tests/figs/create-static-plots/static-geneview.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
857 changes: 429 additions & 428 deletions tests/figs/create-static-plots/static-heatmap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 45 additions & 45 deletions tests/figs/create-static-plots/static-pca.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading