Skip to content

Commit 620bed3

Browse files
committed
Amend extract_instruments clump arg to match ieugwasr::tophits clump arg
1 parent 365541b commit 620bed3

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
(Release date 2025-12-12)
44

55
* Fixed the passing of the `force_server` argument within `extract_instruments()` through to `ieugwasr::tophits()` (thanks @yikeshu0611).
6+
* Amended the `extract_instruments()` `clump` argument to additionally take values `1` or `0` as per the `ieugwasr::tophits()` `clump` argument (thanks @yikeshu0611).
67

78
# TwoSampleMR v0.6.25
89

R/instruments.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#'
66
#' @param outcomes Array of outcome IDs (see [available_outcomes()]).
77
#' @param p1 Significance threshold. The default is `5e-8`.
8-
#' @param clump Logical; whether to clump results. The default is `TRUE`.
8+
#' @param clump Whether to clump results (`1`) or not (`0`). Default is `1`. (`TRUE` and `FALSE` are also allowed for backwards compatibility.)
99
#' @param p2 Secondary clumping threshold. The default is `5e-8`.
1010
#' @param r2 Clumping r2 cut off. The default is `0.001`.
1111
#' @param kb Clumping distance cutoff. The default is `10000`.
@@ -17,13 +17,16 @@
1717
extract_instruments <- function(
1818
outcomes,
1919
p1 = 5e-8,
20-
clump = TRUE,
20+
clump = 1,
2121
p2 = 5e-8,
2222
r2 = 0.001,
2323
kb = 10000,
2424
opengwas_jwt = ieugwasr::get_opengwas_jwt(),
2525
force_server = FALSE
2626
) {
27+
if (!(clump %in% c(0, 1, FALSE, TRUE))) stop("The clump argument should be 0 or 1.")
28+
if (clump) clump <- 1
29+
if (!clump) clump <- 0
2730
# .Deprecated("ieugwasr::tophits()")
2831
outcomes <- ieugwasr::legacy_ids(unique(outcomes))
2932

man/extract_instruments.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test_ld.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ skip_if_offline(host = "api.opengwas.io")
66
skip_on_cran()
77

88
# extract some data
9-
a <- try(extract_instruments("ieu-a-2", clump = FALSE))
9+
a <- try(extract_instruments("ieu-a-2", clump = 0))
1010
if (class(a) == "try-error") {
1111
skip("Server issues")
1212
}
@@ -37,7 +37,7 @@ test_that("matrix", {
3737

3838

3939
test_that("clump multiple", {
40-
a <- try(extract_instruments(c("ieu-a-2", "ieu-a-1001"), clump = FALSE))
40+
a <- try(extract_instruments(c("ieu-a-2", "ieu-a-1001"), clump = 0))
4141
if (class(a) == "try-error") {
4242
skip("Server issues")
4343
}

0 commit comments

Comments
 (0)