diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index c41bda2..1f34717 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,6 +7,11 @@ assignees: '' --- +:warning: :warning: :warning: +PLEASE NOTE, YOUR ISSUE WILL BE AUTOMATICALLY CLOSED IF IT DOES NOT USE AND COMPLETE THE TEMPLATE. +These templates are designed to give us the basic information necessary to help debug your issues. +:warning: :warning: :warning: + ## 1. Bug description (A clear and concise description of what the bug is.) diff --git a/.github/workflows/auto-close-issues.yml b/.github/workflows/auto-close-issues.yml new file mode 100644 index 0000000..bfc9cd8 --- /dev/null +++ b/.github/workflows/auto-close-issues.yml @@ -0,0 +1,16 @@ +on: + issues: + types: [opened, edited] + +jobs: + auto_close_issues: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Automatically close issues that don't follow the issue template + uses: lucasbento/auto-close-issues@v1.0.2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + issue-close-message: "@${issue.user.login}: hello! :wave:\n\nThis issue is being automatically closed because it does not follow the issue template." # optional property + closed-issues-label: "🙁 Not following issue template" # optional property diff --git a/DESCRIPTION b/DESCRIPTION index a861f6b..53c44ff 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.12 +Version: 2.0.13 Authors@R: c(person(given = "Brian", family = "Schilder", @@ -73,6 +73,6 @@ Suggests: SystemRequirements: A system installation of [MAGMA](https://ctg.cncr.nl/software/magma) is required but can be installed automatically by this package. -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 Encoding: UTF-8 Config/testthat/edition: 3 diff --git a/NEWS.md b/NEWS.md index c177f7a..d3dea2a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,15 @@ +# MAGMA.Celltyping 2.0.13 + +## New features + +* Fully remove deprecated function `format.sumstats.for.magma` +* Add auto-close-template: https://github.com/marketplace/actions/auto-close-issues + +## Bug fixes + +* Update URLs for getting MAGMA reference genome files (#154). +* *test-magma_links.R*: `package_version` comparisons now only work with strings instead of numbers. + # MAGMA.Celltyping 2.0.12 ## Bug fixes diff --git a/R/format_sumstats_for_magma.r b/R/format_sumstats_for_magma.r index a61db83..b8187fe 100644 --- a/R/format_sumstats_for_magma.r +++ b/R/format_sumstats_for_magma.r @@ -21,7 +21,4 @@ format_sumstats_for_magma <- function(path) { mungesumstats_deprecation_msg() } - -format.sumstats.for.magma <- function(path){ - format_sumstats_for_magma(path) -} + diff --git a/R/get_example_gwas_raw.R b/R/get_example_gwas_raw.R index 0744bb2..c1341ef 100644 --- a/R/get_example_gwas_raw.R +++ b/R/get_example_gwas_raw.R @@ -2,9 +2,9 @@ #' #' Write example GWAS summary statistics to disk. #' -#' @param save_path Path to save sum stats. #' @param timeout How many seconds to wait before timeout. #' @param verbose Print messages. +#' @inheritParams get_data #' #' @return Path to sumstats #' diff --git a/R/get_genome_ref.R b/R/get_genome_ref.R index 8188a49..0c23eae 100644 --- a/R/get_genome_ref.R +++ b/R/get_genome_ref.R @@ -32,28 +32,21 @@ #' #' @examples #' \dontrun{ -#' genome_ref_path <- MAGMA.Celltyping::get_genome_ref() +#' genome_ref_path <- get_genome_ref() #' } get_genome_ref <- function(genome_ref_path = NULL, storage_dir = tools::R_user_dir( "MAGMA.Celltyping", which="cache"), - method = c("magma","piggback"), + method = c("magma"), population = c("eur", "afr", "amr", "eas", "sas"), timeout = 60 * 5, verbose = TRUE) { #### population #### dir.create(storage_dir,showWarnings = FALSE, recursive = TRUE) population <- tolower(population[1]) + population <- match.arg(population) method <- tolower(method[1]) - pop_opts <- c("eur", "afr", "amr", "eas", "sas") - if (!population %in% pop_opts) { - stop_msg <- paste0( - "population must be one of:\n", - paste0(" - ", pop_opts, collapse = "\n") - ) - stop(stop_msg) - } #### Set up paths #### if (is.null(genome_ref_path)) { genome_ref_dir <- file.path(storage_dir, @@ -83,7 +76,12 @@ get_genome_ref <- function(genome_ref_path = NULL, verbose = verbose ) } - + ### Reference file is too large to be stored in GitHub Releases now + #else if(method == "piggyback"){ + # get_genome_ref_piggyback( + # genome_ref_dir = genome_ref_dir, + # verbose = verbose + # ) } #### Return the folder + the file prefix #### return(genome_ref_path) diff --git a/R/get_genome_ref_magma.R b/R/get_genome_ref_magma.R index 88b5e24..34d079f 100644 --- a/R/get_genome_ref_magma.R +++ b/R/get_genome_ref_magma.R @@ -6,18 +6,22 @@ #' #' @param genome_ref_dir Folder to download reference to. #' @param verbose Print messages. -#' @source \href{https://ctg.cncr.nl/software/MAGMA/ref_data/}{MAGMA archives} +#' @source \href{https://cncr.nl/research/magma/}{MAGMA site} #' #' @keywords internal get_genome_ref_magma <- function(genome_ref_dir, + population = "eur", timeout = 60 * 5, verbose = TRUE) { #### Get link #### - input_url <- paste( - "https://ctg.cncr.nl/software/MAGMA", - "ref_data",paste0(basename(genome_ref_dir),".zip"), - sep="/" - ) + link_dict <- list( + "g1000_eur"="https://vu.data.surfsara.nl/index.php/s/VZNByNwpD8qqINe/download", + "g1000_afr"="https://vu.data.surfsara.nl/index.php/s/ePXET6IWVTwTes4/download", + "g1000_eas"="https://vu.data.surfsara.nl/index.php/s/dz6PYdKOi3xVqHn/download", + "g1000_sas"="https://vu.data.surfsara.nl/index.php/s/C6UkTV5nuFo8cJC/download", + "g1000_amr"="https://vu.data.surfsara.nl/index.php/s/TXDEm70eEO7AgOb/download" + ) + input_url <- link_dict[[paste0("g1000_",tolower(population))]] ##### Link to 1000 genomes reference data. #### zipfile <- sprintf("%s.zip", genome_ref_dir) #### Download file #### diff --git a/R/get_genome_ref_piggyback.R b/R/get_genome_ref_piggyback.R index 587752c..d351322 100644 --- a/R/get_genome_ref_piggyback.R +++ b/R/get_genome_ref_piggyback.R @@ -6,9 +6,10 @@ #' #' @param genome_ref_dir Folder to download reference to. #' @param verbose Print messages. +#' @inheritDotParams get_data #' @source #' \code{ -#' genome_ref_path <- MAGMA.Celltyping::get_genome_ref(method = "magma") +#' genome_ref_path <- get_genome_ref(method = "magma") #' #' piggyback::pb_upload(file = genome_ref_path, #' repo = "neurogenomics/MAGMA_Celltyping", @@ -16,14 +17,16 @@ #' } #' @keywords internal get_genome_ref_piggyback <- function(genome_ref_dir, - verbose = TRUE) { + verbose = TRUE, + ...) { ##### Link to 1000 genomes reference data. #### zipfile <- sprintf("%s.zip", genome_ref_dir) #### Download file #### options(timeout = 60 * 5) get_data(paste0(basename(genome_ref_dir),".zip"), repo = "neurogenomics/MAGMA_Celltyping", - storage_dir = genome_ref_dir) + storage_dir = genome_ref_dir, + ...) #### Unzip file #### messager("Unzipping file.", v = verbose) utils::unzip( diff --git a/README.md b/README.md index 87d4124..415c163 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@
[![License: GPL-3](https://img.shields.io/badge/license-GPL--3-blue.svg)](https://cran.r-project.org/web/licenses/GPL-3) -[![](https://img.shields.io/badge/devel%20version-2.0.9-black.svg)](https://github.com/neurogenomics/MAGMA_Celltyping) +[![](https://img.shields.io/badge/devel%20version-2.0.13-black.svg)](https://github.com/neurogenomics/MAGMA_Celltyping) [![](https://img.shields.io/github/languages/code-size/neurogenomics/MAGMA_Celltyping.svg)](https://github.com/neurogenomics/MAGMA_Celltyping) [![](https://img.shields.io/github/last-commit/neurogenomics/MAGMA_Celltyping.svg)](https://github.com/neurogenomics/MAGMA_Celltyping/commits/master)
[![R build status](https://github.com/neurogenomics/MAGMA_Celltyping/workflows/rworkflows/badge.svg)](https://github.com/neurogenomics/MAGMA_Celltyping/actions) -[![](https://codecov.io/gh/neurogenomics/MAGMA_Celltyping/branch/master/graph/badge.svg)](https://codecov.io/gh/neurogenomics/MAGMA_Celltyping) +[![](https://codecov.io/gh/neurogenomics/MAGMA_Celltyping/branch/master/graph/badge.svg)](https://app.codecov.io/gh/neurogenomics/MAGMA_Celltyping)

@@ -14,7 +14,7 @@ Authors: Brian Schilder, Alan Murphy, Julien Bryois, Nathan Skene

-README updated: Apr-12-2023 +README updated: Oct-02-2024

## Introduction diff --git a/man/get_example_gwas_raw.Rd b/man/get_example_gwas_raw.Rd index 947221c..94279db 100644 --- a/man/get_example_gwas_raw.Rd +++ b/man/get_example_gwas_raw.Rd @@ -15,8 +15,6 @@ get_example_gwas_raw( \item{timeout}{How many seconds to wait before timeout.} \item{verbose}{Print messages.} - -\item{save_path}{Path to save sum stats.} } \value{ Path to sumstats diff --git a/man/get_genome_ref.Rd b/man/get_genome_ref.Rd index aeb7033..1df7fb8 100644 --- a/man/get_genome_ref.Rd +++ b/man/get_genome_ref.Rd @@ -7,7 +7,7 @@ get_genome_ref( genome_ref_path = NULL, storage_dir = tools::R_user_dir("MAGMA.Celltyping", which = "cache"), - method = c("magma", "piggback"), + method = c("magma"), population = c("eur", "afr", "amr", "eas", "sas"), timeout = 60 * 5, verbose = TRUE @@ -49,6 +49,6 @@ If the file already exists, it will simply return the path. } \examples{ \dontrun{ -genome_ref_path <- MAGMA.Celltyping::get_genome_ref() +genome_ref_path <- get_genome_ref() } } diff --git a/man/get_genome_ref_magma.Rd b/man/get_genome_ref_magma.Rd index 4f1190d..b166c6c 100644 --- a/man/get_genome_ref_magma.Rd +++ b/man/get_genome_ref_magma.Rd @@ -4,10 +4,15 @@ \alias{get_genome_ref_magma} \title{Download genome ref: magma} \source{ -\href{https://ctg.cncr.nl/software/MAGMA/ref_data/}{MAGMA archives} +\href{https://cncr.nl/research/magma/}{MAGMA site} } \usage{ -get_genome_ref_magma(genome_ref_dir, timeout = 60 * 5, verbose = TRUE) +get_genome_ref_magma( + genome_ref_dir, + population = "eur", + timeout = 60 * 5, + verbose = TRUE +) } \arguments{ \item{genome_ref_dir}{Folder to download reference to.} diff --git a/man/get_genome_ref_piggyback.Rd b/man/get_genome_ref_piggyback.Rd index a930ddb..a9fbc5a 100644 --- a/man/get_genome_ref_piggyback.Rd +++ b/man/get_genome_ref_piggyback.Rd @@ -5,7 +5,7 @@ \title{Download genome ref: piggyback} \source{ \code{ -genome_ref_path <- MAGMA.Celltyping::get_genome_ref(method = "magma") +genome_ref_path <- get_genome_ref(method = "magma") piggyback::pb_upload(file = genome_ref_path, repo = "neurogenomics/MAGMA_Celltyping", @@ -13,12 +13,22 @@ piggyback::pb_upload(file = genome_ref_path, } } \usage{ -get_genome_ref_piggyback(genome_ref_dir, verbose = TRUE) +get_genome_ref_piggyback(genome_ref_dir, verbose = TRUE, ...) } \arguments{ \item{genome_ref_dir}{Folder to download reference to.} \item{verbose}{Print messages.} + +\item{...}{ + Arguments passed on to \code{\link[=get_data]{get_data}} + \describe{ + \item{\code{repo}}{Repository name in format "owner/repo". Defaults to \code{guess_repo()}.} + \item{\code{tag}}{tag for the GitHub release to which this data should be attached.} + \item{\code{overwrite}}{Should any local files of the same name be overwritten? +default \code{TRUE}.} + \item{\code{.token}}{GitHub authentication token, see \verb{[gh::gh_token()]}} + }} } \description{ Download and decompress the genome reference needed to run diff --git a/tests/testthat/test-magma_links.R b/tests/testthat/test-magma_links.R index f7066b2..965bcf5 100644 --- a/tests/testthat/test-magma_links.R +++ b/tests/testthat/test-magma_links.R @@ -11,17 +11,17 @@ test_that("magma_links works", { magma_mac <-MAGMA.Celltyping:::magma_links(latest_only = TRUE, os = "Mac", verbose = FALSE) - testthat::expect_true(to_version(magma_mac)>=1.1) + testthat::expect_true(to_version(magma_mac)>="1.1") #### Windows #### magma_win <- MAGMA.Celltyping:::magma_links(latest_only = TRUE, os = "Windows") - testthat::expect_true(to_version(magma_win)>=1.1) + testthat::expect_true(to_version(magma_win)>="1.1") #### Linux #### magma_linux <- MAGMA.Celltyping:::magma_links(latest_only = TRUE, os = "Linux") - testthat::expect_true(to_version(magma_linux)>=1.1) + testthat::expect_true(to_version(magma_linux)>="1.1") #### All #### meta <- MAGMA.Celltyping:::magma_links(latest_only = FALSE,