Browse code

remove/deactivate 'remote' argument to comply with Bioc policies about reference to external platforms

Qian Liu authored on 10/01/2023 17:23:36
Showing 7 changed files

... ...
@@ -1,6 +1,6 @@
1 1
 Package: ReUseData
2 2
 Title: Reproducible and ReUsable Data Resources
3
-Version: 0.99.18
3
+Version: 0.99.19
4 4
 Authors@R: 
5 5
     person(given = "Qian",
6 6
            family = "Liu",
... ...
@@ -28,10 +28,6 @@
28 28
 #'     will also remove those.
29 29
 #' @param cloud Whether to return the pre-generated data from Google
30 30
 #'     Cloud bucket of ReUseData. Default is FALSE.
31
-#' @param remote Whether to use the csv file (containing information
32
-#'     about pre-generated data on Google Cloud) from GitHub, which is
33
-#'     most up-to-date. Only works when `cloud = TRUE`. Default is
34
-#'     FALSE.
35 31
 #' @param checkData check if the data (listed as "# output: " in the
36 32
 #'     yml file) exists. If not, do not include in the output csv
37 33
 #'     file. This argument is added for internal testing purpose.
... ...
@@ -79,7 +75,7 @@
79 75
 #' dataSearch(c("ensembl", "liftover"))  ## both locally generated data and google cloud data! 
80 76
 #' 
81 77
 dataUpdate <- function(dir, cachePath = "ReUseData", outMeta = FALSE,
82
-                       keepTags = TRUE, cleanup = FALSE, cloud = FALSE, remote = FALSE, checkData = TRUE) {
78
+                       keepTags = TRUE, cleanup = FALSE, cloud = FALSE, checkData = TRUE) {
83 79
     ## find/create the cache path, and create a BFC object.
84 80
     bfcpath <- Sys.getenv("cachePath")
85 81
     if(bfcpath != ""){
... ...
@@ -106,13 +102,7 @@ dataUpdate <- function(dir, cachePath = "ReUseData", outMeta = FALSE,
106 102
 
107 103
     ## append pre-generated cloud data
108 104
     if (cloud) {
109
-        if (remote) {
110
-            download.file("https://raw.githubusercontent.com/rworkflow/ReUseDataRecipe/master/meta_gcp.csv",
111
-                          file.path(tempdir(), "meta_gcp.csv"))
112
-            meta_gcp <- read.csv(file.path(tempdir(), "meta_gcp.csv"))
113
-        } else {
114
-            meta_gcp <- read.csv(system.file("extdata", "meta_gcp.csv", package = "ReUseData"))
115
-        }
105
+        meta_gcp <- read.csv(system.file("extdata", "meta_gcp.csv", package = "ReUseData"))
116 106
         meta <- rbind(meta, meta_gcp)
117 107
     }
118 108
     
... ...
@@ -9,18 +9,8 @@
9 9
 #'     `recipeSearch`, and `recipeLoad`. Default is "ReUseDataRecipe".
10 10
 #' @param force Whether to remove existing and regenerate recipes
11 11
 #'     cache. Default is FALSE. Only use if any old recipes that have
12
-#'     been previously cached locally are updated remotely (on GitHub
13
-#'     `repos`).
14
-#' @param remote Whether to download the data recipes directly from a
15
-#'     GitHub repository. Default is FALSE.
16
-#' @param repos The GitHub repository containing data recipes that are
17
-#'     to be synced to local cache. Only works when
18
-#'     `remote=TRUE`. Default is "rworkflows/ReUseDataRecipes" GitHub
19
-#'     repository where public data recipes are saved, which might be
20
-#'     more up-to-date than the recipes contained in`ReUseData`
21
-#'     package. It can also be a private GitHub repository where users
22
-#'     save their own data recipes.
23
-#' @return a `recipeHub` object.
12
+#'     been previously cached locally are updated.
13
+##' @return a `recipeHub` object.
24 14
 #' @importFrom tools R_user_dir
25 15
 #' @import BiocFileCache
26 16
 #' @import Rcwl
... ...
@@ -28,14 +18,11 @@
28 18
 #' @export
29 19
 #' @examples
30 20
 #' recipeUpdate()
31
-#' recipeUpdate(force=TRUE)
32
-#' recipeUpdate(force = TRUE, remote = TRUE)
21
+#' ## recipeUpdate(force=TRUE)
33 22
 
34 23
 recipeUpdate <- function(cachePath = "ReUseDataRecipe",
35
-                         force = FALSE,
36
-                         remote = FALSE,
37
-                         repos = "rworkflow/ReUseDataRecipe"){
38
-    
24
+                         force = FALSE){
25
+     
39 26
     ## find/create the cache path, and create a BFC object.
40 27
     bfcpath <- Sys.getenv("cachePath")
41 28
     if(bfcpath != ""){
... ...
@@ -47,8 +34,8 @@ recipeUpdate <- function(cachePath = "ReUseDataRecipe",
47 34
     }
48 35
     bfc <- BiocFileCache(cachePath, ask = FALSE)
49 36
 
50
-    ## if "force=TRUE", remove local recipes, and reload/update all
51
-    ## recipes from remote repo.
37
+    ## if "force=TRUE", remove local cache and reload/update all
38
+    ## recipes for a new cache.
52 39
     if(force){
53 40
         message("Warning: existing caches will be removed and regenerated!")
54 41
         bfcremove(bfc, bfcinfo(bfc)$rid)
... ...
@@ -56,23 +43,12 @@ recipeUpdate <- function(cachePath = "ReUseDataRecipe",
56 43
 
57 44
     ## FIXME: CREATE A private github repo for private data recipes. 
58 45
     message("Update recipes...")
59
-    if (remote) {
60
-        dlpath <- file.path(cachePath, "recipes.zip")
61
-        download.file(paste0("https://github.com/", repos,
62
-                             "/archive/refs/heads/master.zip"),
63
-                      dlpath)
64
-        unzip(dlpath, exdir = cachePath)
65
-        fpath <- list.files(
66
-            file.path(cachePath, paste0(basename(repos), "-master")),
67
-            full.names=TRUE)
68
-        fpath <- fpath[basename(fpath) != "dataGen.R"]
69
-    } else {
70
-        rcpfls <- list.files(
71
-            system.file("extdata/dataRecipes", package = "ReUseData"),
72
-            full.names = TRUE)
73
-        file.copy(rcpfls, cachePath)
74
-        fpath <- list.files(cachePath, pattern = ".R", full.names = TRUE)
75
-    }
46
+    rcpfls <- list.files(
47
+        system.file("extdata/dataRecipes", package = "ReUseData"),
48
+        full.names = TRUE)
49
+    file.copy(rcpfls, cachePath)
50
+    fpath <- list.files(cachePath, pattern = ".R", full.names = TRUE)
51
+    
76 52
     ## add any non-cached recipes to local cache
77 53
     if(length(fpath) > 0){
78 54
         rnames <- sub(".R$", "", basename(fpath))
... ...
@@ -11,7 +11,6 @@ dataUpdate(
11 11
   keepTags = TRUE,
12 12
   cleanup = FALSE,
13 13
   cloud = FALSE,
14
-  remote = FALSE,
15 14
   checkData = TRUE
16 15
 )
17 16
 }
... ...
@@ -47,11 +46,6 @@ will also remove those.}
47 46
 \item{cloud}{Whether to return the pre-generated data from Google
48 47
 Cloud bucket of ReUseData. Default is FALSE.}
49 48
 
50
-\item{remote}{Whether to use the csv file (containing information
51
-about pre-generated data on Google Cloud) from GitHub, which is
52
-most up-to-date. Only works when \code{cloud = TRUE}. Default is
53
-FALSE.}
54
-
55 49
 \item{checkData}{check if the data (listed as "# output: " in the
56 50
 yml file) exists. If not, do not include in the output csv
57 51
 file. This argument is added for internal testing purpose.}
... ...
@@ -4,12 +4,7 @@
4 4
 \alias{recipeUpdate}
5 5
 \title{recipeUpdate}
6 6
 \usage{
7
-recipeUpdate(
8
-  cachePath = "ReUseDataRecipe",
9
-  force = FALSE,
10
-  remote = FALSE,
11
-  repos = "rworkflow/ReUseDataRecipe"
12
-)
7
+recipeUpdate(cachePath = "ReUseDataRecipe", force = FALSE)
13 8
 }
14 9
 \arguments{
15 10
 \item{cachePath}{A character string specifying the name for the
... ...
@@ -19,19 +14,7 @@ specified here, must use the same for \code{cachePath} argument in
19 14
 
20 15
 \item{force}{Whether to remove existing and regenerate recipes
21 16
 cache. Default is FALSE. Only use if any old recipes that have
22
-been previously cached locally are updated remotely (on GitHub
23
-\code{repos}).}
24
-
25
-\item{remote}{Whether to download the data recipes directly from a
26
-GitHub repository. Default is FALSE.}
27
-
28
-\item{repos}{The GitHub repository containing data recipes that are
29
-to be synced to local cache. Only works when
30
-\code{remote=TRUE}. Default is "rworkflows/ReUseDataRecipes" GitHub
31
-repository where public data recipes are saved, which might be
32
-more up-to-date than the recipes contained in\code{ReUseData}
33
-package. It can also be a private GitHub repository where users
34
-save their own data recipes.}
17
+been previously cached locally are updated.}
35 18
 }
36 19
 \value{
37 20
 a \code{recipeHub} object.
... ...
@@ -43,6 +26,5 @@ repository or user-specified private GitHub repo.
43 26
 }
44 27
 \examples{
45 28
 recipeUpdate()
46
-recipeUpdate(force=TRUE)
47
-recipeUpdate(force = TRUE, remote = TRUE)
29
+## recipeUpdate(force=TRUE)
48 30
 }
... ...
@@ -40,7 +40,6 @@ test_that("recipe evaluation works", {
40 40
 
41 41
 test_that("recipe updating works", {
42 42
     rcphub <- recipeUpdate(cachePath = "ReUseDataRecipe",
43
-                           repos = "rworkflow/ReUseDataRecipe",
44 43
                            force = TRUE)
45 44
     expect_s4_class(rcphub, "recipeHub")
46 45
     expect_vector(recipeNames(rcphub))
... ...
@@ -211,11 +211,6 @@ _R_.
211 211
 `recipeLoad` and `recipeSearch` functions.
212 212
 - use `force=TRUE` when any old recipes that are previously cached are
213 213
 updated.
214
-- use `remote = TRUE`to sync with remote GitHub repositories. By
215
-  default, it syncs with `ReUseDataRecipe` GitHub
216
-  repository](https://github.com/rworkflow/ReUseDataRecipe) for
217
-  public, pre-built data recipes. `repo` can also be a private GitHub
218
-  repository.
219 214
 
220 215
 ```{r}
221 216
 ## First time use
... ...
@@ -225,13 +220,6 @@ recipeUpdate(cachePath = "ReUseDataRecipe",
225 220
 recipeUpdate()
226 221
 ```
227 222
 
228
-To sync the local recipe cache with remote GitHub repository.  
229
-
230
-```{r, eval=FALSE}
231
-recipeUpdate(remote = TRUE,
232
-             repos = "rworkflow/ReUseDataRecipe")  ## can be private repo
233
-```
234
-
235 223
 `recipeUpdate` returns a `recipeHub` object with a list of all
236 224
 available recipes. One can subset the list with `[` and use getter
237 225
 functions `recipeNames()` to get the recipe names which can then be