From fddf8b39e8bbfd8576933ac4f609b98fcba6f36a Mon Sep 17 00:00:00 2001 From: "Brian M. Schilder" <34280215+bschilder@users.noreply.github.com> Date: Fri, 25 Feb 2022 14:13:05 -0500 Subject: [PATCH] Save NCBI refs to cache dir. Adjust .Rbuildignore for Windows --- .Rbuildignore | 4 ++++ DESCRIPTION | 5 +++-- NAMESPACE | 1 + NEWS.md | 10 ++++++++++ R/get_genomeLocFile.R | 8 ++++++-- man/get_genomeLocFile.Rd | 6 +++++- 6 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index 5c3a56b..2f5b613 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -14,3 +14,7 @@ Dockerfile ^LICENSE\.md$ inst/hex/ MAGMA.Celltyping/inst/hex + +^node_modules$ +package-lock.json +package.json diff --git a/DESCRIPTION b/DESCRIPTION index 5c1d1dd..cce5d71 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: MAGMA.Celltyping Type: Package Title: Find Causal Cell-Types Underlying Complex Trait Genetics -Version: 2.0.1 +Version: 2.0.2 Authors@R: c(person(given = "Brian", family = "Schilder", @@ -53,7 +53,8 @@ Imports: parallel, Matrix, methods, - reshape2 + reshape2, + tools Suggests: markdown, rmarkdown, diff --git a/NAMESPACE b/NAMESPACE index fb72ca4..1b2504e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -83,6 +83,7 @@ importFrom(stats,quantile) importFrom(stats,residuals) importFrom(stats,setNames) importFrom(stringr,str_split) +importFrom(tools,R_user_dir) importFrom(utils,download.file) importFrom(utils,read.table) importFrom(utils,unzip) diff --git a/NEWS.md b/NEWS.md index 9c79846..29f02e1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,13 @@ +# MAGMA.Celltyping 2.0.2 + +## New features + +* `get_genomeLocFile`: Store NCBI ref file in cache dir by default. + +## Bug fixes + +* Add windows-specific files/folders to *.Rbuildignore*. + # MAGMA.Celltyping 2.0.1 ## New features diff --git a/R/get_genomeLocFile.R b/R/get_genomeLocFile.R index d900fef..d559e04 100644 --- a/R/get_genomeLocFile.R +++ b/R/get_genomeLocFile.R @@ -40,8 +40,12 @@ #' @return File path. #' #' @keywords internal +#' @importFrom tools R_user_dir +#' @importFrom data.table fread get_genomeLocFile <- function(build, - storage_dir = tempdir(), + storage_dir = tools::R_user_dir( + "MAGMA.Celltyping", + which="cache"), overwrite = FALSE) { build <- toupper(build[1]) dict <- c(GRCH36 = "NCBI36.3.gene.loc", @@ -58,7 +62,7 @@ get_genomeLocFile <- function(build, overwrite = overwrite ) #### Check that download was successful #### - d <- data.table::fread(tmp, nrows = 10) + d <- data.table::fread(tmp, nrows = 10, nThread = 1) if(nrow(d)!=10 || ncol(d)!=6){ stopper("genomeLocFile did not download properly.", "Please check that you have a stable internet connection, diff --git a/man/get_genomeLocFile.Rd b/man/get_genomeLocFile.Rd index 4bf2d0f..694597c 100644 --- a/man/get_genomeLocFile.Rd +++ b/man/get_genomeLocFile.Rd @@ -30,7 +30,11 @@ for(x in names(local_files)){ } } \usage{ -get_genomeLocFile(build, storage_dir = tempdir(), overwrite = FALSE) +get_genomeLocFile( + build, + storage_dir = tools::R_user_dir("MAGMA.Celltyping", which = "cache"), + overwrite = FALSE +) } \arguments{ \item{build}{Genome build. Must be one of: