Skip to content

Commit

Permalink
add oss suport for donwloading data
Browse files Browse the repository at this point in the history
  • Loading branch information
ShixiangWang committed Jan 31, 2024
1 parent 3b24ee0 commit 8733981
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Imports:
forcats,
ggplot2 (>= 3.2.0),
ggpubr (>= 0.2),
httr,
magrittr (>= 1.5),
ppcor,
psych,
Expand Down
6 changes: 6 additions & 0 deletions R/load_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#' - `pancancer_conserved_immune_subtype`: Pan-cancer conserved immune subtypes.
#' - `pcawg_TIL`: PCAWG TIL data.
#' - `pcawg_PW`: ssGSEA scores of HALLMARK, KEGG, IOBR terms for PCAWG samples.
#' - ...

#'
#' @return a dataset, typically a `data.frame`.
Expand Down Expand Up @@ -79,6 +80,11 @@ load_data <- function(name) {
# Download it to inst/extdata from zenodo
# Then load it
data_url <- file.path("https://zenodo.org/record/10340116/files", name2)
if (tryCatch(httr::status_code(httr::HEAD(data_url)),
error = function(e) 404) != 200) {
# Use an alternative OSS approach
data_url <- file.path("https://ucscxenashiny-1301043367.cos.ap-shanghai.myqcloud.com", name2)
}
message("Loading data from remote: ", data_url, ", please wait...")
name <- FALSE
tryCatch(
Expand Down
2 changes: 1 addition & 1 deletion inst/shinyapp/App.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (xena.runMode == "server") {
}

# Load necessary packages ----------------------------------
message("Checking depedencies...")
message("Checking dependencies...")

if (!requireNamespace("pacman")) {
install.packages("pacman", repos = "http://cran.r-project.org")
Expand Down
1 change: 1 addition & 0 deletions man/load_data.Rd

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

0 comments on commit 8733981

Please sign in to comment.